/* Modern Enterprise Admin Theme - Apple Light Style (Unified) */
:root {
  /* Apple-inspired System Colors - More Vibrant but Professional */
  --primary-color: #007AFF;
  --secondary-color: #5856D6;
  --success-color: #34C759;
  --info-color: #5AC8FA;
  --warning-color: #FF9500;
  --danger-color: #FF3B30;
  
  /* Neutral Tones */
  --light-bg: #F5F5F7; /* Apple System Grey 6 */
  --white-bg: #FFFFFF;
  --text-primary: #1D1D1F;
  --text-secondary: #86868B;
  --border-color: rgba(0, 0, 0, 0.08);
  
  /* Layout Dimensions */
  --sidebar-width: 260px;
  --header-height: 60px;
  
  /* UI Metrics */
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --card-border-radius: 20px; /* More rounded like iOS 15+ */
  --btn-border-radius: 12px;
  --input-border-radius: 12px;
  --transition-speed: 0.25s;
  
  /* Shadows - Soft & Diffused */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.1);
}

body {
  font-family: var(--font-family);
  background-color: var(--light-bg);
  /* Subtle Grainy Texture or clean gradient */
  background-image: 
    radial-gradient(at 0% 0%, rgba(255, 255, 255, 0.8) 0%, transparent 50%), 
    radial-gradient(at 100% 100%, rgba(240, 248, 255, 0.5) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.2s;
}

a:hover {
    color: #0056b3;
}

/* --- Layout Structure --- */

#wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    transition: all var(--transition-speed);
}

/* Sidebar */
#sidebar-wrapper {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    min-height: 100vh;
    transition: all var(--transition-speed);
    
    /* Frosted Glass Sidebar */
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    
    z-index: 1030;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-heading {
    height: 80px; /* Taller header */
    display: flex;
    align-items: center;
    justify-content: center;
    /* No border for cleaner look */
    /* border-bottom: 1px solid var(--border-color); */
    margin-bottom: 10px;
}

/* Sidebar Navigation */
.list-group-item {
    background-color: transparent;
    border: none;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    margin: 4px 16px; /* Indented items */
    padding: 12px 16px;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
    display: flex;
    align-items: center;
}

.list-group-item i {
    width: 24px; /* Fixed width icons for alignment */
    text-align: center;
    margin-right: 12px !important; /* Override bootstrap me-3 */
    color: var(--text-secondary);
    transition: color 0.2s;
}

.list-group-item:hover {
    background-color: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
    transform: scale(1.01);
}

.list-group-item:hover i {
    color: var(--primary-color);
}

.list-group-item.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.list-group-item.active i {
    color: white !important;
}

/* Submenu items */
.collapse .list-group-item {
    font-size: 0.9rem;
    padding-left: 24px; /* More indent */
    margin-left: 24px;
    margin-right: 16px;
    background-color: transparent;
}

.collapse .list-group-item:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

/* Navbar */
.navbar {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1020;
    padding: 0 2rem;
}

#sidebarToggle {
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 8px;
    transition: background 0.2s;
}

#sidebarToggle:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-primary);
}

/* --- Content Components --- */

/* Page Content */
#page-content-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-container {
    padding: 2rem !important; /* More breathing room */
}

/* Cards (Unified Apple Style) */
.card {
    background: #ffffff;
    border: none; /* No borders */
    border-radius: var(--card-border-radius);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 1.5rem;
    overflow: hidden; /* For rounded corners on children */
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.05rem;
}

.card-body {
    padding: 1.5rem;
    color: var(--text-primary);
}

/* 统计卡片样式 */
.stat-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
    height: 100%;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
}

.stat-card .stat-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: all 0.4s ease;
    opacity: 0.9;
}

.stat-card:hover .stat-icon {
    transform: translateY(-50%) scale(1.1) rotate(5deg);
}

.stat-card.blue .stat-icon {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    color: #0ea5e9;
}

.stat-card.green .stat-icon {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #22c55e;
}

.stat-card.yellow .stat-icon {
    background: linear-gradient(135deg, #fef9c3 0%, #fde047 100%);
    color: #eab308;
}

.stat-card.red .stat-icon {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #ef4444;
}

.stat-card.purple .stat-icon {
    background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
    color: #a855f7;
}

.stat-card.orange .stat-icon {
    background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
    color: #f97316;
}

.stat-card.dark .stat-icon {
    background: linear-gradient(135deg, #f4f4f5 0%, #e4e4e7 100%);
    color: #3f3f46;
}

.stat-card .stat-content {
    position: relative;
    z-index: 2;
    padding-right: 70px;
}

.stat-card h3 {
    font-size: 36px;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(45deg, #1d1d1f, #434344);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
    margin-bottom: 4px;
}

.stat-card p {
    font-size: 15px;
    color: #86868b;
    margin: 0;
    font-weight: 500;
}

/* 进场动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card-wrapper {
    animation: fadeInUp 0.6s ease backwards;
}

.stat-card-wrapper:nth-child(1) { animation-delay: 0.1s; }
.stat-card-wrapper:nth-child(2) { animation-delay: 0.2s; }
.stat-card-wrapper:nth-child(3) { animation-delay: 0.3s; }
.stat-card-wrapper:nth-child(4) { animation-delay: 0.4s; }

/* Buttons */
.btn {
    padding: 0.6rem 1.25rem;
    border-radius: var(--btn-border-radius);
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
    border: none;
}

.btn-primary {
    background: var(--primary-color);
    box-shadow: 0 4px 10px rgba(0, 122, 255, 0.25);
}

.btn-primary:hover {
    background: #0066d6; /* Slightly darker */
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.35);
}

.btn-success {
    background: var(--success-color);
    box-shadow: 0 4px 10px rgba(52, 199, 89, 0.25);
}

.btn-outline-secondary {
    border: 1px solid #d1d1d6;
    color: var(--text-primary);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: #f2f2f7;
    border-color: #c7c7cc;
    color: var(--text-primary);
}

/* Forms */
.form-control {
    background: #F2F2F7; /* Light grey background input */
    border: 1px solid transparent;
    border-radius: var(--input-border-radius);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-control:focus {
    background: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
    color: var(--text-primary);
}

.form-select {
    background-color: #F2F2F7;
    border: 1px solid transparent;
    border-radius: var(--input-border-radius);
    padding: 0.75rem 1rem;
}

/* Tables */
.table {
    --bs-table-bg: transparent;
    border-collapse: separate;
    border-spacing: 0 8px; /* Spacing between rows */
    width: 100%;
    margin-bottom: 0;
}

.table thead th {
    background-color: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    padding: 1rem 1.5rem;
    border: none;
    letter-spacing: 0.05em;
}

.table tbody tr {
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: all 0.2s;
    border-radius: 12px; /* Row radius */
}

.table tbody td {
    padding: 1.25rem 1.5rem;
    color: var(--text-primary);
    vertical-align: middle;
    border: none;
    background-color: transparent; /* Inherit from tr */
}

/* Rounded corners for rows */
.table tbody tr td:first-child { border-top-left-radius: 16px; border-bottom-left-radius: 16px; }
.table tbody tr td:last-child { border-top-right-radius: 16px; border-bottom-right-radius: 16px; }

.table-hover tbody tr:hover {
    background-color: #fafafa !important;
    transform: scale(1.005);
    box-shadow: 0 8px 16px rgba(0,0,0,0.06);
    position: relative;
    z-index: 1;
}

/* Greeting Card - Enriched */
.greeting-card {
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    color: white;
    padding: 3rem;
    border-radius: 28px;
    box-shadow: 0 20px 40px rgba(0, 122, 255, 0.3);
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.greeting-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%);
    border-radius: 50%;
    filter: blur(40px);
}

.greeting-card::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(90, 200, 250, 0.3) 0%, transparent 60%);
    border-radius: 50%;
    filter: blur(30px);
}

.greeting-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    letter-spacing: -1px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.greeting-text {
    font-size: 1.1rem;
    opacity: 0.95;
    position: relative;
    z-index: 1;
    font-weight: 500;
}

/* Alerts / Flash Messages */
.alert {
    border: none;
    border-radius: 16px;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

.alert-success { border-left: 4px solid var(--success-color); }
.alert-danger { border-left: 4px solid var(--danger-color); }
.alert-warning { border-left: 4px solid var(--warning-color); }
.alert-info { border-left: 4px solid var(--info-color); }

/* Badges - Fix Badge Text Color & Size */
.badge {
    padding: 0.6em 1em;
    font-weight: 600;
    border-radius: 8px;
    letter-spacing: 0.02em;
    font-size: 0.85rem; /* Larger font */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.badge-success { background-color: rgba(52, 199, 89, 0.15); color: #1e7b34; }
.badge-warning { background-color: rgba(255, 149, 0, 0.15); color: #b36b00; }
.badge-danger { background-color: rgba(255, 59, 48, 0.15); color: #c4261d; }
.badge-info { background-color: rgba(90, 200, 250, 0.15); color: #006ee6; }
.badge-primary { background-color: rgba(0, 122, 255, 0.15); color: #006ee6; }
.badge-secondary { background-color: rgba(142, 142, 147, 0.15); color: #555558; }
.badge-light { background-color: #f2f2f7; color: #1d1d1f; border: 1px solid rgba(0,0,0,0.05); }

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0,0,0,0.25);
}

/* Typography Enhancements */
.table tbody td {
    font-size: 15px; /* Larger list font */
    padding: 1.35rem 1.5rem; /* More padding */
    vertical-align: middle;
}

.table thead th {
    font-size: 0.8rem; /* Slightly larger header */
    padding: 1.2rem 1.5rem;
}

/* Mobile Adjustments */
@media (max-width: 992px) {
    #sidebar-wrapper {
        margin-left: calc(-1 * var(--sidebar-width));
        position: fixed;
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    }
    
    #wrapper.toggled #sidebar-wrapper {
        margin-left: 0;
    }
    
    .content-container {
        padding: 1rem !important;
    }
}
