/* 公共样式文件 
   作者：张同学
   日期：2024年3月
   说明：包含头部、底部、按钮等公共组件样式 */

/* ========== 颜色变量 ========== */
:root {
    --primary-color: #2C3E50;     /* 主色调 - 深蓝灰 */
    --secondary-color: #3498DB;    /* 辅助色 - 天蓝色 */
    --accent-color: #E74C3C;       /* 强调色 - 珊瑚红 */
    --bg-color: #FFFFFF;           /* 背景色 - 白色 */
    --bg-gray: #F5F7FA;           /* 背景色 - 浅灰 */
    --text-color: #333333;         /* 文字颜色 - 深灰 */
    --text-light: #666666;         /* 次要文字 */
    --border-color: #E5E5E5;       /* 边框颜色 */
    --shadow-color: rgba(0, 0, 0, 0.1);  /* 阴影颜色 */
}

/* ========== 容器布局 ========== */
.container {
    width: 100%;
    max-width: 768px;
    margin: 0 auto;
    padding: 0 15px;
}

.section {
    padding: 30px 0;
}

/* ========== 头部样式 ========== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: var(--primary-color);
    box-shadow: 0 2px 5px var(--shadow-color);
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 15px;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: #fff;
}

.menu-btn {
    width: 30px;
    height: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.menu-btn span {
    width: 20px;
    height: 2px;
    background: #fff;
    margin: 3px 0;
    transition: all 0.3s ease;
}

/* 导航菜单 */
.nav-menu {
    position: fixed;
    top: 50px;
    left: -100%;
    width: 70%;
    height: calc(100vh - 50px);
    background: #fff;
    box-shadow: 2px 0 5px var(--shadow-color);
    transition: left 0.3s ease;
    z-index: 999;
}

.nav-menu.active {
    left: 0;
}

.nav-list {
    padding: 20px 0;
}

.nav-item {
    border-bottom: 1px solid var(--border-color);
}

.nav-item a {
    display: block;
    padding: 15px 20px;
    color: var(--text-color);
    font-size: 1.5rem;
    transition: background 0.3s ease;
}

.nav-item a:active {
    background: var(--bg-gray);
}

/* ========== 底部样式 ========== */
.footer {
    background: var(--primary-color);
    color: #fff;
    padding: 30px 0;
    margin-top: 50px;
}

.footer-content {
    text-align: center;
}

.footer-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.footer-nav a {
    color: #fff;
    margin: 5px 15px;
    font-size: 1.3rem;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.footer-nav a:hover {
    opacity: 1;
}

.copyright {
    font-size: 1.2rem;
    opacity: 0.7;
    margin-top: 15px;
}

/* ========== 按钮样式 ========== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1.4rem;
    border-radius: 5px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary:active {
    background: #1a252f;
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--secondary-color);
    color: #fff;
}

.btn-secondary:active {
    background: #2980b9;
    transform: scale(0.98);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:active {
    background: var(--primary-color);
    color: #fff;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ========== 卡片样式 ========== */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: transform 0.3s ease;
}

.card:active {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.card-header {
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--text-color);
}

.card-body {
    color: var(--text-light);
    font-size: 1.4rem;
    line-height: 1.6;
}

.card-footer {
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
}

/* ========== 表单样式 ========== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 1.4rem;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 10px;
    font-size: 1.4rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: #fff;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    border-color: var(--secondary-color);
    outline: none;
}

.form-control.error {
    border-color: var(--accent-color);
}

.error-msg {
    color: var(--accent-color);
    font-size: 1.2rem;
    margin-top: 5px;
}

/* ========== 列表样式 ========== */
.list-group {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.list-item {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    transition: background 0.3s ease;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:active {
    background: var(--bg-gray);
}

.list-item-icon {
    width: 40px;
    height: 40px;
    margin-right: 15px;
    flex-shrink: 0;
}

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 3px;
}

.list-item-desc {
    font-size: 1.3rem;
    color: var(--text-light);
}

/* ========== 标签样式 ========== */
.tag {
    display: inline-block;
    padding: 3px 8px;
    font-size: 1.2rem;
    border-radius: 3px;
    margin-right: 5px;
}

.tag-primary {
    background: var(--primary-color);
    color: #fff;
}

.tag-secondary {
    background: var(--secondary-color);
    color: #fff;
}

.tag-success {
    background: #27AE60;
    color: #fff;
}

.tag-warning {
    background: #F39C12;
    color: #fff;
}

.tag-danger {
    background: var(--accent-color);
    color: #fff;
}

/* ========== 加载动画 ========== */
.loading {
    text-align: center;
    padding: 20px;
}

.loading-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== Toast提示 ========== */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 1.4rem;
    z-index: 2000;
    display: none;
}

.toast.show {
    display: block;
    animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* ========== 遮罩层 ========== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    display: none;
}

.overlay.active {
    display: block;
}

/* ========== 工具类 ========== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--secondary-color); }
.text-accent { color: var(--accent-color); }
.text-muted { color: var(--text-light); }

.bg-primary { background: var(--primary-color); }
.bg-secondary { background: var(--secondary-color); }
.bg-accent { background: var(--accent-color); }
.bg-gray { background: var(--bg-gray); }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

.pt-10 { padding-top: 10px; }
.pt-20 { padding-top: 20px; }
.pt-30 { padding-top: 30px; }
.pb-10 { padding-bottom: 10px; }
.pb-20 { padding-bottom: 20px; }
.pb-30 { padding-bottom: 30px; }

.hidden { display: none !important; }
.show { display: block !important; }

/* ========== 响应式设计 ========== */
@media (min-width: 768px) {
    .container {
        padding: 0 20px;
    }
    
    .nav-menu {
        width: 300px;
    }
}

/* 适配iPhone X等刘海屏 */
@supports (padding: max(0px)) {
    .header {
        padding-top: constant(safe-area-inset-top);
        padding-top: env(safe-area-inset-top);
    }
    
    .footer {
        padding-bottom: constant(safe-area-inset-bottom);
        padding-bottom: env(safe-area-inset-bottom);
    }
}