/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* ===== Login Page ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: #fff;
    border-radius: 16px;
    padding: 48px 40px;
    width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    text-align: center;
}

.login-header h1 {
    font-size: 28px;
    color: #333;
    margin-bottom: 8px;
}

.login-header p {
    color: #888;
    margin-bottom: 32px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: 500;
    margin-top: 8px;
}

.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-error {
    background: #fee;
    color: #c00;
    border: 1px solid #fcc;
}

.alert-success {
    background: #efe;
    color: #080;
    border: 1px solid #cfc;
}

.login-footer {
    margin-top: 24px;
    font-size: 12px;
    color: #aaa;
}

/* ===== Main Layout ===== */
.main-page {
    min-height: 100vh;
}

.navbar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.nav-brand {
    font-size: 16px;
    font-weight: 600;
}

.nav-divider {
    margin: 0 8px;
    opacity: 0.5;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-user {
    font-size: 14px;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    color: #fff;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

.main-container {
    display: flex;
    min-height: calc(100vh - 56px);
}

/* ===== Sidebar ===== */
.sidebar {
    width: 220px;
    background: #fff;
    border-right: 1px solid #eee;
    padding: 16px 0;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: #f5f7fa;
    color: #667eea;
}

.menu-item.active {
    background: #f0f2ff;
    color: #667eea;
    border-left-color: #667eea;
    font-weight: 500;
}

.menu-icon {
    font-size: 18px;
}

/* ===== Content ===== */
.content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.content h2 {
    font-size: 22px;
    margin-bottom: 20px;
    color: #333;
}

/* ===== Welcome Banner ===== */
.welcome-banner {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    padding: 32px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.welcome-banner h2 {
    color: #fff;
    margin-bottom: 8px;
}

.welcome-banner p {
    opacity: 0.85;
}

/* ===== Dashboard Grid ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #eee;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-color: #667eea;
}

.card-icon {
    font-size: 36px;
}

.card-info h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.card-info p {
    font-size: 13px;
    color: #888;
}

/* ===== Stats Row ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 1px solid #eee;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #667eea;
}

.stat-label {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

/* ===== Data Table ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.data-table {
    width: 100%;
    background: #fff;
    border-radius: 12px;
    border-collapse: collapse;
    overflow: hidden;
    border: 1px solid #eee;
}

.data-table th {
    background: #f8f9fb;
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    color: #666;
    font-weight: 600;
    border-bottom: 1px solid #eee;
}

.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.data-table tr:hover td {
    background: #fafbff;
}

.data-table .btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    margin-right: 6px;
}

.btn-danger {
    background: #ff4d4f;
    color: #fff;
}

.btn-danger:hover {
    background: #e43b3f;
}

.loading {
    text-align: center;
    color: #aaa;
    padding: 24px !important;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 500px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 16px;
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
    background: none;
    border: none;
}

.modal-close:hover {
    color: #333;
}

.modal-content form {
    padding: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

/* ===== Activity List ===== */
.recent-section {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #eee;
}

.recent-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
}

.activity-list p {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

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

/* ===== Status Badges ===== */
.status-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: #e6f7e6;
    color: #2d8a2d;
}

.status-warning {
    background: #fff7e6;
    color: #d48806;
}

.status-inactive {
    background: #fff1f0;
    color: #cf1322;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .sidebar {
        width: 60px;
    }

    .menu-item span:not(.menu-icon) {
        display: none;
    }

    .menu-item {
        justify-content: center;
        padding: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}
