/*
Theme Name: GlobalCam Live
Version: 1.3
Description: 稳定且响应式的全球实时摄像头主题模板，采用扁平化设计，全面兼容 en.html 样式。
*/

/* --- 变量和基础重置 (匹配 en.html 风格) --- */
:root {
    --primary: #2c3e50;    /* 深蓝色 (主要背景/文本) */
    --secondary: #3498db;   /* 亮蓝色 (强调色/链接) */
    --accent: #e74c3c;      /* 红色 (LIVE 标记) */
    --bg-color: #f4f6f8;    /* 浅灰色 (页面背景) */
    --white: #ffffff;
    --text-color: #333;
    --radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* 扁平化阴影 */
    --dark: #2c3e50;
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body { 
    background: var(--bg-color); 
    color: var(--text-color); 
    line-height: 1.6; 
}
a { text-decoration: none; color: inherit; }

/* --- 全局容器：限制宽度并居中 --- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px; 
}


/* =================================================== */
/* --- 头部样式 (Header.php) --- */
/* =================================================== */
header { 
    background-color: var(--primary); 
    color: white; 
    padding: 15px 0; 
    box-shadow: var(--shadow); 
    margin-bottom: 30px; 
}

.header-content {
    display: flex;
    justify-content: space-between; 
    align-items: center; 
    gap: 20px; 
}

.logo {
    font-size: 1.6rem;
    font-weight: 700;
    white-space: nowrap; 
}
.logo i { margin-right: 8px; color: var(--secondary); }

.nav-links {
    display: flex;
    gap: 25px;
    flex-grow: 1; 
    justify-content: center; 
}
.nav-links a {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    padding: 5px 0;
    transition: color 0.2s, border-color 0.2s;
    border-bottom: 2px solid transparent;
}
.nav-links a:hover, .nav-links a.active {
    color: var(--white);
    border-color: var(--secondary);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    white-space: nowrap;
}
.language-selector select, .user-actions button {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.9rem;
}
.user-actions button#loginBtn { background: var(--secondary); border-color: var(--secondary); }
.user-actions button:hover { background: rgba(255, 255, 255, 0.2); }
.user-actions button#loginBtn:hover { background: #2980b9; border-color: #2980b9; }


/* =================================================== */
/* --- 核心布局 (index.php) --- */
/* =================================================== */
.main-content {
    display: flex; 
    gap: 30px;     
    align-items: flex-start; 
}

/* 侧边栏 */
.sidebar {
    width: 280px;      
    flex-shrink: 0;    
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: sticky; 
    top: 30px;
    height: fit-content;
}
.search-box input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; margin-bottom: 20px; }
.filter-section { margin-bottom: 25px; }
.filter-section h3 { font-size: 1.1rem; margin-bottom: 10px; color: var(--primary); border-bottom: 2px solid #eee; padding-bottom: 5px; }
.filter-options label { display: block; margin-bottom: 8px; cursor: pointer; }

/* 国家列表 */
.countries-list { max-height: 500px; overflow-y: auto; padding-right: 5px; }
.country-item {
    padding: 8px 10px; cursor: pointer; display: flex; align-items: center; gap: 10px; border-radius: 4px; transition: 0.2s;
}
.country-item:hover { background: #f0f0f0; }
.country-item.active { background: var(--secondary); color: white; }
.country-item.active span { color: white; } 
.country-flag { width: 20px; border-radius: 2px; }


/* =================================================== */
/* --- 摄像头网格和卡片样式 (主页内容 - 核心修改) --- */
/* =================================================== */
.cameras-section { flex-grow: 1; min-width: 0; }
.section-header { margin-bottom: 20px; }

.cameras-grid {
    display: grid;
    /* 网格宽度调整为 300px，匹配 en.html 风格 */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); 
    gap: 20px;
}

.camera-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
    display: block; 
}
.camera-card:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 8px 18px rgba(0,0,0,0.15); 
}

/* 图片比例修正：强制 16:9 比例，与 en.html 保持一致 */
.thumb-wrapper { 
    position: relative; 
    width: 100%;
    /* 9 / 16 * 100 = 56.25% */
    padding-top: 56.25%; 
    background: #eee; 
    overflow: hidden;
}
.thumb-wrapper img { 
    position: absolute; 
    top: 0;
    left: 0;
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}

.live-tag { 
    position: absolute; 
    top: 10px; 
    right: 10px; 
    background: var(--accent); 
    color: white; 
    padding: 3px 10px; 
    font-size: 0.8rem; 
    border-radius: 4px; 
    font-weight: bold; 
}

/* 信息区修正：固定高度和 Flex 布局，保证标题和元数据对齐 */
.card-info { 
    padding: 15px; 
    height: 100px; /* 统一高度，避免错位 */
    display: flex;
    flex-direction: column;
}

/* 标题修正：允许两行显示，字号增大 */
.card-title { 
    font-size: 1.15rem; 
    font-weight: 700; 
    color: var(--dark); 
    margin-bottom: 5px; 
    white-space: normal; 
    overflow: hidden; 
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 限制为 2 行 */
    -webkit-box-orient: vertical;
}

/* 元数据修正：推到底部 */
.card-meta { 
    font-size: 0.9rem; 
    color: #888; 
    display: flex; 
    justify-content: space-between; 
    margin-top: auto; /* 关键：推到底部 */
}
.card-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}


/* =================================================== */
/* --- 文章详情页样式 (Single.php) --- */
/* =================================================== */
.single-content-wrapper { padding-bottom: 50px; }
.single-video-container {
    background: #000;
    width: 100%;
    aspect-ratio: 16/9; 
    margin-bottom: 25px;
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
}
.single-video-container iframe {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
.single-info-bar {
    display: flex; justify-content: space-between; align-items: flex-start; background: var(--white); padding: 25px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 25px;
}
.single-meta-tags span { margin-right: 20px; color: #666; font-size: 0.95rem; }
.post-content { background: var(--white); padding: 30px; border-radius: var(--radius); box-shadow: var(--shadow); }


/* =================================================== */
/* --- 尾部样式 (Footer.php) --- */
/* =================================================== */
footer {
    background: var(--primary);
    color: rgba(255,255,255,0.8);
    padding: 40px 0 20px; /* 顶部更多填充 */
    margin-top: 50px; 
}

/* 核心 Flex 布局：多列 */
.footer-content {
    display: flex;
    flex-wrap: wrap; /* 允许换行 */
    justify-content: space-between;
    gap: 30px; /* 列间距 */
}

.footer-section {
    flex: 1; /* 自动分配空间 */
    min-width: 200px; /* 最小宽度，防止在中间尺寸屏幕上挤压 */
    padding: 0 10px;
}

.footer-section h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: var(--secondary); /* 标题使用强调色 */
}

/* 段落文字 */
.footer-section p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: rgba(255,255,255,0.7);
}

/* 链接列表 */
.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: rgba(255,255,255,0.7);
    transition: color 0.2s;
    font-size: 0.95rem;
}

.footer-links a:hover {
    color: var(--white);
    text-decoration: underline;
}

/* 社交图标 */
.social-links a {
    color: var(--white);
    font-size: 1.5rem;
    margin-right: 15px;
    transition: color 0.2s;
}
.social-links a:hover {
    color: var(--secondary);
}

/* 版权信息 */
.copyright {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
}


/* =================================================== */
/* --- 响应式设计 --- */
/* =================================================== */
@media (max-width: 900px) {
    .header-content { flex-wrap: wrap; justify-content: center; }
    .nav-links { order: 1; margin: 10px 0; flex-basis: 100%; } 
    .header-controls { order: 2; margin-top: 10px; }
    
    .main-content { flex-direction: column; }
    .sidebar { 
        width: 100%; 
        position: static; 
        margin-bottom: 20px;
    }
    .cameras-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* 手机上卡片可以稍微小点 */
    }
}