@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette - Blue Theme */
    --primary: #2563eb;       /* Blue 600 */
    --primary-hover: #1d4ed8; /* Blue 700 */
    --primary-light: #eff6ff; /* Blue 50 */
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --border: #e2e8f0;
    
    /* Layout Backgrounds */
    --bg-body: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;
    
    /* Sidebar & Header */
    --sidebar-bg: #1e3a8a;    /* Blue 900 */
    --sidebar-text: #f8fafc;
    --sidebar-hover: #1e40af; /* Blue 800 */
    --sidebar-active: #3b82f6;/* Blue 500 */
    
    --header-bg: #1e3a8a;
    --header-text: #ffffff;
    
    /* Text */
    --text-main: #0f172a;
    --text-muted: #64748b;
    
    /* Metrics */
    --r-sm: 4px;
    --r-md: 8px;
    --r-lg: 12px;
    --sidebar-w-mini: 70px;
    --sidebar-w-full: 260px;
    --trans: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --primary: #3b82f6;       /* Blue 500 */
    --primary-hover: #60a5fa; /* Blue 400 */
    --primary-light: rgba(59, 130, 246, 0.15);
    --border: #334155;
    
    --bg-body: #0f172a;       /* Slate 900 */
    --bg-card: #1e293b;       /* Slate 800 */
    --bg-input: #0f172a;
    
    --sidebar-bg: #0b1120;
    --sidebar-text: #cbd5e1;
    --sidebar-hover: #1e293b;
    --sidebar-active: #3b82f6;
    
    --header-bg: #1e293b;
    --header-text: #e2e8f0;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    transition: background-color var(--trans), color var(--trans);
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }

/* === LAYOUT === */
.app-layout {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
}

/* Sidebar Hover Logic */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-w-mini);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 100;
    transition: width var(--trans);
    overflow-x: hidden;
    overflow-y: auto;
    box-shadow: 4px 0 10px rgba(0,0,0,0.05);
}

/* Scrollbar sidebar */
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

/* Expanded state on hover */
.sidebar:hover {
    width: var(--sidebar-w-full);
}

.sidebar-header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 1.25rem;
    font-weight: 700;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo-icon {
    font-size: 1.8rem;
    min-width: 30px;
    display: flex;
    justify-content: center;
}
.sidebar-logo-text {
    margin-left: 15px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.sidebar:hover .sidebar-logo-text { opacity: 1; transition-delay: 0.1s; }

.sidebar-user {
    padding: 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
}
.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.user-info {
    margin-left: 15px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.sidebar:hover .user-info { opacity: 1; transition-delay: 0.1s; }
.user-name { font-weight: 600; font-size: 0.9rem; }
.user-role { font-size: 0.75rem; text-transform: uppercase; background: rgba(255,255,255,0.2); padding: 2px 6px; border-radius: 4px; display: inline-block; margin-top:2px; }

.nav-menu { padding: 15px 0; }
.nav-group-title {
    padding: 5px 20px;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    margin-top: 15px;
    margin-bottom: 5px;
    white-space: nowrap;
}
.nav-group-title .nav-text { opacity: 0; transition: opacity 0.2s ease; }
.nav-group-title .nav-dots { display: block; opacity: 1; margin-left:5px;}
.sidebar:hover .nav-group-title .nav-text { opacity: 1; transition-delay: 0.1s; }
.sidebar:hover .nav-group-title .nav-dots { display: none; }

.nav-menu a {
    display: flex;
    align-items: center;
    padding: 12px 22px;
    color: var(--sidebar-text);
    transition: background var(--trans);
    white-space: nowrap;
}
.nav-menu a:hover { background: var(--sidebar-hover); }
.nav-menu a.active { background: var(--sidebar-active); color: #fff; font-weight: 500; }
.nav-menu a i { font-size: 1.4rem; min-width: 26px; display: flex; justify-content: center; }
.nav-menu a .nav-text { margin-left: 15px; opacity: 0; transition: opacity 0.2s ease; }
.sidebar:hover .nav-menu a .nav-text { opacity: 1; transition-delay: 0.1s; }

.sidebar-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: var(--sidebar-bg); /* ensure it overlays above menu items */
    z-index: 10;
}
.sidebar-footer a {
    display: flex;
    align-items: center;
    padding: 15px 22px;
    color: #fca5a5;
    white-space: nowrap;
}
.sidebar-footer a:hover { background: rgba(239, 68, 68, 0.2); }
.sidebar-footer a i { font-size: 1.4rem; min-width: 26px; display: flex; justify-content: center; }
.sidebar-footer a .nav-text { margin-left: 15px; opacity: 0; transition: opacity 0.2s ease; }
.sidebar:hover .sidebar-footer a .nav-text { opacity: 1; transition-delay: 0.1s; }

.sidebar-footer-password {
    color: var(--sidebar-text) !important;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-footer-password:hover {
    background: rgba(59, 130, 246, 0.2) !important;
    color: #93c5fd !important;
}
.sidebar-footer-password.active {
    background: var(--sidebar-active) !important;
    color: #fff !important;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-w-mini);
    width: calc(100% - var(--sidebar-w-mini));
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    min-width: 0;
}

/* Header - Hidden, replaced by FABs */
header.top-header {
    display: none;
}

/* Content Padding */
.content {
    padding: 30px;
    flex-grow: 1;
    overflow-x: hidden;
    min-width: 0;
}

/* === COMPONENTS === */
/* Box / Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
    margin-bottom: 24px;
    transition: box-shadow var(--trans), transform var(--trans), border-color var(--trans);
    overflow: hidden;
    max-width: 100%;
}
.card:hover { /* Hover on boxes will show blue reflection */
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.15), 0 4px 6px -4px rgba(37, 99, 235, 0.1);
    transform: translateY(-2px);
    border-color: var(--primary); 
}
.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-body { padding: 20px; }

/* Summary Cards / Dashboard Stats */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform var(--trans), box-shadow var(--trans), border-color var(--trans);
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.2); /* Blue shadow */
    border-color: var(--primary);
}
.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--r-md);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}
.stat-info .stat-value { font-size: 1.6rem; font-weight: 700; color: var(--text-main); }
.stat-info .stat-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--r-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--trans);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 6px -1px rgba(37,99,235,0.3); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(0.9); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.9); }

.btn-outline { background: transparent; border-color: var(--border); color: var(--text-main); }
.btn-outline:hover { background: var(--bg-input); border-color: var(--primary); color: var(--primary); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-xs { padding: 4px 8px; font-size: 0.75rem; border-radius: 4px; }
.btn-icon { padding: 8px; border-radius: 50%; color: var(--text-muted); background: transparent; border: none; font-size: 1.2rem; cursor: pointer; transition: all 0.2s; }
.btn-icon:hover { background: var(--bg-input); color: var(--primary); }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table { width: 100%; min-width: 500px; border-collapse: collapse; text-align: left; }
table th, table td { padding: 12px 20px; border-bottom: 1px solid var(--border); }
table th { background: var(--bg-input); font-weight: 600; color: var(--text-muted); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.5px; }
table tbody tr { transition: background var(--trans); }
table tbody tr:hover { background: var(--primary-light); }
.center { text-align: center; }
.bold { font-weight: 600; }
.small { font-size: 0.85rem; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.5px; }
.badge-admin { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid #ef4444; }
.badge-petugas { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid #f59e0b; }
.badge-user { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid #10b981; }

.badge-diajukan { background: rgba(59, 130, 246, 0.15); color: #3b82f6; border: 1px solid #3b82f6; }
.badge-dipinjam { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid #f59e0b; }
.badge-menunggu-kembali { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; border: 1px solid #8b5cf6; }
.badge-selesai { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid #10b981; }
.badge-ditolak { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid #ef4444; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 0.9rem; color: var(--text-main); }
.form-control { width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--r-md); font-family: inherit; font-size: 0.95rem; background: var(--bg-input); color: var(--text-main); transition: all var(--trans); }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); background: var(--bg-card); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 1rem center; background-size: 1em; }

/* Modals */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
    opacity: 0; visibility: hidden; transition: all 0.3s; backdrop-filter: blur(2px);
}
.modal-overlay.is-open { opacity: 1; visibility: visible; }
.modal-box {
    background: var(--bg-card); width: 100%; max-width: 500px; border-radius: var(--r-lg);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); transform: translateY(-20px); transition: all 0.3s;
}
.modal-overlay.is-open .modal-box { transform: translateY(0); }
.modal-header { padding: 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 1.2rem; font-weight: 600; display:flex; align-items:center; gap:8px;}
.modal-close { background: transparent; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; transition: color 0.2s; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; }
.modal-footer { padding: 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* Grid Cards (for Katalog) */
.grid-card {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    align-items: start;
}
.badge-stok { font-weight:700; display:inline-block; padding:3px 8px; border-radius:4px; font-size:0.75rem; }
.badge-stok.ok { background:rgba(16,185,129,.15); color:#10b981; }
.badge-stok.empty { background:rgba(239,68,68,.15); color:#ef4444; }

/* Alerts / Info box in Modals */
.alert { padding: 15px 20px; border-radius: var(--r-md); display: flex; align-items: center; gap: 10px; margin-bottom: 20px; font-weight: 500; font-size: 0.95rem;}
.alert-success { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.2); color: #10b981; }
.alert-danger { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.2); color: #ef4444; }
.info-box { background: var(--bg-input); border: 1px solid var(--border); padding: 15px; border-radius: var(--r-md); font-size: 0.9rem; margin-bottom: 20px; }

/* Typography */
h1, h2, h3, h4, h5 { color: var(--text-main); }
.truncate { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }

/* Dashboard Specific Layout */
.hero { background: var(--primary); color: #fff; padding: 30px; border-radius: var(--r-lg); margin-bottom: 30px; display: flex; flex-direction: column; gap: 15px; position: relative; overflow: hidden; }
.hero h2 { font-size: 1.8rem; font-weight: 700; z-index: 10; color: #fff;}
.hero p { opacity: 0.9; max-width: 500px; z-index: 10; color: #fff;}
.hero-search { margin-top: 10px; z-index: 10; max-width: 400px; position: relative;}
.hero-search .input-wrap { display: flex; align-items: center; background: rgba(255,255,255,0.2); border-radius: var(--r-md); padding: 0 15px;}
.hero-search i { color: #fff; font-size: 1.2rem; }
.hero-search input { background: transparent; border: none; color: #fff; padding: 12px 10px; width: 100%; font-size: 0.95rem;}
.hero-search input::placeholder { color: rgba(255,255,255,0.7); }
.hero-search input:focus { outline: none; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-icon.blue { background: rgba(37,99,235,0.15); color: #2563eb; }
.stat-icon.green { background: rgba(16,185,129,0.15); color: #10b981; }
.stat-icon.amber { background: rgba(245,158,11,0.15); color: #f59e0b; }
.stat-icon.purple { background: rgba(139,92,246,0.15); color: #8b5cf6; }
.stat-icon.indigo { background: rgba(99,102,241,0.15); color: #6366f1; }
.stat-icon.teal { background: rgba(20,184,166,0.15); color: #14b8a6; }
.stat-icon.red { background: rgba(239,68,68,0.15); color: #ef4444; }

.menu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 30px; }
.menu-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 25px; display: flex; flex-direction: column; gap: 15px; transition: all var(--trans); border-top: 4px solid var(--primary); text-decoration: none;}
.menu-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1); border-color: var(--primary); }
.mc-icon { width: 50px; height: 50px; border-radius: var(--r-md); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.mc-text h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: 5px; color: var(--text-main); }
.mc-text p { color: var(--text-muted); font-size: 0.9rem; margin: 0; }

.dashboard-tables { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.empty-state { text-align: center; color: var(--text-muted); }
.empty-state i { font-size: 2rem; margin-bottom: 10px; opacity: 0.5; }

/* ========== MOBILE MENU BUTTON ========== */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 250;
    width: 44px;
    height: 44px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 1.4rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.mobile-menu-btn:active {
    transform: scale(0.92);
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(3px);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ========== RESPONSIVE: TABLET (max-width: 1024px) ========== */
@media (max-width: 1024px) {
    .content { padding: 24px; }
    .dashboard-tables { grid-template-columns: 1fr; }
    .menu-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
    .hero h2 { font-size: 1.5rem; }
    .hero p { font-size: 0.9rem; }
    .stat-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
    .grid-stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

/* ========== RESPONSIVE: MOBILE (max-width: 768px) ========== */
@media (max-width: 768px) {
    /* Mobile menu button */
    .mobile-menu-btn {
        display: flex;
    }

    .mobile-overlay {
        display: block;
    }

    /* Sidebar: off-canvas drawer */
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w-full);
        z-index: 150;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    /* When sidebar is open on mobile, show all labels */
    .sidebar.mobile-open .sidebar-logo-text,
    .sidebar.mobile-open .user-info,
    .sidebar.mobile-open .nav-menu a .nav-text,
    .sidebar.mobile-open .sidebar-footer a .nav-text,
    .sidebar.mobile-open .nav-group-title .nav-text {
        opacity: 1 !important;
    }

    .sidebar.mobile-open .nav-group-title .nav-dots {
        display: none !important;
    }

    /* Main content: full width */
    .main-content {
        margin-left: 0;
        width: 100%;
        transition: none;
    }

    /* Content padding */
    .content {
        padding: 70px 16px 16px 16px; /* top padding for hamburger btn */
    }

    /* Cards */
    .card { margin-bottom: 16px; }
    .card:hover { transform: none; } /* no float on touch */
    .card-header { padding: 14px 16px; flex-direction: column; align-items: flex-start; gap: 10px; }
    .card-header h3 { font-size: 1rem; }
    .card-body { padding: 16px; }

    /* Grid layouts */
    .grid-card { grid-template-columns: 1fr; }
    .grid-stats { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .menu-grid { grid-template-columns: 1fr; gap: 12px; }
    .dashboard-tables { grid-template-columns: 1fr; gap: 16px; }

    /* Stat cards */
    .stat-card { padding: 14px; gap: 10px; }
    .stat-card:hover { transform: none; }
    .stat-icon { width: 40px; height: 40px; font-size: 1.3rem; }
    .stat-info .stat-value { font-size: 1.3rem; }
    .stat-info .stat-label { font-size: 0.75rem; }
    .stat-card .stat-value { font-size: 1.2rem; }
    .stat-card .stat-label { font-size: 0.7rem; }

    /* Menu cards */
    .menu-card { padding: 18px; flex-direction: row; align-items: center; }
    .menu-card:hover { transform: none; }
    .mc-icon { width: 42px; height: 42px; font-size: 1.3rem; flex-shrink: 0; }
    .mc-text h3 { font-size: 1rem; }
    .mc-text p { font-size: 0.8rem; }

    /* Hero */
    .hero { padding: 20px; border-radius: var(--r-md); }
    .hero h2 { font-size: 1.35rem; }
    .hero p { font-size: 0.85rem; }
    .hero-search { max-width: 100%; }

    /* Tables */
    table th, table td { padding: 10px 12px; font-size: 0.8rem; }
    .truncate { max-width: 120px; }

    /* Buttons */
    .btn { padding: 8px 14px; font-size: 0.82rem; }
    .btn-sm { padding: 6px 10px; font-size: 0.75rem; }

    /* Forms */
    .form-group { margin-bottom: 14px; }
    .form-control { padding: 10px 14px; font-size: 0.9rem; }

    /* Modals */
    .modal-box { max-width: 92vw; margin: 16px; border-radius: var(--r-md); }
    .modal-header { padding: 16px; }
    .modal-header h3 { font-size: 1.05rem; }
    .modal-body { padding: 16px; max-height: 60vh; }
    .modal-footer { padding: 16px; flex-wrap: wrap; }
    .modal-footer .btn { flex: 1; min-width: 100px; }

    /* FABs */
    .fab-container { bottom: 20px; right: 16px; gap: 10px; }
    .fab { width: 46px; height: 46px; font-size: 1.2rem; }
    .fab-cart { bottom: 78px; right: 16px; width: 46px; height: 46px; font-size: 1.2rem; }
    .fab-badge { width: 20px; height: 20px; font-size: 0.65rem; }

    /* Cart sidebar: full width on mobile */
    .cart-sidebar { width: 100%; max-width: 100vw; }
    .cart-sidebar-header { padding: 16px 18px; }
    .cart-sidebar-header h3 { font-size: 1.05rem; }
    .cart-sidebar-footer { padding: 16px 18px; }
    .cart-item { padding: 12px 18px; }

    /* Alerts */
    .alert { padding: 12px 16px; font-size: 0.85rem; }

    /* Typography */
    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1.05rem; }
}

/* ========== RESPONSIVE: SMALL PHONE (max-width: 480px) ========== */
@media (max-width: 480px) {
    .content { padding: 65px 12px 12px 12px; }

    .stat-grid { grid-template-columns: 1fr; gap: 10px; }

    .hero { padding: 16px; }
    .hero h2 { font-size: 1.15rem; }
    .hero p { font-size: 0.8rem; }

    .stat-card { padding: 12px; }
    .stat-icon { width: 36px; height: 36px; font-size: 1.1rem; }
    .stat-info .stat-value, .stat-card .stat-value { font-size: 1.1rem; }

    .menu-card { padding: 14px; }
    .mc-icon { width: 38px; height: 38px; font-size: 1.2rem; }

    table th, table td { padding: 8px 10px; font-size: 0.75rem; white-space: nowrap; }

    .modal-box { margin: 8px; }
    .modal-header { padding: 14px; }
    .modal-body { padding: 14px; }
    .modal-footer { padding: 14px; gap: 8px; }

    .cart-sidebar-header { padding: 14px 16px; }
    .cart-sidebar-footer { padding: 14px 16px; }
    .cart-sidebar-footer .form-group { margin-bottom: 12px; }
    .cart-item { padding: 10px 16px; }

    .fab-container { bottom: 16px; right: 12px; }
    .fab { width: 42px; height: 42px; font-size: 1.1rem; }
    .fab-cart { bottom: 68px; right: 12px; width: 42px; height: 42px; font-size: 1.1rem; }

    .badge { padding: 3px 8px; font-size: 0.65rem; }

    .login-card { padding: 24px 20px; }
}

/* ========== FLOATING ACTION BUTTONS (FAB) ========== */
.fab-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 200;
}

.fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 28px rgba(0,0,0,0.35);
}

.fab:active {
    transform: scale(0.95);
}

.fab-theme {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
}

.fab-theme:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
}

.fab-cart {
    position: fixed;
    bottom: 96px;
    right: 30px;
    z-index: 200;
    background: linear-gradient(135deg, var(--primary), #1d4ed8);
    color: #fff;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-cart:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 28px rgba(37, 99, 235, 0.5);
}

.fab-cart:active {
    transform: scale(0.95);
}

.fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(239,68,68,0.4);
    animation: fabBadgePop 0.3s ease;
}

@keyframes fabBadgePop {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ========== CART RIGHT SIDEBAR ========== */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
    z-index: 300;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cart-overlay.open {
    opacity: 1;
    visibility: visible;
}

.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
    z-index: 310;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-sidebar.open {
    transform: translateX(0);
}

.cart-sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
}

.cart-sidebar-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.cart-sidebar-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.cart-sidebar-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.cart-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.cart-sidebar-body ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cart-sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

/* ========== CART ITEMS ========== */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.cart-item:hover {
    background: var(--primary-light);
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-info strong {
    font-size: 0.9rem;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.cart-qty-input {
    width: 56px;
    height: 34px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--bg-input);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    transition: border-color 0.2s;
}

.cart-qty-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.cart-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 0.9rem;
}

.btn-icon.delete {
    color: var(--text-muted);
    padding: 6px;
    font-size: 1.1rem;
}

.btn-icon.delete:hover {
    color: var(--danger);
    background: rgba(239,68,68,0.1);
}

/* ========== QTY STEPPER (- / +) ========== */
.qty-stepper {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 3px;
    transition: border-color 0.25s, box-shadow 0.25s;
}

.qty-stepper:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.qty-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    opacity: 0;
    background: rgba(255,255,255,0.3);
    transition: opacity 0.2s;
}

.qty-btn:active:not(.disabled)::after {
    opacity: 1;
}

.qty-btn.minus {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.qty-btn.minus:hover:not(.disabled) {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.45);
    transform: scale(1.1);
}

.qty-btn.plus {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.qty-btn.plus:hover:not(.disabled) {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.45);
    transform: scale(1.1);
}

.qty-btn:active:not(.disabled) {
    transform: scale(0.9);
}

.qty-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
    filter: grayscale(0.5);
}

.qty-stepper .cart-qty-input {
    width: 34px;
    height: 28px;
    border: none;
    border-radius: 6px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
    background: transparent;
    color: var(--text-main);
    cursor: default;
    -moz-appearance: textfield;
    letter-spacing: 0.5px;
}

.qty-stepper .cart-qty-input::-webkit-outer-spin-button,
.qty-stepper .cart-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Dark theme adjustments for stepper */
[data-theme="dark"] .qty-stepper {
    background: rgba(30, 41, 59, 0.8);
}

[data-theme="dark"] .qty-btn.minus {
    background: linear-gradient(135deg, #f87171, #ef4444);
    box-shadow: 0 2px 8px rgba(248, 113, 113, 0.25);
}

[data-theme="dark"] .qty-btn.minus:hover:not(.disabled) {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 14px rgba(248, 113, 113, 0.4);
}

[data-theme="dark"] .qty-btn.plus {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.25);
}

[data-theme="dark"] .qty-btn.plus:hover:not(.disabled) {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 4px 14px rgba(96, 165, 250, 0.4);
}

.cart-item-max {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 400;
}

/* Shake animation when max is reached */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-3px); }
    40% { transform: translateX(3px); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
}

.shake {
    animation: shake 0.4s ease;
}
