/* KhodiManage Premium CSS Design System */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #0c0c16;
    --bg-sidebar: #111122;
    --bg-card: rgba(25, 25, 45, 0.65);
    --border-glow: rgba(99, 102, 241, 0.15);
    --border-light: rgba(255, 255, 255, 0.08);
    --accent-primary: #6366f1;
    --accent-primary-hover: #4f46e5;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --glass-blur: blur(16px);
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Core Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform var(--transition-speed) ease;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-success));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 20px;
}

.sidebar-brand-name {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    list-style: none;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
}

.sidebar-link:hover, .sidebar-link.active {
    background-color: rgba(99, 102, 241, 0.15);
    color: #fff;
    border-left: 3px solid var(--accent-primary);
}

/* Sidebar Dropdown Menu */
.sidebar-dropdown {
    display: flex;
    flex-direction: column;
}
.sidebar-submenu {
    display: none;
    margin-top: 4px;
    flex-direction: column;
    gap: 4px;
}
.sidebar-submenu .sidebar-link {
    padding: 8px 12px 8px 24px;
    font-size: 13px;
    border-radius: 8px;
}
.dropdown-arrow {
    transition: transform var(--transition-speed) ease;
}
.sidebar-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 1px solid var(--border-light);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--accent-danger);
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition-speed);
    text-align: center;
    text-decoration: none;
}

.btn-logout:hover {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--accent-danger);
}

/* Main Content Area */
.main-wrapper {
    margin-left: 260px;
    flex-grow: 1;
    min-height: 100vh;
    padding: 32px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.page-title p {
    color: var(--text-muted);
    margin-top: 4px;
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* Glass Cards */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: transform var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.glass-card:hover {
    border-color: var(--border-glow);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Grid systems */
.grid-cols-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 24px;
}

.grid-cols-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.grid-cols-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.grid-cols-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-main-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .grid-cols-5, .grid-cols-4, .grid-cols-3, .grid-cols-2, .grid-main-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        transform: translateX(-100%);
    }
    .main-wrapper {
        margin-left: 0;
        padding: 16px;
    }
}

/* Dashboard Metrics Widget */
.metric-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.metric-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.metric-icon.primary {
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary);
}

.metric-icon.success {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.metric-icon.warning {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
}

.metric-icon.danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

.metric-data {
    display: flex;
    flex-direction: column;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
}

.metric-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* UI Elements */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
    text-decoration: none;
    border: none;
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-success), #059669);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}
.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-warning {
    background: linear-gradient(135deg, var(--accent-warning), #d97706);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-danger), #dc2626);
    color: #fff;
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-light);
}
.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Data Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    margin-top: 10px;
}

.table th {
    padding: 16px;
    border-bottom: 2px solid var(--border-light);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    vertical-align: middle;
}

.table tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

.badge-primary {
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    transition: all var(--transition-speed);
}

select option, select.form-control option {
    background-color: #111122 !important;
    color: #ffffff !important;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    background-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

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

/* QR Card Presentation */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.qr-card-glow {
    background: #fff;
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
    margin-bottom: 16px;
}

.qr-user-id {
    font-family: monospace;
    font-size: 16px;
    font-weight: bold;
    color: var(--accent-primary);
    margin-top: 8px;
}

/* Canteen POS checkout styles */
.pos-product-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: all var(--transition-speed);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pos-product-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.05);
}

.pos-checkout-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.pos-checkout-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

/* Reporting style */
.print-section {
    display: none;
}

@media print {
    body {
        background: #fff;
        color: #000;
    }
    .sidebar, .page-actions, .btn, .no-print {
        display: none !important;
    }
    .main-wrapper {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    .glass-card {
        border: none !important;
        box-shadow: none !important;
        background: none !important;
        backdrop-filter: none !important;
        padding: 0 !important;
    }
    .table th {
        border-bottom: 2px solid #000 !important;
        color: #000 !important;
    }
    .table td {
        border-bottom: 1px solid #ddd !important;
        color: #000 !important;
    }
    .print-section {
        display: block !important;
    }
}

/* Premium Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    padding: 40px 16px;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-content {
    background: rgba(17, 17, 34, 0.82);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 24px;
    width: 90%;
    max-width: 550px;
    padding: 30px;
    box-shadow: 
        0 24px 60px rgba(0, 0, 0, 0.65), 
        inset 0 1px 1px rgba(255, 255, 255, 0.12),
        0 0 40px rgba(99, 102, 241, 0.06);
    transform: scale(0.94) translateY(-15px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
    color: var(--text-main);
}
.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 12px;
}
.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}
.modal-close:hover {
    color: var(--accent-danger);
}

/* Bottom Navigation for Mobile */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: #0d0d1f; /* Matches dark theme */
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding: 0 8px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    flex: 1;
    height: 100%;
    border: none;
    background: none;
    cursor: pointer;
}

.bottom-nav-item i {
    font-size: 18px;
}

.bottom-nav-item.active {
    color: #6366f1; /* Accent primary */
}

.bottom-nav-item:active {
    transform: scale(0.92);
}

@media (max-width: 768px) {
    .sidebar {
        display: none !important;
    }
    .main-wrapper {
        margin-left: 0 !important;
        padding: 16px 16px 85px 16px !important; /* Bottom padding so bottom-nav doesn't overlay content */
    }
    .bottom-nav {
        display: flex;
    }
    #sidebar-toggle-btn {
        display: none !important; /* Hide floating toggle btn on mobile */
    }
    
    /* Make grids fully mobile friendly */
    .grid-cols-5, .grid-cols-4, .grid-cols-3, .grid-cols-2, .grid-main-layout {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .teacher-grid-menu {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 16px 8px !important;
    }
}
