/* ====================================
   GLOBAL & HTML BASE STYLES
   ==================================== */
body, html {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f4f6f9;
    min-height: 100vh; /* Full viewport height */
}

/* ====================================
   LAYOUT STYLES
   ==================================== */


/* -------------------------------
   HEADER
--------------------------------- */
.header {
    height: 80px;
    background-color: #2c3e50;
    color: #fff;
    display: flex;
    justify-content: center; /* center content horizontally */
    align-items: center;     /* center content vertically */
    padding: 0 20px;
    box-sizing: border-box;
}

/* LEFT: logo + heading */
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Logo styling */
.header-logo-link {
    display: inline-block;
}

.header-logo {
    height: 60px;          /* smaller than header height */
    width: 60px;           /* make it square for perfect circle */
    border-radius: 50%;    /* makes logo round */
    border: 2px solid #ffffff; /* white border */
    object-fit: cover;     /* keep image aspect ratio */
    display: block;
}

/* Header text styling */
.header-title {
    font-size: 24px;
    margin: 0;
    color: #ffffff;
    font-weight: 600;
}

/* RIGHT: user info and logout button */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    position: absolute; /* keep on right */
    right: 20px;
}


.header-logout-btn {
    background-color: transparent;
    border: 2px solid #ffffff;
    color: #ffffff;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-logout-btn:hover {
    background-color: #ffffff;
    color: #2c3e50;
    border-color: #ffffff;
}


/* -------------------------------
   FOOTER
--------------------------------- */
.footer {
    height: 57px;
    padding-top: 1px;
    background-color: #2c3e50;
    color: #fff;
    text-align: center;
    line-height: 40px; /* Vertical alignment */
    width: 100%;
    box-sizing: border-box;
}

/* -------------------------------
   MAIN CONTAINER
--------------------------------- */
.main-container {
    display: flex;
    min-height: calc(100vh - 117px); /* 100vh - header - footer */
    margin-left: 250px;
}
.main-content {
    margin-left: 250px;       /* Same as sidebar width */
}

/* -------------------------------
   CONTENT AREA
--------------------------------- */
.content {
    flex: 1;
    padding: 20px;
    background-color: #ffffff;
}

/* ====================================
   SIDEBAR MENU
   ==================================== */
   .sidebar {
    position: fixed;          /* Make it fixed on the screen */
    top: 0;                   /* Start from the top of the viewport */
    left: 0;                  /* Stick to the left */
    width: 250px;
    height: 100vh;            /* Full viewport height */
    background-color: #2c3e50;
    color: #ecf0f1;
    font-family: Arial, sans-serif;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    overflow-y: auto;         /* Scroll if content overflows */
    z-index: 999;            /* Sit above header/footer */
    flex-shrink: 0;
}
.sidebar::-webkit-scrollbar {
    width: 8px;               /* Thin scrollbar */
}

.sidebar::-webkit-scrollbar-track {
    background: #2c3e50;      /* Match sidebar background */
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: #34495e; /* Darker gray */
    border-radius: 4px;         /* Rounded edges */
    border: 2px solid #2c3e50; /* Space around thumb, blends with track */
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background-color: #3a536b;  /* Slightly lighter on hover */
}

/* For Firefox */
.sidebar {
    scrollbar-width: thin;           /* Makes scrollbar thin */
    scrollbar-color: #34495e #2c3e50; /* thumb color / track color */
}

.menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-item {
    border-bottom: 1px solid #34495e;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item a {
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    color: #ecf0f1;
    transition: background-color 0.2s, color 0.2s;
}

.menu-item a:hover {
    background-color: #3498db;
    color: #ffffff;
}
/* Bold the active link */
.menu-item a.active {
    font-weight: bold;
    color: #ffffff;
}

/* Highlight parent menu background */
.menu-item.has-submenu.open.active-parent > a {
    background-color: #3498db;
    font-weight: normal; /* keep parent not bold */
}

/* Submenu toggle and arrow */
.submenu-toggle { cursor: pointer; font-weight: bold; }
.menu-item.open > .submenu-toggle { background-color: #2980b9; }
.sidebar a.active-link {
       /* change to your theme */
    color: #ffffff;
    background-color: #3498db;

}
.arrow {
    float: right;
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 1.2em;
    line-height: 1;
}

.has-submenu.open > a .arrow {
    transform: rotate(90deg);
}

/* Submenu collapse/expand */
.submenu {
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: #34495e;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

.menu-item.open > .submenu {
    display: block;
    max-height: 1000px;
    transition: max-height 0.3s ease-in-out;
}

/* Submenu levels */
.submenu .menu-item a { padding-left: 30px; font-weight: normal; background-color: #34495e; }
.submenu .menu-item a:hover { background-color: #3a536b; }

.submenu .child-menu { margin-left: 10px; }
.submenu .child-menu .menu-item a { padding-left: 45px; background-color: #3a536b; }
.submenu .child-menu .menu-item a:hover { background-color: #466079; }
/* Sidebar User Container */
.sidebar-user {
    display: flex;
    flex-direction: column; /* Stack icon and name vertically */
    align-items: center;    /* Center horizontally */
    justify-content: center; /* Center vertically if container height allows */
    padding: 20px;
    background-color: #2c3e50; /* Dark sidebar background */
    color: #ffffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* User Icon */
.sidebar-user .user-icon {
    font-size: 60px;        /* Bigger icon on top */
    color: #9ca3af;         /* Light gray icon */
    margin-bottom: 10px;    /* Space between icon and name */
}

/* Welcome Text */
.sidebar-user .welcome-text {
    font-size: 14px;
    color: #9ca3af; 
    margin-bottom: 2px;
}

/* User Name */
.sidebar-user .user-name {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    text-align: center;
}

/* Optional hover effect */
.sidebar-user:hover {
    background-color: #374151;
    cursor: pointer;
}

/* ====================================
   AUTHENTICATION FORM
   ==================================== */
.auth-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.auth-container {
    background: #fff;
    padding: 40px 30px;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    width: 400px;
    max-width: 90%;
    text-align: center;
}

.auth-container input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.auth-container button {
    width: 100%;
    padding: 12px;
    background-color: #2c3e50;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.auth-container button:hover {
    background-color: #1a252f;
}

/* Messages */
.msg-box {
    margin-top: 15px;
    padding: 12px;
    background-color: #f8d7da;
    color: #721c24;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
}

/* ====================================
   TABLE STYLING
   ==================================== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    vertical-align: middle !important;
    font-size: 0.85rem;
    padding: 6px 8px;
}

.table th:nth-child(1),
.table td:nth-child(1) { width: 50px; } /* SL */
.table th:nth-child(2),
.table td:nth-child(2) { width: 120px; } /* Company Id */
.table th:nth-child(4),
.table td:nth-child(4) { width: 140px; } /* Type Name */
.table th:nth-child(5),
.table td:nth-child(5) { width: 180px; } /* Email */
.table th:nth-child(6),
.table td:nth-child(6) { width: 120px; } /* Phone */
.table th:nth-child(7),
.table td:nth-child(7) { width: 180px; } /* Address */
.table th:nth-child(8),
.table td:nth-child(8) { width: 140px; } /* Domain */
.table th:nth-child(9),
.table td:nth-child(9) { width: 100px; } /* Logo */
.table th:nth-child(10),
.table td:nth-child(10) { width: 140px; } /* Action */

.table-responsive { overflow-x: auto; }

/* Table hover */
#companyDetailTableBody tr {
    transition: background-color 0.2s ease;
}
#companyDetailTableBody tr.selected-row {
    background-color: #d1e7ff !important;
    font-weight: bold;
}

/* ====================================
   MODAL STYLING
   ==================================== */
.modal-header.bg-primary {
    background-color: #3498db;
    color: white;
}

.modal-xl {
    max-width: 95%;
}

.modal-xl input, .modal-xl select {
    font-size: 0.85rem;
}

/* FORM ELEMENTS IN MODAL */
input, select {
    padding: 6px 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    border: 1px solid #ced4da;
}

/* ====================================
   BUTTON STYLING
   ==================================== */
.btn {
    font-size: 0.85rem;
}

.btn-primary { background-color: #3498db; border-color: #3498db; }
.btn-primary:hover { background-color: #2980b9; border-color: #2980b9; }

.btn-info { background-color: #17a2b8; border-color: #17a2b8; }
.btn-warning { background-color: #ffc107; border-color: #ffc107; }
.btn-danger { background-color: #dc3545; border-color: #dc3545; }

/* ====================================
   TEXT ALIGNMENT
   ==================================== */
.text-end { text-align: right !important; }
.text-center { text-align: center !important; }

/* ====================================
   RESPONSIVE FIXES
   ==================================== */
@media (max-width: 768px) {
    .table-responsive { font-size: 0.8rem; overflow-x: auto; }
    .btn { font-size: 0.8rem; }
    .content { margin-left: 0; padding: 10px; }
}

#edit_medicineListTableBody tr.selected-row td{
    background:#ffe08a !important;
    color:#000 !important;
    font-weight:800 !important;
    border-color:#e6b800 !important;
}



.main-container.no-sidebar .sidebar {
    display: none;
}
.main-container.no-sidebar .content {
    flex: 1;
}

/* Hover & selection for JS-driven table */
#medicineListTableBody tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#medicineListTableBody tr.selected-row {
    background-color: #d1e7ff !important;
    font-weight: bold;
}

/* Pagination Styling */
.pagination .page-item .page-link {
    border-radius: 0.25rem;
    margin: 0 2px;
}

.pagination .page-item.active .page-link {
    background-color: #3498db;
    border-color: #3498db;
    color: #fff;
}

/* ====================================
   MODAL STYLING
   ==================================== */
.modal-header.bg-primary {
    background-color: #3498db;
    color: white;
}

.modal-xl {
    max-width: 95%;
}

/* FORM ELEMENTS IN MODAL */
input, select {
    padding: 6px 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    border: 1px solid #ced4da;
}

/* BUTTON STYLING */
.btn-primary {
    background-color: #3498db;
    border-color: #3498db;
}

.btn-primary:hover {
    background-color: #2980b9;
    border-color: #2980b9;
}

.btn-info {
    background-color: #17a2b8;
    border-color: #17a2b8;
}

.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}

/* TEXT ALIGNMENT */
.text-end {
    text-align: right !important;
}

.text-center {
    text-align: center !important;
}

/* ====================================
   SELECTED ITEMS LIST (JS) STYLING
   ==================================== */
#selectedMedicineList tr td {
    vertical-align: middle;
}



.remove-item {
    font-size: 0.85rem;
    padding: 2px 6px;
}

/* SMALL RESPONSIVE FIX */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.85rem;
    }
    .btn {
        font-size: 0.85rem;
    }
}

#edit_selectedMedicineList {
    width: 100%;
}

/* Ensure inputs inside table take full width of their cell */
#edit_selectedMedicineList input {
    width: 100%;
    box-sizing: border-box; /* padding + border include kore width */
    padding: 2px 5px;
    font-size: 0.9rem;
}

/* Optional: table styling */
#edit_selectedMedicineList td, #edit_selectedMedicineList th {
    vertical-align: middle;
    text-align: center;
}

/* Make table horizontally scrollable if needed */
.table-responsive {
    overflow-x: auto;
}

/* Buttons */
.editRemoveBtn {
    padding: 2px 6px;
    font-size: 0.8rem;
}

/* -------------------------------
   HEADER
--------------------------------- */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 80px; /* push below header */
        height: calc(100vh - 80px); /* full height minus header */
        width: 250px;
        z-index: 9998; /* slightly below header */
    }

    .header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 9999; /* above sidebar */
    }

    /* Push main content to the right if needed */
    .main-content {
        margin-left: 250px; /* same as sidebar */
        margin-top: 80px;   /* account for fixed header */
    }
}

/* ====================================
   STOCK SUMMARY PAGE STYLING
   ==================================== */

/* Container for stock summary */
.stock-summary-container {
    padding: 20px;
    background-color: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* Search and per-page controls */
.stock-summary-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 15px;
    gap: 10px;
}

.stock-summary-controls input[type="text"] {
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #ced4da;
    font-size: 0.85rem;
}

.stock-summary-controls button {
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
    background-color: #3498db;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.stock-summary-controls button:hover {
    background-color: #2980b9;
}

/* Per page select */
.stock-summary-controls select {
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid #ced4da;
    font-size: 0.85rem;
}

/* Table Styling (overrides table class if needed) */
#stockTable {
    width: 100%;
    border-collapse: collapse;
}

#stockTable th, #stockTable td {
    padding: 6px 8px;
    font-size: 0.85rem;
    text-align: left;
    vertical-align: middle;
}

#stockTable th {
    background-color: #f1f3f6;
    font-weight: 600;
}

#stockTable tr:nth-child(even) {
    background-color: #f9f9f9;
}

#stockTable tr:hover {
    background-color: #eaf4ff;
    cursor: pointer;
}

/* SL Column */
#stockTable th:first-child,
#stockTable td:first-child {
    width: 40px;
    text-align: center;
}

/* Numeric Columns (qty, cp, mrp) center aligned */
#stockTable td:nth-child(7),
#stockTable td:nth-child(9),
#stockTable td:nth-child(10) {
    text-align: center;
}

/* Pagination */
#pagination {
    margin-top: 15px;
    text-align: right;
}

#pagination a, #pagination span {
    display: inline-block;
    margin: 0 2px;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    text-decoration: none;
    color: #2c3e50;
    transition: all 0.2s ease;
}

#pagination a:hover {
    background-color: #3498db;
    color: #fff;
}

#pagination span {
    font-weight: bold;
    background-color: #3498db;
    color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .stock-summary-controls {
        flex-direction: column;
        align-items: stretch;
    }

    #pagination {
        text-align: center;
    }

    #stockTable th, #stockTable td {
        font-size: 0.8rem;
        padding: 4px 6px;
    }
}

/* DCC */
/* =======================================
   General Container & Table Styles
   ======================================= */

   .container {
    max-width: 1200px;
}

h2.text-center {
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: 0.5px;
}

/* Table Styles */
#patientTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
}

#patientTable th,
#patientTable td {
    padding: 12px 15px;
    text-align: left;
}

#patientTable thead {
    background-color: #007bff;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.5px;
}

#patientTable tbody tr {
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

#patientTable tbody tr:hover {
    background-color: #f1f5fb;
}

/* Button Styles */
.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
    font-weight: 600;
    border-radius: 5px;
    transition: 0.3s;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.btn-success {
    background-color: #28a745;
    border-radius: 5px;
    font-weight: 600;
    transition: 0.3s;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-danger {
    background-color: #dc3545;
    border-radius: 5px;
    font-weight: 600;
    transition: 0.3s;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* =======================================
   Modal Styles
   ======================================= */

.modal-content {
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.modal-header .modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.modal-body h5 {
    font-weight: 600;
    color: #444;
    margin-bottom: 15px;
    border-bottom: 1px solid #eaeaea;
    padding-bottom: 5px;
}

/* Form Controls */
.form-control {
    border-radius: 6px;
    border: 1px solid #ced4da;
    padding: 10px 12px;
    font-size: 0.95rem;
    transition: 0.2s;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 4px rgba(0,123,255,0.3);
}

select.form-control {
    height: 42px;
}

/* Textarea */
textarea.form-control {
    resize: vertical;
    min-height: 38px;
}

/* Labels */
label {
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
    display: block;
}

/* Row spacing */
.row.g-2 {
    margin-bottom: 15px;
}

/* Hidden Doctor Info Smooth Slide */
#doctorInfo {
    transition: all 0.3s ease-in-out;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .modal-dialog {
        max-width: 95%;
    }
    #patientTable th, #patientTable td {
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    #patientTable thead {
        display: none;
    }
    #patientTable, #patientTable tbody, #patientTable tr, #patientTable td {
        display: block;
        width: 100%;
    }
    #patientTable tr {
        margin-bottom: 15px;
    }
    #patientTable td {
        text-align: right;
        padding-left: 50%;
        position: relative;
    }
    #patientTable td::before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        width: 50%;
        font-weight: 600;
        text-align: left;
        color: #555;
    }
}

/* Patient report */
/* ===== Layout ===== */
.report-wrapper { display: flex; gap: 30px; }
.form-left { width: 40%; }
.form-right { width: 60%; display: flex; justify-content: center; }

/* ===== Form Fields ===== */
.form-left input, .form-left select, .form-left textarea {
    margin-bottom: 10px;
    padding: 8px 12px;
    font-size: 15px;
    border-radius: 6px;
    border: 1px solid #ccc;
}
.form-left button {
    min-width: 120px;
    border-radius: 6px;
}

/* ===== Preview ===== */
#reportPreview {
    width: 794px;
    height: 1123px;
    background: #fff;
    padding: 40px;
    box-sizing: border-box;
    font-size: 16px;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
    box-shadow: 0 0 20px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
}
#previewHeaderFields {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}
.header-preview { flex: 1; font-weight: 600; font-size: 14px; color: #333; }

/* ===== Table ===== */
#previewTable { width: 100%; border-collapse: collapse; }
#previewTable th, #previewTable td { border: 1px solid #333; padding: 8px; }
#previewTable td { word-break: break-word; overflow-wrap: break-word; }

/* ===== Print ===== */
@media print {
    body * { visibility: hidden; }
    #reportPreview, #reportPreview * { visibility: visible; }
    #reportPreview { position: absolute; left: 0; top: 0; box-shadow: none; }
}