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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fc;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    min-height: 100vh;
    background: #f8f9fc;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.sidebar .nav-link {
    color: #333;
    padding: 10px 15px;
    border-radius: 5px;
    margin: 2px 10px;
    transition: all 0.3s;
}

.sidebar .nav-link:hover {
    background: #e3e6f0;
    color: #4e73df;
}

.sidebar .nav-link.active {
    background: #4e73df;
    color: white;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

/* Cards */
.card {
    border-radius: 10px;
    border: none;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

.card-header {
    background: white;
    border-bottom: 1px solid #e3e6f0;
}

/* Border Left Colors */
.border-left-primary {
    border-left: 0.25rem solid #4e73df !important;
}
.border-left-success {
    border-left: 0.25rem solid #1cc88a !important;
}
.border-left-info {
    border-left: 0.25rem solid #36b9cc !important;
}
.border-left-warning {
    border-left: 0.25rem solid #f6c23e !important;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        min-height: auto;
        margin-bottom: 20px;
    }
    
    .sidebar .nav-link {
        padding: 8px 12px;
        margin: 2px 5px;
        font-size: 14px;
    }
    
    .container-fluid {
        padding: 0 15px;
    }
}

@media (max-width: 576px) {
    h1.h2 {
        font-size: 1.5rem;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .table-responsive {
        font-size: 12px;
    }
}

/* Utilities */
.text-xs {
    font-size: 0.7rem;
}
.font-weight-bold {
    font-weight: 700;
}

/* Table Styles */
.table th {
    background-color: #f8f9fc;
    border-top: none;
    font-weight: 600;
    font-size: 0.85rem;
}

.table td {
    vertical-align: middle;
    font-size: 0.85rem;
}

/* Forms */
.form-control:focus {
    border-color: #4e73df;
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

/* Buttons */
.btn {
    border-radius: 5px;
    padding: 0.375rem 0.75rem;
}

.btn-primary {
    background: #4e73df;
    border-color: #4e73df;
}

.btn-primary:hover {
    background: #2e59d9;
    border-color: #2653d4;
}

/* Alerts */
.alert {
    border-radius: 10px;
    border: none;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    .sidebar {
        display: none !important;
    }
    .navbar {
        display: none !important;
    }
    main {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    .container-fluid {
        padding: 0 !important;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Add these styles to your existing style.css file */

/* ============================================================
   LOGO & BRANDING STYLES
   ============================================================ */

.navbar-brand img {
    max-height: 35px;
    width: auto;
    transition: all 0.3s ease;
}

.navbar-brand:hover img {
    transform: scale(1.05);
}

/* Logo in sidebar */
.sidebar .sidebar-sticky .text-center img {
    max-height: 40px;
    width: auto;
    margin-bottom: 5px;
}

/* Footer logo */
.footer-logo {
    max-height: 30px;
    width: auto;
}

/* Responsive logo */
@media (max-width: 768px) {
    .navbar-brand img {
        max-height: 28px;
    }
    .sidebar .sidebar-sticky .text-center img {
        max-height: 30px;
    }
}

@media (max-width: 576px) {
    .navbar-brand img {
        max-height: 24px;
    }
}

/* Print logo */
@media print {
    .navbar-brand img {
        max-height: 25px !important;
    }
}

/* ============================================================
   FAVICON STYLES
   ============================================================ */

/* No specific styles needed for favicon, but ensure it's visible */

/* ============================================================
   NOTIFICATION BADGE STYLES
   ============================================================ */

.notification-badge {
    position: relative;
    display: inline-block;
}

.notification-badge .badge-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.65rem;
    min-width: 18px;
    text-align: center;
    font-weight: 700;
    border: 2px solid white;
}

/* Sidebar badge animations */
.badge-danger.float-right {
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Status badge styles */
.badge-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.7rem;
}

.badge-status-new { background: #dc3545; color: white; }
.badge-status-read { background: #ffc107; color: black; }
.badge-status-replied { background: #28a745; color: white; }
.badge-status-closed { background: #6c757d; color: white; }

/* ============================================================
   MAIN STYLES - WITH DARK THEME SUPPORT
   ============================================================ */

/* ============================================================
   ROOT VARIABLES
   ============================================================ */
:root {
    /* Light Theme (Default) */
    --bg-body: #f8f9fc;
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    --text-dark: #333333;
    --text-muted: #666666;
    --text-light: #858796;
    --border-light: #e3e6f0;
    --shadow-sm: rgba(0,0,0,0.05);
    --shadow-md: rgba(0,0,0,0.1);
    --shadow-lg: rgba(0,0,0,0.15);
    --primary: #4e73df;
    --primary-dark: #2e59d9;
    --success: #1cc88a;
    --info: #36b9cc;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --input-bg: #ffffff;
    --input-border: #d1d3e2;
    --card-bg: #ffffff;
    --card-shadow: rgba(0,0,0,0.05);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-body: #0f0f1a;
    --bg-white: #1a1a2e;
    --bg-light: #16213e;
    --text-dark: #e8e8e8;
    --text-muted: #b0b0b0;
    --text-light: #8a8a8a;
    --border-light: #2a2a4a;
    --shadow-sm: rgba(0,0,0,0.3);
    --shadow-md: rgba(0,0,0,0.4);
    --shadow-lg: rgba(0,0,0,0.5);
    --primary: #667eea;
    --primary-dark: #4a6acf;
    --success: #2ed49a;
    --info: #46c9dc;
    --warning: #f6c23e;
    --danger: #f05a4b;
    --input-bg: #1a1a2e;
    --input-border: #2a2a4a;
    --card-bg: #16213e;
    --card-shadow: rgba(0,0,0,0.3);
}

/* ============================================================
   BODY
   ============================================================ */
body {
    background-color: var(--bg-body);
    color: var(--text-dark);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar.bg-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

[data-theme="dark"] .navbar.bg-primary {
    background: #1a1a2e !important;
    border-bottom: 1px solid #2a2a4a;
}

/* ============================================================
   THEME-AWARE LOGO
   ============================================================ */
.theme-logo-light {
    display: block;
}

.theme-logo-dark {
    display: none;
}

[data-theme="dark"] .theme-logo-light {
    display: none;
}

[data-theme="dark"] .theme-logo-dark {
    display: block;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 10px var(--card-shadow);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.card-header {
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-dark);
}

.card-title {
    color: var(--text-dark);
}

.card-text {
    color: var(--text-muted);
}

/* ============================================================
   TABLES
   ============================================================ */
.table {
    color: var(--text-dark);
}

.table thead th {
    background: var(--bg-light);
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-light);
}

.table tbody tr {
    border-bottom: 1px solid var(--border-light);
}

.table tbody tr:hover {
    background: var(--bg-light);
}

.table td {
    color: var(--text-muted);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-dark);
}

.form-control:focus {
    background: var(--input-bg);
    border-color: var(--primary);
    color: var(--text-dark);
}

.form-control::placeholder {
    color: var(--text-light);
}

/* ============================================================
   ALERTS
   ============================================================ */
[data-theme="dark"] .alert-light {
    background: #1a1a2e;
    border-color: #2a2a4a;
    color: var(--text-dark);
}

[data-theme="dark"] .alert-info {
    background: #1a2a3a;
    border-color: #2a4a6a;
    color: #7ab7d4;
}

[data-theme="dark"] .alert-success {
    background: #1a3a2a;
    border-color: #2a6a4a;
    color: #7ad4a7;
}

[data-theme="dark"] .alert-warning {
    background: #3a2a1a;
    border-color: #6a4a2a;
    color: #d4b77a;
}

[data-theme="dark"] .alert-danger {
    background: #3a1a1a;
    border-color: #6a2a2a;
    color: #d47a7a;
}

/* ============================================================
   THEME TOGGLE BUTTON
   ============================================================ */
.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.theme-toggle-btn:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.theme-toggle-btn i {
    margin-right: 5px;
}

[data-theme="dark"] .theme-toggle-btn {
    border-color: #2a2a4a;
    color: var(--text-light);
}

[data-theme="dark"] .theme-toggle-btn:hover {
    background: #2a2a4a;
    color: var(--text-dark);
}

/* ============================================================
   LOGO STYLES
   ============================================================ */
.navbar-brand img {
    max-height: 35px;
    width: auto;
    transition: all 0.3s ease;
}

.navbar-brand:hover img {
    transform: scale(1.05);
}

.sidebar .sidebar-sticky .text-center img {
    max-height: 40px;
    width: auto;
    margin-bottom: 5px;
}

.footer-logo {
    max-height: 30px;
    width: auto;
}

/* ============================================================
   SIDEBAR (School)
   ============================================================ */
.sidebar {
    background: var(--bg-white) !important;
    border-right: 1px solid var(--border-light);
}

.sidebar .nav-link {
    color: var(--text-muted);
}

.sidebar .nav-link:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.sidebar .nav-link.active {
    background: var(--primary);
    color: white;
}

.sidebar .nav-link i {
    color: var(--text-light);
}

.sidebar .nav-link.active i {
    color: white;
}

/* ============================================================
   RESPONSIVE LOGO
   ============================================================ */
@media (max-width: 768px) {
    .navbar-brand img {
        max-height: 28px;
    }
    .sidebar .sidebar-sticky .text-center img {
        max-height: 30px;
    }
    .footer-logo {
        max-height: 24px;
    }
}

@media (max-width: 576px) {
    .navbar-brand img {
        max-height: 24px;
    }
    .sidebar .sidebar-sticky .text-center img {
        max-height: 24px;
    }
}

/* ============================================================
   PRINT LOGO
   ============================================================ */
@media print {
    .navbar-brand img {
        max-height: 25px !important;
    }
}