/* ============================================ */
/* 化学项目式教学管理系统 - 主样式表 */
/* ============================================ */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #e0e7ff;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --bg: #f1f5f9;
    --card: #fff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.08);
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== Login Page ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.15);
    text-align: center;
}
.login-card .logo-icon { font-size: 48px; margin-bottom: 12px; }
.login-card h1 { font-size: 24px; color: #4f46e5; margin-bottom: 6px; }
.login-card .subtitle { color: #64748b; font-size: 14px; margin-bottom: 28px; }
.login-card .form-group { text-align: left; margin-bottom: 18px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.login-card input { width: 100%; padding: 12px 16px; border: 2px solid #e2e8f0; border-radius: 10px; font-size: 15px; transition: all .2s; font-family: inherit; }
.login-card input:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.login-card .btn { width: 100%; padding: 13px; border: none; border-radius: 10px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all .2s; font-family: inherit; }
.login-card .btn-primary { background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; }
.login-card .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,.4); }
.login-card .btn-outline { background: #fff; color: #6366f1; border: 2px solid #6366f1; margin-top: 8px; }
.login-card .links { margin-top: 16px; font-size: 13px; color: #64748b; }
.login-card .links a { color: #6366f1; text-decoration: none; font-weight: 600; }

/* ===== Layout ===== */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, #1e1b4b, #312e81);
    color: #fff;
    padding: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 50;
}
.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-header .logo { font-size: 32px; }
.sidebar-header h2 { font-size: 16px; font-weight: 700; }
.sidebar-header .sub { font-size: 11px; opacity: .6; }
.sidebar-nav { padding: 12px 0; }
.sidebar-nav .nav-group { padding: 0 12px; margin-bottom: 8px; }
.sidebar-nav .nav-group-title { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; opacity: .4; padding: 8px 12px 4px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; margin: 2px 8px;
    border-radius: 8px;
    color: rgba(255,255,255,.7);
    text-decoration: none;
    font-size: 14px;
    transition: all .2s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-nav a.active { background: rgba(255,255,255,.15); color: #fff; font-weight: 600; }
.sidebar-nav a .icon { font-size: 18px; width: 24px; text-align: center; }
.sidebar-nav a .badge { margin-left: auto; background: #ef4444; color: #fff; padding: 1px 7px; border-radius: 10px; font-size: 11px; }

.main-content { margin-left: 250px; flex: 1; padding: 0; }
.topbar {
    background: #fff; padding: 14px 28px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
    position: sticky; top: 0; z-index: 40;
}
.topbar .page-title { font-size: 20px; font-weight: 700; }
.topbar .user-menu { display: flex; align-items: center; gap: 12px; }
.topbar .user-menu .avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 700;
}
.page-content { padding: 24px 28px; }

/* ===== Cards & Stats ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 16px;
}
.stat-card .stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}
.stat-card .stat-info .number { font-size: 28px; font-weight: 800; }
.stat-card .stat-info .label { font-size: 13px; color: var(--text-light); margin-top: 2px; }

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.card-header h3 { font-size: 17px; font-weight: 700; }

/* ===== Tables ===== */
.data-table {
    width: 100%; border-collapse: collapse; font-size: 14px;
}
.data-table th {
    background: #f8fafc; padding: 12px 16px; text-align: left;
    font-weight: 600; color: #475569; border-bottom: 2px solid var(--border);
    font-size: 13px; text-transform: uppercase; letter-spacing: .5px;
}
.data-table td {
    padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.data-table tr:hover td { background: #f8fafc; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border: none; border-radius: 8px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    text-decoration: none; transition: all .2s; font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ===== Badges ===== */
.badge {
    display: inline-block; padding: 3px 10px;
    border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-primary { background: #e0e7ff; color: #4f46e5; }
.badge-success { background: #d1fae5; color: #059669; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-warning { background: #fef3c7; color: #d97706; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
    border-radius: 8px; font-size: 14px; font-family: inherit; transition: all .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

/* ===== Modal ===== */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.5); z-index: 200;
    align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: #fff; border-radius: 16px; padding: 28px;
    width: 90%; max-width: 560px; max-height: 80vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal h3 { margin-bottom: 16px; font-size: 18px; }

/* ===== Project Cards ===== */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.project-card {
    background: #fff; border-radius: 12px; padding: 20px;
    box-shadow: var(--shadow); border-left: 4px solid var(--primary);
    cursor: pointer; transition: all .2s;
}
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.project-card .unit-badge { font-size: 11px; background: var(--primary-light); color: var(--primary); padding: 3px 10px; border-radius: 12px; font-weight: 600; }
.project-card h4 { font-size: 15px; margin: 10px 0 6px; }
.project-card .meta { font-size: 12px; color: var(--text-light); margin: 3px 0; }

/* ===== Pet System ===== */
.pet-showcase {
    text-align: center; padding: 30px;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-radius: 16px; margin-bottom: 20px;
}
.pet-sprite { font-size: 80px; margin-bottom: 10px; }
.pet-name { font-size: 22px; font-weight: 700; color: #4f46e5; }
.pet-stage { display: inline-block; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; padding: 3px 12px; border-radius: 12px; font-size: 12px; margin: 6px 0; }
.pet-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.pet-stat { text-align: center; }
.pet-stat .label { font-size: 11px; color: #64748b; }
.pet-stat .bar { height: 8px; background: #e2e8f0; border-radius: 4px; margin-top: 4px; overflow: hidden; }
.pet-stat .bar-fill { height: 100%; border-radius: 4px; transition: width .3s; }

.pet-shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}
.pet-shop-card {
    background: #fff; border-radius: 12px; padding: 16px;
    text-align: center; box-shadow: var(--shadow);
    border: 2px solid transparent; transition: all .2s;
}
.pet-shop-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.pet-shop-card.legendary { border-color: #f59e0b; background: linear-gradient(135deg, #fffbeb, #fef3c7); }
.pet-shop-card.epic { border-color: #8b5cf6; }
.pet-shop-card .emoji { font-size: 48px; margin: 8px 0; }
.pet-shop-card .rarity-badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; margin-bottom: 6px;
}
.rarity-common { background: #e2e8f0; color: #475569; }
.rarity-rare { background: #dbeafe; color: #2563eb; }
.rarity-epic { background: #ede9fe; color: #7c3aed; }
.rarity-legendary { background: #fef3c7; color: #d97706; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { width: 0; overflow: hidden; }
    .sidebar.open { width: 250px; }
    .main-content { margin-left: 0; }
    .page-content { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .project-grid { grid-template-columns: 1fr; }
}

/* ===== File upload area ===== */
.upload-area {
    border: 2px dashed #cbd5e1; border-radius: 12px;
    padding: 30px; text-align: center; cursor: pointer;
    transition: all .2s; margin: 10px 0;
}
.upload-area:hover { border-color: var(--primary); background: #f8fafc; }
.upload-area input[type=file] { display: none; }

/* ===== Alert ===== */
.alert {
    padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn { padding: 10px 20px; border: none; background: none; cursor: pointer; font-size: 14px; font-weight: 600; color: #64748b; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; font-family: inherit; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 40px; color: #94a3b8; }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }
