/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:'Poppins',sans-serif;
}

/* BASE FONT SIZE - CONSISTENT ACROSS SITE */
body{
    background:#f1f5f9;
    font-size:14px; /* Base size for everything */
    line-height:1.6;
}

/* Only headings get larger sizes */
h1{ font-size:28px; }
h2{ font-size:24px; }
h3{ font-size:20px; }
h4{ font-size:18px; }
h5{ font-size:16px; }
h6{ font-size:14px; }

/* ================================================
   MOBILE MENU TOGGLE
   ================================================ */
.mobile-menu-toggle{
    display:none; /* Visible only on mobile via media query */
    position:fixed;
    top:15px;
    left:15px;
    z-index:1001;
    background:#2563eb; /* Blue to match theme */
    color:white;
    border:none;
    padding:12px 14px;
    border-radius:8px;
    cursor:pointer;
    font-size:22px;
    font-weight:bold;
    box-shadow:0 4px 12px rgba(0,0,0,0.2);
    transition:all 0.3s ease;
    line-height:1;
}

.mobile-menu-toggle:hover{
    background:#1d4ed8;
    transform:scale(1.05);
}

.mobile-menu-toggle:active{
    transform:scale(0.95);
}

.sidebar-overlay{
    display:none;
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background:rgba(0,0,0,0.5);
    z-index:998;
    opacity:0;
    transition:opacity 0.3s ease;
}

.sidebar-overlay.active{
    display:block;
    opacity:1;
}

/* Sidebar */
.sidebar{
    position:fixed;
    width:240px;
    height:100vh;
    overflow-y:auto;
    overflow-x:hidden; /* Prevent horizontal scroll */
    background:#1e293b;
    color:#fff;
    padding:18px 0 16px;
    left:0; /* Always visible on desktop */
    transition:left 0.3s ease;
    z-index:999;
}

.sidebar-header{
    display:flex;
    align-items:center;
    gap:10px;
    padding:0 20px 18px;
    border-bottom:1px solid rgba(148,163,184,0.25);
    margin-bottom:14px;
}

.sidebar-logo{
    width:34px;
    height:34px;
    border-radius:999px;
    background:#0f172a;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:18px;
}

.sidebar-title{
    font-weight:600;
    font-size:16px;
}

.sidebar-subtitle{
    font-size:11px;
    color:#9ca3af;
}

.sidebar-section-label{
    font-size:11px;
    text-transform:uppercase;
    letter-spacing:0.12em;
    color:#64748b;
    padding:8px 20px 4px;
}

.sidebar a{
    display:block;
    color:#cbd5e1;
    padding:12px 20px;
    text-decoration:none;
    transition:0.3s;
    font-size:14px; /* Consistent with base */
}

.sidebar a:hover{
    background:#334155;
    color:white;
}

.sidebar a.active{
    background:linear-gradient(90deg,#0f172a,#1e293b);
    color:#ffffff;
    border-left:3px solid #3b82f6;
}

.sidebar-footer{
    margin-top:auto;
    padding-top:8px;
    border-top:1px solid rgba(148,163,184,0.25);
}

/* Topbar */
.topbar{
    margin-left:240px;
    height:64px;
    background:white;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 24px;
    box-shadow:0 4px 12px rgba(15,23,42,0.08);
}

.topbar-title{
    font-size:20px; /* Slightly larger for visibility */
    font-weight:600;
    color:#0f172a;
}

.topbar-meta{
    font-size:12px;
    color:#6b7280;
}

.topbar-right{
    display:flex;
    align-items:center;
    gap:16px;
}

.badge-pill{
    font-size:11px;
    padding:4px 10px;
    border-radius:999px;
    background:#eff6ff;
    color:#1d4ed8;
}

.avatar-circle{
    width:32px;
    height:32px;
    border-radius:999px;
    background:#1d4ed8;
    color:white;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:14px;
    font-weight:600;
}

.content{
    margin-left:240px;
    padding:25px;
}

.dashboard-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(320px,1fr));
    gap:22px;
    margin-top:28px;
}

.dashboard-panel{
    background:#ffffff;
    border-radius:16px;
    box-shadow:0 8px 20px rgba(15,23,42,0.08);
    padding:18px 18px 4px;
}

.dashboard-panel-header h3{
    font-size:16px; /* Consistent size */
    font-weight:600;
    color:#0f172a;
    margin-bottom:8px;
}

.compact-table{
    width:100%;
    border-collapse:collapse;
    font-size:14px; /* Match base size */
}

.compact-table th,
.compact-table td{
    padding:8px 10px;
}

.compact-table thead th{
    background:#f3f4f6;
}

/* Dashboard cards */
.cards{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
    gap:20px;
}

.card{
    background:white;
    padding:20px;
    border-radius:16px;
    box-shadow:0 10px 25px rgba(15,23,42,0.12);
    display:flex;
    align-items:center;
    gap:16px;
    border-top:4px solid #2563eb;
}

.card h3{
    color:#64748b;
    font-size:14px; /* Consistent with base */
    text-transform:uppercase;
    letter-spacing:0.08em;
}

.card p{
    font-size:26px;
    font-weight:600;
    margin-top:10px;
}

.card-icon{
    width:46px;
    height:46px;
    border-radius:999px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:22px;
    color:white;
    background:linear-gradient(135deg,#2563eb,#38bdf8);
}

.card-content{
    flex:1;
}

.card.blue{ border-top-color:#2563eb; }
.card.green{ border-top-color:#16a34a; }
.card.amber{ border-top-color:#f59e0b; }
.card.red{ border-top-color:#ef4444; }

/* Buttons */
.btn{
    padding:8px 14px;
    background:#2563eb;
    color:#ffffff;
    text-decoration:none;
    border-radius:6px;
    border:none;
    font-size:14px; /* Consistent with base */
    font-weight:500;
    cursor:pointer;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    box-shadow:0 2px 6px rgba(37,99,235,0.25);
    transition:background 0.2s, box-shadow 0.2s, transform 0.1s;
    white-space:nowrap;
}

.btn:hover{
    background:#1d4ed8;
    box-shadow:0 4px 10px rgba(37,99,235,0.35);
    transform:translateY(-1px);
}

/* Touch-friendly buttons for mobile - KEEP SAME SIZE */
@media (max-width: 768px){
    .btn{
        padding:10px 16px; /* Slightly larger padding for touch */
        font-size:14px; /* Keep same font size */
        min-height:44px; /* Touch-friendly height */
    }
}

.btn-primary,
.btn-info,
.btn-success,
.btn-danger{
    background:#2563eb;
}

.btn-primary:hover,
.btn-info:hover,
.btn-success:hover,
.btn-danger:hover{
    background:#1d4ed8;
}
/* ===== FORM DESIGN ===== */

form label{
    display:block;
    margin-top:12px;
    font-weight:500;
    color:#334155;
}

form input,
form select,
form textarea{
    width:100%;
    padding:10px;
    margin-top:5px;
    border:1px solid #cbd5e1;
    border-radius:8px;
    outline:none;
    transition:0.2s;
    font-size:14px; /* Consistent with base */
}

form input:focus,
form select:focus,
form textarea:focus{
    border-color:#2563eb;
    box-shadow:0 0 0 2px rgba(37,99,235,0.15);
}

/* Form card */
.form-card{
    background:white;
    padding:25px;
    border-radius:14px;
    width:500px;
    box-shadow:0 6px 18px rgba(0,0,0,0.08);
}

/* ===== TABLE DESIGN ===== */

table{
    width:100%;
    border-collapse:collapse;
    margin-top:20px;
    background:white;
    border-radius:12px;
    overflow:hidden;
    box-shadow:0 4px 12px rgba(0,0,0,0.06);
}

table th{
    background:#e2e8f0;
    padding:12px;
    text-align:left;
    font-size:14px; /* Consistent with base */
}

table td{
    padding:12px;
    border-top:1px solid #f1f5f9;
    font-size:14px; /* Consistent with base */
}

table tr:hover{
    background:#f8fafc;
}
/* ===== REAL CENTER FIX ===== */

.center-page{
    margin-left:240px; /* start after sidebar */
    min-height:calc(100vh - 60px);
    padding:40px 0;
    display:flex;
    justify-content:center;
}

.center-page .form-card{
    background:white;
    padding:30px;
    border-radius:14px;
    width:520px;
    max-width:90%;
    box-shadow:0 10px 28px rgba(0,0,0,0.08);
}
/* ============================= */
/* Sidebar Inventory Dropdown    */
/* ============================= */

/* Make Inventory look same as other links */
.menu-title{
    display:block;
    padding:12px 20px;
    color:#cbd5e1;
    cursor:pointer;
    transition:0.3s;
}

.menu-title:hover{
    background:#334155;
    color:#fff;
}

/* Submenu container */
.submenu{
    display:none;
}

/* Submenu links */
.submenu a{
    display:block;
    padding:10px 20px 10px 45px; /* left indent */
    font-size:14px; /* Consistent with base */
    /* color:#94a3b8; */
    background:#111827;
    text-decoration:none;
    transition:0.50s;
}

/* hover effect */
.submenu a:hover{
    background:#1f2937;
    color:#ffffff;
} 

/* action buttons inside tables */
.table-actions{
    display:flex;
    gap:8px;
    justify-content:center;
}

/* better table alignment */
table td{
    vertical-align:middle;
}

/* button colors */
.btn-primary{ background:#2563eb; }
.btn-info{ background:#0ea5e9; }

/* booking action buttons */
.table-actions{
    display:flex;
    gap:10px;
    justify-content:center;
}

.btn-success{
    background:#16a34a;
}

.btn-success:hover{
    background:#15803d;
}

.btn-danger{
    background:#ef4444;
}

.btn-danger:hover{
    background:#dc2626;
}

/* center supplier page */
.center-content{
    display:flex;
    flex-direction:column;
    align-items:center;
}

.center-content table{
    width:90%;
    max-width:1100px;
}

/* MODAL POPUP */
.modal{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background:rgba(0,0,0,0.45);
    display:none;
    justify-content:center;
    align-items:center;
    z-index:999;
}

.modal-box{
    background:white;
    padding:25px;
    width:420px;
    border-radius:14px;
    box-shadow:0 15px 40px rgba(0,0,0,0.25);
    animation:popup 0.25s ease;
}

@keyframes popup{
    from{transform:scale(0.85);opacity:0;}
    to{transform:scale(1);opacity:1;}
}

.modal-actions{
    margin-top:20px;
    display:flex;
    justify-content:flex-end;
    gap:10px;
}

/* buttons */
.btn-success{ background:#16a34a; }
.btn-danger{ background:#ef4444; }

/* ===== PERMISSION GRID ===== */
.permissions-grid{
    display:grid;
    grid-template-columns: repeat(auto-fit,minmax(320px,1fr));
    gap:22px;
}

/* ===== GROUP CARD ===== */
.group-card{
    background:#fff;
    border-radius:14px;
    padding:18px;
    box-shadow:0 4px 18px rgba(0,0,0,0.06);
}

.group-title{
    font-size:17px;
    font-weight:700;
    margin-bottom:14px;
    color:#111827;
}

/* Permission Row */
.perm-row{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:12px 0;
    border-top:1px solid #eef2f7;
    font-size:14px; /* Consistent with base */
    color:#374151;
}
.perm-row:first-child{
    border-top:none;
}

/* Toggle Switch */
.switch{
    position:relative;
    display:inline-block;
    width:46px;
    height:24px;
}

.switch input{
    opacity:0;
    width:0;
    height:0;
}

.slider{
    position:absolute;
    cursor:pointer;
    top:0;
    left:0;
    right:0;
    bottom:0;
    background:#d1d5db;
    transition:.3s;
    border-radius:30px;
}

.slider:before{
    position:absolute;
    content:"";
    height:18px;
    width:18px;
    left:3px;
    bottom:3px;
    background:white;
    transition:.3s;
    border-radius:50%;
}

input:checked + .slider{
    background:#3b82f6;
}

input:checked + .slider:before{
    transform:translateX(22px);
}

.primary-btn{
    background:#3b82f6;
    color:white;
    padding:12px 24px;
    border:none;
    border-radius:8px;
    font-weight:600;
    cursor:pointer;
}
.primary-btn:hover{
    background:#2563eb;
}
.form-card{
    background:#fff;
    padding:25px;
    width:700px;
    border-radius:10px;
    box-shadow:0 3px 12px rgba(0,0,0,0.08);
}

.form-card input,
.form-card select,
.form-card textarea{
    width:100%;
    padding:10px;
    margin-bottom:12px;
    border:1px solid #ddd;
    border-radius:6px;
}

.tests-box{
    border:1px solid #ddd;
    padding:15px;
    max-height:250px;
    overflow-y:auto;
    border-radius:8px;
    background:#fafafa;
}
.test-item{
    display:flex;
    justify-content:space-between;
    padding:8px;
    border-bottom:1px solid #eee;
}

.test-item:hover{
    background:#f1f5f9;
}

.price{
    color:#2563eb;
    font-weight:bold;
}

.bill-preview{
    background:#ecfdf5;
    padding:15px;
    border-radius:8px;
    margin-top:15px;
    font-size:18px;
    font-weight:bold;
    color:#065f46;
}

/* ===== LAB REPORT PAGE ===== */
.lab-report-card{
    background:#ffffff;
    border-radius:12px;
    box-shadow:0 6px 18px rgba(15,23,42,0.12);
    padding:18px;
}
.lab-report-header{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    border-bottom:2px solid #000;
    padding-bottom:8px;
    margin-bottom:10px;
}
.lab-report-table{
    width:100%;
    border-collapse:collapse;
    font-size:11px;
}
.lab-report-table th,
.lab-report-table td{
    border:1px solid #000;
    padding:3px 5px;
}
.lab-report-table th{
    background:#f3f4f6;
    font-weight:bold;
}
@media print{
    .sidebar,
    .topbar{
        display:none !important;
    }
    .content{
        margin:0;
        padding:10mm;
    }
}

/* ===== RESPONSIVE LAYOUT ===== */
@media (max-width: 768px){
    /* Mobile menu toggle visible */
    .mobile-menu-toggle{
        display:block !important; /* Force show on mobile */
    }
    
    /* Sidebar slides in from left - HIDDEN BY DEFAULT */
    .sidebar{
        position:fixed;
        width:280px;
        height:100vh;
        left:-285px; /* Completely hidden off-screen */
        top:0;
        z-index:999;
        transition:left 0.3s ease;
        box-shadow:4px 0 20px rgba(0,0,0,0.3);
    }
    
    .sidebar.active{
        left:0; /* Slide in when active */
    }
    
    /* Topbar adjustments - IMPROVED */
    .topbar{
        margin-left:0;
        height:auto;
        min-height:60px;
        padding:12px 16px 12px 60px; /* Space for toggle button */
        flex-wrap:wrap;
        gap:10px;
    }
    
    .topbar-title{
        font-size:18px; /* Slightly smaller on mobile but still prominent */
        width:100%;
    }
    
    .topbar-right{
        width:100%;
        justify-content:flex-start;
        gap:10px;
        flex-wrap:wrap;
    }
    
    /* Content area - FIXED LAYOUT */
    .content{
        margin-left:0;
        padding:16px;
        margin-top:10px;
    }
    
    .center-page{
        margin-left:0;
        padding:20px 10px;
    }
    
    .center-page .form-card{
        width:95%;
        padding:20px;
    }
    
    /* Cards stack vertically - KEEP CONSISTENT SIZES */
    .cards{
        grid-template-columns:1fr;
        gap:15px;
    }
    
    .card{
        padding:16px;
    }
    
    .card p{
        font-size:24px; /* Keep similar size on mobile */
    }
    
    /* Dashboard panels - KEEP CONSISTENT */
    .dashboard-grid{
        grid-template-columns:1fr;
        gap:15px;
    }
    
    .dashboard-panel{
        padding:15px;
    }
    
    /* Tables become scrollable - IMPROVED */
    table,
    .compact-table,
    .lab-report-table{
        display:block;
        width:100%;
        overflow-x:auto;
        -webkit-overflow-scrolling:touch;
    }
    
    table th,
    table td{
        white-space:nowrap;
        padding:10px;
        font-size:14px; /* Keep consistent size */
    }
    
    /* Form elements - PREVENT ZOOM ON iOS */
    form input,
    form select,
    form textarea{
        font-size:16px; /* Prevents zoom on iOS when tapping input */
        min-height:44px;
    }
    
    form label{
        font-size:14px; /* Keep same size */
        margin-top:10px;
    }
    
    /* Action buttons stack on mobile */
    .table-actions,
    .action-buttons{
        flex-direction:column;
        gap:6px;
    }
    
    .table-actions a,
    .action-buttons a{
        width:100%;
        text-align:center;
    }
    
    /* Modal adjustments */
    .modal-box{
        width:90%;
        max-width:400px;
        padding:20px;
    }
    
    /* Permissions grid */
    .permissions-grid{
        grid-template-columns:1fr;
    }
    
    /* Topbar right buttons */
    .topbar-right .btn{
        flex:1;
        min-width:120px;
    }
}

/* Extra small devices - KEEP CONSISTENT SIZES */
@media (max-width: 480px){
    .topbar{
        padding:10px 12px 10px 55px; /* Adjust for toggle button */
    }
    
    .mobile-menu-toggle{
        top:12px;
        left:12px;
        padding:10px 12px;
        font-size:20px;
    }
    
    .content{
        padding:12px;
    }
    
    .card{
        padding:14px;
    }
    
    .card-icon{
        width:40px;
        height:40px;
        font-size:18px;
    }
    
    .card p{
        font-size:22px; /* Keep large number visible */
    }
    
    .sidebar{
        width:100%;
        left:-100%; /* Hide completely on very small screens */
    }
}

/* Tablet landscape - KEEP CONSISTENT */
@media (min-width: 769px) and (max-width: 1024px){
    .cards{
        grid-template-columns:repeat(2, 1fr);
    }
    
    .dashboard-grid{
        grid-template-columns:repeat(2, 1fr);
    }
    
    .content{
        padding:20px;
    }
}

/* Print styles */
@media print{
    .sidebar,
    .topbar,
    .mobile-menu-toggle{
        display:none !important;
    }
    .content{
        margin:0;
        padding:10mm;
    }
    .card,
    .dashboard-panel{
        break-inside:avoid;
    }
}