/* === GLOBAL & LOGIN PAGE STYLES === */
:root {
    --primary-color: #20c997; /* Main Teal Color */
    /* New Pastel Color Palette */
    --sidebar-bg: #f8f9fa;      /* Light Gray Pastel */
    --sidebar-text: #495057;     /* Dark, readable text */
    --sidebar-hover-bg: #e9ecef;   /* Slightly darker hover */
    --sidebar-active-text: #000; /* Active link text */
    --content-bg: #f4f6f9;
}

body {
    overflow-x: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.login-body { /* Styles for login_doctor.php */
    background-color: var(--content-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}
.login-container { max-width: 400px; width: 100%; padding: 20px; }
.login-box { background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
.login-title { text-align: center; margin-bottom: 1.5rem; color: #212529; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: #555; }
.form-group input { width: 100%; padding: 0.75rem; border: 1px solid #ccc; border-radius: 4px; }
.btn-primary { background-color: var(--primary-color) !important; border-color: var(--primary-color) !important; width: 100%; padding: 0.75rem; font-size: 1rem; }
.message.error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; padding: 0.75rem 1.25rem; border-radius: 0.25rem; margin-bottom: 1rem; }


/* === DASHBOARD LAYOUT (FIXED) === */

#wrapper {
    display: flex;
    min-height: 100vh; /* This is the fix for the full-height sidebar */
}

.sidebar-wrapper {
    width: 250px;
    background: var(--sidebar-bg);
    border-right: 1px solid #dee2e6;
    transition: margin-left 0.3s ease;
}

#page-content-wrapper {
    flex-grow: 1;
    min-width: 0;
}

.sidebar-heading {
    padding: 1.5rem 1.25rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: #343a40; /* Darker text for light background */
    text-align: center;
    border-bottom: 1px solid #dee2e6;
}
.sidebar-heading i { color: var(--primary-color); }

.list-group-item {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 500;
}

.list-group-item i {
    margin-right: 0.75rem;
    width: 20px;
    color: #6c757d;
}

.list-group-item-action:hover, .list-group-item-action:focus {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-active-text);
}

.list-group-item.active {
    background: transparent;
    color: var(--sidebar-active-text);
    font-weight: bold;
    border-left: 4px solid var(--primary-color);
}
.list-group-item.active i {
    color: var(--primary-color);
}

.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#menu-toggle {
    display: block;
}

main.container-fluid {
    background-color: var(--content-bg);
    min-height: calc(100vh - 56px);
}

@media (max-width: 992px) {
    .sidebar-wrapper {
        position: fixed;
        height: 100%;
        left: -250px;
        z-index: 1050;
    }
    .sidebar-wrapper.active {
        left: 0;
    }
}

@media (min-width: 992px) {
    #menu-toggle {
        display: none;
    }
}


/* === DASHBOARD CONTENT (CARDS, ETC.) === */
.stat-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    color: #fff;
}
.stat-card-body h3 { font-size: 2rem; font-weight: 700; margin: 0; }
.stat-card-body p { margin: 0; opacity: 0.9; }
.stat-card-icon { font-size: 3rem; opacity: 0.5; }
.stat-card.card-blue { background: linear-gradient(45deg, #007bff, #3646a5); }
.stat-card.card-purple { background: linear-gradient(45deg, #6f42c1, #563d7c); }
.stat-card.card-green { background: linear-gradient(45deg, #20c997, #1a9c78); }
.stat-card.card-orange { background: linear-gradient(45deg, #fd7e14, #d9690e); }
/* === SCHEDULE PAGE STYLES (CARD-BASED PROFESSIONAL DESIGN) === */

.schedule-day-card {
    border: none;
    transition: box-shadow 0.3s ease;
}
.schedule-day-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.schedule-day-card .card-header {
    font-weight: 600;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.schedule-day-card .card-footer {
    background-color: rgba(0,0,0,0.02);
    border-top: 1px solid rgba(0,0,0,0.08);
}

.session-group .session-title {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #555;
}

.session-group .time-inputs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Pastel Color Palette for Day Cards */
.schedule-day-card.pastel-blue { background-color: #eaf6ff; }
.schedule-day-card.pastel-green { background-color: #eafdef; }
.schedule-day-card.pastel-purple { background-color: #f4eefe; }
.schedule-day-card.pastel-orange { background-color: #fff4ea; }
.schedule-day-card.pastel-teal { background-color: #e7f8f5; }
.schedule-day-card.pastel-pink { background-color: #fff0f3; }
.schedule-day-card.pastel-gray { background-color: #f8f9fa; }
/* === PATIENT SEARCH RESULTS STYLES === */

.patient-search-wrapper {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 .375rem .375rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1056; /* Higher than Bootstrap modal z-index */
    display: none;
}

.result-item, .result-item-none {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
}

.result-item:hover {
    background-color: #f8f9fa;
}

.result-item-none {
    color: #6c757d;
    cursor: default;
}
/* === DASHBOARD HOME PAGE STYLES === */

.stat-card .text-xs {
    font-size: .8rem;
    font-weight: 600;
}

.stat-card .font-weight-bold {
    font-weight: 700 !important;
}

.stat-card .h3 {
    font-size: 2rem;
}

.stat-card .icon-circle {
    height: 3rem;
    width: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card .icon-circle i {
    font-size: 1.2rem;
}

.border-start-primary {
    border-left: .25rem solid #5e72e4 !important;
}

.border-start-success {
    border-left: .25rem solid #2dce89 !important;
}

.border-start-info {
    border-left: .25rem solid #11cdef !important;
}

.border-start-warning {
    border-left: .25rem solid #fb6340 !important;
}

.border-start-danger {
    border-left: .25rem solid #f5365c !important;
}

.border-start-secondary {
    border-left: .25rem solid #8898aa !important;
}

.text-primary { color: #5e72e4 !important; }
.text-success { color: #2dce89 !important; }
.text-info { color: #11cdef !important; }
.text-warning { color: #fb6340 !important; }
.text-danger { color: #f5365c !important; }
.text-secondary { color: #8898aa !important; }

.bg-primary { background-color: #5e72e4 !important; }
.bg-success { background-color: #2dce89 !important; }
.bg-info { background-color: #11cdef !important; }
.bg-warning { background-color: #fb6340 !important; }
.bg-danger { background-color: #f5365c !important; }
.bg-secondary { background-color: #8898aa !important; }
/* === DASHBOARD HOME PAGE STYLES === */

.stat-card .text-xs {
    font-size: .8rem;
    font-weight: 600;
}

.stat-card .font-weight-bold {
    font-weight: 700 !important;
}

/* FIX: Set a dark text color for the numbers in the cards */
.stat-card .text-gray-800 {
    color: #343a40 !important;
}

.stat-card .h3 {
    font-size: 2rem;
}

.stat-card .icon-circle {
    height: 3rem;
    width: 3rem;
    border-radius: 50%;
    display: flex;
    align-items-center;
    justify-content: center;
}

.stat-card .icon-circle i {
    font-size: 1.2rem;
}

.border-start-primary {
    border-left: .25rem solid #5e72e4 !important;
}

.border-start-success {
    border-left: .25rem solid #2dce89 !important;
}

.border-start-info {
    border-left: .25rem solid #11cdef !important;
}

.border-start-warning {
    border-left: .25rem solid #fb6340 !important;
}

.border-start-danger {
    border-left: .25rem solid #f5365c !important;
}

.border-start-secondary {
    border-left: .25rem solid #8898aa !important;
}

.text-primary { color: #5e72e4 !important; }
.text-success { color: #2dce89 !important; }
.text-info { color: #11cdef !important; }
.text-warning { color: #fb6340 !important; }
.text-danger { color: #f5365c !important; }
.text-secondary { color: #8898aa !important; }

.bg-primary { background-color: #5e72e4 !important; }
.bg-success { background-color: #2dce89 !important; }
.bg-info { background-color: #11cdef !important; }
.bg-warning { background-color: #fb6340 !important; }
.bg-danger { background-color: #f5365c !important; }
.bg-secondary { background-color: #8898aa !important; }

/* === PRESCRIPTION MEDICINE SEARCH === */

.form-label-sm {
    font-size: 0.8rem;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 0.25rem;
    display: block;
}

.prescription-row .search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 .375rem .375rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1060; /* Higher than modal z-index */
    display: none;
}

.prescription-row .result-item, .prescription-row .result-item-none {
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.prescription-row .result-item:hover {
    background-color: #f8f9fa;
}

.prescription-row .result-item-none {
    color: #6c757d;
    cursor: default;
}

/* === RESPONSIVE SIDEBAR STYLES (iOS COMPATIBLE) === */

#wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

#sidebar-wrapper {
    width: 250px;
    background: #212529; /* Dark background for sidebar */
    color: #fff;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    flex-shrink: 0; /* Prevent sidebar from shrinking */
}

.sidebar-heading {
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-wrapper .list-group-item {
    border: none;
    background: #212529;
    color: #adb5bd;
}

.sidebar-wrapper .list-group-item:hover {
    background: #343a40;
    color: #fff;
}

.sidebar-wrapper .list-group-item.active {
    background: #0d6efd;
    color: #fff;
    font-weight: 600;
}

#page-content-wrapper {
    flex-grow: 1;
    width: calc(100% - 250px);
    min-width: 0;
    transition: width 0.3s ease;
}

/* Styles for smaller screens (tablets and phones) */
@media (max-width: 991.98px) {
    #sidebar-wrapper {
        margin-left: -250px; /* Hide sidebar by default off-screen */
        position: fixed; /* Make it an overlay on mobile */
        left: 0;
        top: 0;
        z-index: 1030; /* Ensure it's on top of content */
    }

    #sidebar-wrapper.active {
        margin-left: 0; /* Show sidebar by adding .active class */
    }

    #page-content-wrapper {
        width: 100%;
    }

    /* When sidebar is active on mobile, add a dark overlay to the content */
    body.sidebar-active #page-content-wrapper::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1020;
    }
}