/*
 * WPS Account Management System - Modern Theme
 * Version: v1.0
 * Date: 2024-03-04
 */

/* ==================== CSS Variables ==================== */
:root {
    /* Primary Colors */
    --primary-color: #1A73E8;
    --primary-light: #4285F4;
    --primary-dark: #1557B0;
    --primary-gradient: linear-gradient(135deg, #1A73E8 0%, #1557B0 100%);
    
    /* Secondary Colors */
    --success-color: #34A853;
    --warning-color: #FBBC04;
    --danger-color: #EA4335;
    --info-color: #4285F4;
    
    /* Neutral Colors - Light Theme */
    --bg-primary: #F8F9FA;
    --bg-secondary: #FFFFFF;
    --bg-card: #FFFFFF;
    --text-primary: #202124;
    --text-secondary: #5F6368;
    --border-color: #DADCE0;
    --sidebar-bg: #FAFBFC;
    --sidebar-border: #E8EAED;
    --sidebar-hover: #E8F0FE;
    --table-hover: #F8F9FA;
    --input-bg: #FFFFFF;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

/* ==================== Dark Theme ==================== */
[data-theme="dark"] {
    /* Neutral Colors - Dark Theme */
    --bg-primary: #1A1A1A;
    --bg-secondary: #2D2D2D;
    --bg-card: #2D2D2D;
    --text-primary: #E8EAED;
    --text-secondary: #9AA0A6;
    --border-color: #3C4043;
    --sidebar-bg: #202124;
    --sidebar-border: #3C4043;
    --sidebar-hover: #2D3134;
    --table-hover: #3C4043;
    --input-bg: #2D2D2D;
    
    /* Shadows for dark theme */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.6);
}

/* Theme transition */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ==================== Global Styles ==================== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

html {
    scroll-behavior: smooth;
}

/* ==================== Card Styles ==================== */
.card, .settings-card {
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid var(--border-color) !important;
    transition: all 0.3s ease !important;
    background: var(--bg-card) !important;
    margin-bottom: var(--spacing-lg);
}

.card:hover, .settings-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    border-color: #D1D5DB !important;
}

.card-header {
    background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    padding: var(--spacing-lg) !important;
    border: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    font-weight: 600;
}

.card-body {
    padding: var(--spacing-lg) !important;
}

/* ==================== Button Styles ==================== */
.btn {
    border-radius: var(--radius-sm) !important;
    padding: 10px 20px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    border: none !important;
}

.btn-primary {
    background: var(--primary-color) !important;
    color: white !important;
}

.btn-primary:hover {
    background: var(--primary-dark) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 127, 255, 0.3) !important;
}

.btn-success {
    background: var(--success-color) !important;
}

.btn-warning {
    background: var(--warning-color) !important;
}

.btn-danger {
    background: var(--danger-color) !important;
}

.btn-info {
    background: var(--info-color) !important;
}

.btn-secondary {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

.btn-group .btn {
    margin-right: var(--spacing-sm);
}

/* ==================== Form Styles ==================== */
.form-control, .form-select {
    border-radius: var(--radius-sm) !important;
    border: 2px solid var(--border-color) !important;
    padding: 12px 16px !important;
    transition: all 0.3s ease !important;
    background: var(--input-bg) !important;
    color: var(--text-primary) !important;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(91, 127, 255, 0.1) !important;
    outline: none !important;
    background: var(--input-bg) !important;
}

.form-label {
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    margin-bottom: var(--spacing-sm) !important;
}

.form-text {
    color: var(--text-secondary) !important;
    font-size: 0.875rem !important;
}

.mb-3, .mb-4 {
    margin-bottom: var(--spacing-lg) !important;
}

/* ==================== Table Styles ==================== */
.table {
    border-radius: var(--radius-md) !important;
    overflow: hidden !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid var(--border-color) !important;
    background: var(--bg-card) !important;
}

.table thead {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
}

.table thead th {
    border: none !important;
    padding: var(--spacing-md) !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
}

.table tbody tr {
    transition: all 0.2s ease;
    background: var(--bg-card);
}

.table tbody tr:hover {
    background-color: var(--table-hover);
    transform: scale(1.005);
}

.table tbody td {
    padding: var(--spacing-md) !important;
    vertical-align: middle !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--bg-secondary);
}

/* ==================== Sidebar Styles ==================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100px;
    background: var(--sidebar-bg);
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.06);
    padding: 0;
    border-right: 1px solid var(--sidebar-border);
    z-index: 1000;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.sidebar .nav-link {
    color: var(--text-secondary) !important;
    border-radius: var(--radius-md) !important;
    padding: 1rem 0.5rem !important;
    margin: 0.35rem 0.6rem !important;
    transition: all 0.2s ease !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    gap: 0.4rem;
    line-height: 1.3;
    border: 1px solid var(--sidebar-border);
    background: var(--bg-card);
}

.sidebar .nav-link:hover {
    background: var(--sidebar-hover) !important;
    color: var(--primary-color) !important;
    border-color: var(--primary-light);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.sidebar .nav-link.active {
    background: var(--sidebar-hover) !important;
    color: var(--primary-color) !important;
    font-weight: 600;
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(26, 115, 232, 0.15);
}

.sidebar .nav-link.active i {
    color: var(--primary-color);
}

.sidebar-menu {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu i {
    margin-right: 0;
    font-size: 1.5rem;
    width: auto;
    text-align: center;
}

/* ==================== Alert Styles ==================== */
.alert {
    border-radius: var(--radius-md) !important;
    border: none !important;
    padding: var(--spacing-md) !important;
    box-shadow: var(--shadow-sm) !important;
}

.alert-success {
    background: #D1FAE5 !important;
    color: #065F46 !important;
    border-left: 4px solid var(--success-color) !important;
}

.alert-warning {
    background: #FEF3C7 !important;
    color: #92400E !important;
    border-left: 4px solid var(--warning-color) !important;
}

.alert-danger {
    background: #FEE2E2 !important;
    color: #991B1B !important;
    border-left: 4px solid var(--danger-color) !important;
}

.alert-info {
    background: #DBEAFE !important;
    color: #1E40AF !important;
    border-left: 4px solid var(--info-color) !important;
}

/* ==================== Modal Styles ==================== */
.modal-content {
    border-radius: var(--radius-lg) !important;
    border: none !important;
    box-shadow: var(--shadow-xl) !important;
}

.modal-header {
    background: #FFFFFF;
    color: var(--text-primary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    border-bottom: 1px solid var(--border-color) !important;
    font-weight: 600;
}

.modal-footer {
    border: none !important;
    padding: var(--spacing-lg) !important;
}

/* ==================== Badge Styles ==================== */
.badge {
    border-radius: var(--radius-sm) !important;
    padding: 6px 12px !important;
    font-weight: 600 !important;
}

.badge-primary {
    background: var(--primary-color) !important;
}

.badge-success {
    background: var(--success-color) !important;
}

.badge-warning {
    background: var(--warning-color) !important;
}

.badge-danger {
    background: var(--danger-color) !important;
}

/* ==================== Progress Bar Styles ==================== */
.progress {
    border-radius: var(--radius-lg) !important;
    height: 12px !important;
    background: var(--bg-secondary) !important;
}

.progress-bar {
    background: var(--primary-color) !important;
    border-radius: var(--radius-lg) !important;
}

/* ==================== Pagination Styles ==================== */
.pagination .page-link {
    border-radius: var(--radius-sm) !important;
    margin: 0 4px !important;
    border: none !important;
    color: var(--primary-color) !important;
}

.pagination .page-link:hover {
    background: var(--primary-color) !important;
    color: white !important;
}

.pagination .page-item.active .page-link {
    background: var(--primary-color) !important;
    color: white !important;
}

/* ==================== Animations ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    animation: spin 1s linear infinite;
}

/* ==================== Hover Effects ==================== */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* ==================== Responsive Design ==================== */
@media (max-width: 576px) {
    .card, .settings-card {
        border-radius: var(--radius-md) !important;
        margin-bottom: var(--spacing-md);
    }
    
    .btn {
        padding: 8px 16px !important;
        font-size: 0.875rem !important;
    }
    
    .table {
        font-size: 0.875rem;
    }
}

@media (min-width: 577px) and (max-width: 992px) {
    .sidebar {
        width: 200px;
    }
}

/* ==================== Custom Scrollbar ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ==================== Utility Classes ==================== */
.text-gradient {
    color: var(--primary-color);
}

.bg-gradient {
    background: var(--primary-color);
}

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-xl { box-shadow: var(--shadow-xl) !important; }

.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }

/* ==================== Theme Toggle Button ==================== */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 16px rgba(26, 115, 232, 0.4);
}

.theme-toggle:active {
    transform: scale(0.95);
}

[data-theme="dark"] .theme-toggle {
    background: #FFA500;
    box-shadow: 0 4px 12px rgba(255, 165, 0, 0.3);
}

[data-theme="dark"] .theme-toggle:hover {
    box-shadow: 0 6px 16px rgba(255, 165, 0, 0.4);
}

/* ==================== Print Styles ==================== */
@media print {
    .sidebar, .btn, .modal { display: none !important; }
    .card { box-shadow: none !important; }
}


/* ==================== Dashboard Specific Styles ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #D1D5DB;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-right: 1rem;
}

.stat-icon.primary { 
    background: #e0e7ff; 
    color: var(--primary-color); 
}

.stat-icon.success { 
    background: #d1fae5; 
    color: var(--success-color); 
}

.stat-icon.warning { 
    background: #fef3c7; 
    color: var(--warning-color); 
}

.stat-icon.danger { 
    background: #fee2e2; 
    color: var(--danger-color); 
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Quick Actions */
.quick-actions {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.quick-actions h5 {
    margin: 0 0 1.5rem;
    font-weight: 600;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.action-btn:hover {
    border-color: var(--primary-color);
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 127, 255, 0.15);
}

.action-btn i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.action-btn span {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Login Status - Top Right */
/* 侧边栏登录状态 */
.sidebar .login-status {
    position: static;
    margin-top: auto;
    margin-left: 0.6rem;
    margin-right: 0.6rem;
    margin-bottom: 0.6rem;
    padding: 0.75rem 0.5rem;
    background: linear-gradient(135deg, #FFFFFF 0%, #F8FFF9 100%);
    border-radius: 12px;
    font-size: 0.7rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    color: #137333;
    border: 1px solid #CEEAD6;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(52, 168, 83, 0.1);
    transition: all 0.3s ease;
    opacity: 1;
    pointer-events: auto;
    z-index: auto;
    text-align: center;
}

.sidebar .login-status:hover {
    background: linear-gradient(135deg, #F8FFF9 0%, #E8F5E9 100%);
    box-shadow: 0 4px 12px rgba(52, 168, 83, 0.15);
}

.sidebar .login-status i {
    color: #34A853;
    font-size: 1.1rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Sidebar Brand */
.sidebar-brand {
    padding: 1.5rem 0.75rem;
    border-bottom: 1px solid #E8EAED;
    margin-bottom: 0.5rem;
    text-align: center;
}

.sidebar-brand h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #202124;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.3;
}

.sidebar-brand h3 i {
    color: var(--primary-color);
    font-size: 2rem;
}

.sidebar-brand p {
    margin: 0.5rem 0 0;
    color: #5F6368;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.3;
}

/* Main Content */
.main-content {
    margin-left: 100px;
    padding: 2rem;
    min-height: 100vh;
    background: var(--bg-primary);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1002;
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    background: var(--primary-color);
    border: none;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(91, 127, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 5rem;
    }
    
    .mobile-menu-btn {
        display: block !important;
    }
    
    /* 移除登录状态的top/right定位，保持在侧边栏底部 */
    .sidebar .login-status {
        /* 保持原有样式，不覆盖 */
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .stat-value {
        font-size: 1.75rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .quick-actions {
        padding: 1rem;
    }
    
    .quick-actions h5 {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .actions-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .action-btn {
        padding: 1rem 0.5rem;
    }
    
    .action-btn i {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }
    
    .action-btn span {
        font-size: 0.75rem;
    }
}

@media (max-width: 375px) {
    /* 移除登录状态的top/right定位，保持在侧边栏底部 */
    .sidebar .login-status {
        /* 保持原有样式，不覆盖 */
    }
    
    .actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .action-btn span {
        font-size: 0.7rem;
    }
}
