/* =============================================================================
   PHYSICIANTRACK – PRODUCTION CSS
   Cleaned • Consolidated • Responsive • Sidebar–Aware
   ========================================================================== */

/* Root Variables ----------------------------------------------------------- */
:root {
    --accent-color: #28a745;
    --danger-background-color: #f8d7da;
    --danger-color: #721c24;
    --highlight-color: #ffc107;
    --info-icon-color: #004085;
    --info-icon-hover-color: #0056b3;
    --link_hover_color: #28a745;
    --neutral-color: #f8f9fa;
    --phone-hover-color: #004085;
    --placeholder-color: #6c757d;
    --primary-color: #004085;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --success-hover-color: #218838;
    --table-stripe-color: rgba(89,106,157,0.34);
    --text-color: #343a40;
    --th-color: white;
    --warning-hover-color: #e0a800;

    /* Sidebar width for all layouts */
    --sidebar-width: 150px;

    /* Top Navbar Height for all layouts */
    --navbar-height: 24.50px; /* measured */

    /* Messaging Colors -------------------------------------------------------- */
    --msg-outgoing-bg-start: #2563eb;
    --msg-outgoing-bg-end: #1d4ed8;
    --msg-incoming-bg: #f5f7fb;
    --msg-incoming-border: #e2e8f0;
    --msg-unread-accent: #f59e0b;
    --msg-avatar-bg: #2563eb;
    --msg-text-dark: #1f2937;
    --msg-meta-muted: #6b7280;
}

/* Document + Typography ---------------------------------------------------- */
html { font-size: 0.875rem; }
html, body {
    height: 100%;
    overflow-x: auto;
    overflow-y: auto;
}

body {
    font-family: 'Open Sans', Arial, sans-serif;
    background-color: var(--neutral-color);
    margin: 0;
    padding-top: var(--navbar-height); /* ✅ reserve navbar space */
}


h1, h2, h3, h4, h5, h6 { color: var(--primary-color); }
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; font-weight: bold; text-align: center; margin-top: 1rem !important; }


/* Alerts ------------------------------------------------------------------ */
.alert { padding: 25px; border-radius: 4px; margin-bottom: 20px; font-size: 16px; }
.alert-success { background: rgba(185,247,185,0.8); color: #4CAF50; border-left: 4px solid #4CAF50; }
.alert-warning { background: rgba(242,211,161,0.9); color: #FFC107; border-left: 4px solid #FFC107; }
.alert-error   { background: rgba(243,159,153,0.96); color: #F44336; border-left: 4px solid #F44336; }
.alert-info    { background: rgba(133,195,246,0.99); color: #2196F3; border-left: 4px solid #2196F3; }

/* Buttons ----------------------------------------------------------------- */
.btn {
    border-radius: 4px;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all .3s ease;
}
.btn-primary { background: var(--primary-color); color: white; border: none; }
.btn-primary:hover { background: var(--secondary-color); }
.btn-success { background: var(--success-color); color: white; }
.btn-success:hover { background: var(--success-hover-color); }
.btn-danger { background: var(--danger-color); color: white; }
.btn-outline-secondary {
    border: 1px solid #6c757d; color: #6c757d; background: none;
    padding: .75rem 1.5rem; border-radius: 8px;
}
.btn-outline-secondary:hover { background: #e9ecef; }

/* ==========================================================================
   QA BADGES (PhysicianTrack Standard)
   ========================================================================== */

.badge-soft-danger {
    background-color: #f5c2c7;   /* stronger soft red */
    color: #842029;
    border: 1px solid #d28a92;
    box-shadow: 0 1px 0 rgba(0,0,0,0.05);
    font-weight: 600;
}
.badge-soft-danger.small-pill {
    font-size: 0.75rem;
}

.badge-soft-warning {
    background-color: #fff3cd;
    color: #664d03;
    border: 1px solid #ffecb5;
}

.badge-soft-info {
    background-color: #cff4fc;
    color: #055160;
    border: 1px solid #b6effb;
}

.badge-soft-success {
    background-color: #b7d7c7;   /* stronger green */
    color: #0f5132;
    border: 1px solid #9ec5b3;
}
.badge-soft-danger,
.badge-soft-warning,
.badge-soft-success,
.badge-soft-info {
    border-radius: 0.5rem;
}
/* Pill sizing used across QA states */
.small-pill {
    font-size: 0.75rem;
    border-radius: 999px;
    padding: 6px 12px;
    font-weight: 600;
    line-height: 1;
}

/* Cards ------------------------------------------------------------------- */
.card {
    background: var(--neutral-color);
    border: 1px solid var(--secondary-color);
    padding: 1.5rem;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}

/* Tables ------------------------------------------------------------------ */
.table { width: 100%; border-collapse: collapse; }
.table thead th {
    background: var(--primary-color);
    color: var(--th-color) !important;
    text-align: center;
    padding: 10px;
    position: sticky;
    z-index: 10;
}
.table-striped tbody tr:nth-of-type(odd) { background: var(--table-stripe-color); }

/* Pagination --------------------------------------------------------------- */
.paginator-wrapper {
    display: flex; align-items: center; padding: .5rem 0;
    position: sticky; bottom: 0; background: white;
    border-top: 1px solid #ddd;
}

/* Forms ------------------------------------------------------------------- */
form {
    background: white;
    border-radius: 10px;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}
form label {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-color);
}
.custom-input,
.custom-textarea,
.form-control,
.form-select {
    border-radius: 8px;
    border: 2px solid var(--secondary-color);
    padding: 12px;
}

/* ==========================================================================
   AUTOCOMPLETE DROPDOWN (Global — Medical School / Residency / Fellowship)
   ========================================================================== */

.dropdown-menu .active {
    background-color: var(--primary-color);
    color: #fff;
}

.dropdown-menu .active:hover {
    background-color: var(--primary-color);
    color: #fff;
}

/* Optional: smoother hover for non-active items */
.dropdown-menu .dropdown-item:hover {
    background-color: rgba(0, 64, 133, 0.08);
}


/* ==========================================================================
   GLOBAL TOGGLE SWITCH STYLE (PhysicianTrack Standard)
   ========================================================================== */

.form-switch .form-check-input {
    width: 3rem;
    height: 1.5rem;
    border-radius: 2rem;
    border: 2px solid var(--primary-color);
    background-color: #fff;
    transition: all 0.2s ease;
}

.form-switch .form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-switch .form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 64, 133, 0.25);
}

.form-switch .form-check-label {
    font-weight: 600;
    color: var(--primary-color);
}


/* Sidebar + Main Content Layout ------------------------------------------- */

/* Sidebar (desktop default) */
#sidebar-wrapper {
    position: fixed;
    top: var(--navbar-height);          /* ✅ start below navbar */
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    background: var(--neutral-color);
    z-index: 1000;
    transition: transform .3s ease;
}


/* Section headings */
#sidebar-wrapper .sidebar-heading {
    margin-top: 1rem;
    margin-bottom: 0.25rem;
}

/* Sidebar company heading */
#sidebar-wrapper .sidebar-heading.company-name {
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 700;
    padding: 1rem 1rem 0.5rem 1rem;
}

#sidebar-wrapper .list-group-item.sub-item {
    padding-left: 1.5rem;     /* nice indent */
    font-size: 0.95rem;       /* slightly smaller */
}

/* Main content always leaves space for sidebar on desktop */
#main-content {
    position: relative;
    margin-left: var(--sidebar-width);
    padding-top: 0; /* ✅ body handles it */
    /*height: calc(100vh - var(--navbar-height));*/
    min-height: 0;      /* allow flex to control height */
    overflow: visible;
}


/* Offcanvas (mobile) behavior */
#sidebar-wrapper.show { transform: translateX(0); }
#main-content.shifted { margin-left: var(--sidebar-width); }

/* Sidebar toggler (hamburger) for small screens */
.sidebar-toggler {
    display: none;
    position: fixed;
    top: 56px; left: 10px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    padding: 1rem;
    z-index: 1100;
}

/* =========================================================
   Split Layout System (Reusable Across App)
   ========================================================= */

.split-wrapper {
    display: flex;
    width: 100%;
    min-height: 70vh;
    overflow: hidden;
}

.split-left {
    width: 380px;
    max-width: 100%;
    min-width: 250px;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    position: relative;
}

.split-main {
    flex-grow: 1;
    background: #ffffff;
    min-width: 0;
    position: relative;
    overflow: hidden;
}

/* Resizer bar */
.split-resizer {
    width: 8px;
    cursor: col-resize;
    background: transparent;
    position: relative;
}

.split-resizer:hover {
    background: rgba(0,0,0,0.08);
}

/* Optional subtle divider line */
.split-resizer::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 2px;
    width: 1px;
    background: #dee2e6;
}

/* =========================================================
   Chat / Messaging Layout
   ========================================================= */

.thread-messages {
    min-height: 0;   /* Required for flexbox scroll containers */
    width: 100%;
    max-width: 100%;
}


/* Autogrow textareas should never become massive */
textarea[data-autogrow] {
    max-height: 160px;
    overflow-y: auto;
}

/* Thread reply specific tweaks */
.thread-reply textarea {
    max-height: 160px;
}

/* Mobile — disable splitter */
@media (max-width: 768px) {
    .split-resizer {
        display: none;
    }

    .split-left {
        width: 100% !important;
        min-width: 100%;
    }
}

/* =========================================================
   Thread Message Component (Unified)
   ========================================================= */

/* Prevent polling flicker */
#thread-messages-container {
    contain: layout paint;
    backface-visibility: hidden;
    transform: translateZ(0);
    will-change: transform, opacity;
}

.thread-message {
    position: relative;
    border-radius: 14px;
    padding: 14px 16px;
    line-height: 1.45;
    font-size: 0.95rem;
    transition: all 0.15s ease;
    max-width: 70%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    animation: messageAppear 0.18s ease;
}

/* Hover polish */
.thread-message:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}

/* =========================================================
   Outgoing (You)
   ========================================================= */

.thread-message.outgoing {
    background: linear-gradient(
        135deg,
        var(--msg-outgoing-bg-start),
        var(--msg-outgoing-bg-end)
    );
    color: white;
    border: none;
    box-shadow: 0 4px 10px rgba(37,99,235,0.25);
    max-width: 62%;
}

/* =========================================================
   Incoming
   ========================================================= */

.thread-message.incoming {
    background: var(--msg-incoming-bg);
    border: 1px solid var(--msg-incoming-border);
    color: var(--msg-text-dark);
    box-shadow: 0 2px 5px rgba(0,0,0,0.06);
}

/* =========================================================
   Unread Accent
   ========================================================= */

.thread-message.unread {
    border-left: 4px solid var(--msg-unread-accent);
}

/* =========================================================
   Bubble Tails
   ========================================================= */

.thread-message.incoming::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 16px;
    width: 12px;
    height: 12px;
    background: var(--msg-incoming-bg);
    border-left: 3px solid var(--msg-unread-accent);
    border-bottom: 3px solid var(--msg-unread-accent);
    transform: rotate(45deg);
}

.thread-message.outgoing::after {
    content: "";
    position: absolute;
    right: -7px;
    top: 16px;
    width: 12px;
    height: 12px;
    background: var(--msg-outgoing-bg-end);
    transform: rotate(45deg);
}

/* =========================================================
   Avatar
   ========================================================= */

.thread-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--msg-avatar-bg);
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* =========================================================
   Metadata
   ========================================================= */

.thread-message strong {
    font-weight: 600;
    letter-spacing: 0.2px;
}

.thread-message small {
    font-size: 0.75rem;
    color: var(--msg-meta-muted);
}

.thread-message.outgoing small {
    color: rgba(255,255,255,0.85);
}

/* =========================================================
   Channel Badges
   ========================================================= */

.thread-message .badge {
    font-size: 0.65rem;
    padding: 4px 6px;
    border-radius: 6px;
    font-weight: 600;
}

/* =========================================================
   Animation
   ========================================================= */

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .thread-message {
        max-width: 85%;
    }
}

/* =========================================================
   Messaging Sidebar + Thread List Polish
   ========================================================= */

/* Left thread list background separation */
.thread-sidebar,
.split-left.thread-sidebar {
    background: #f4f6f9;              /* slightly cooler gray */
    border-right: 1px solid #e2e8f0;
}

/* Individual thread rows */
.thread-item {
    padding: 12px 14px;
    border-bottom: 1px solid #eef2f6;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

/* Hover state */
.thread-item:hover {
    background: #eef3f8;
}

/* Active / selected thread */
.thread-item.active {
    background: #e7f1ff;
    border-left: 4px solid var(--primary-color);
    padding-left: 10px; /* compensate for border */
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.02);
}

/* Optional unread emphasis */
.thread-item.unread {
    font-weight: 600;
}

/* Thread meta text */
.thread-item small {
    color: #6b7280;
}

/* Prevent ugly selection highlight when clicking */
.thread-item:focus,
.thread-item:active {
    outline: none;
}

/* ==========================================
   Thread List — Stable Styling
   ========================================== */

.split-left.thread-list {
    background: #f4f6f9;
    border-right: 1px solid #e2e8f0;
}

/* Thread row */
.thread-item {
    display: block;
    padding: 12px 14px;
    border-bottom: 1px solid #eef2f6;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease;
}

/* Hover */
.thread-item:hover {
    background: #eef3f8;
}

/* Active */
.thread-item.active {
    background: #e7f1ff !important;
    border-left: 4px solid var(--primary-color);
    padding-left: 10px;
}

/* Prevent hover overriding active */
.thread-item.active:hover {
    background: #e7f1ff !important;
}

.thread-item.unread {
    font-weight: 600;
    background: #f9fbff;
}

/* Responsive Breakpoints -------------------------------------------------- */

/* Desktop ≥ 992px: sidebar stays fixed, main content shifted by sidebar-width */
@media (min-width: 992px) {
    #main-content { margin-left: var(--sidebar-width); }
    /* Fix sidebar offcanvas so it always displays on desktop */
    #companySidebar.offcanvas {
        transform: none !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
    }

}

/* Tablet 768–991px: 
   Only hide sidebar if the page has the `.sidebar-toggler` element.
   Employer dashboard has no toggler → keep sidebar visible.
*/
@media (max-width: 991px) {

    /* Mobile/Tablet toggler appears when present */
    .sidebar-toggler { display: block; }

    /* Default: sidebar stays visible */
    #sidebar-wrapper {
        transform: translateX(0);
    }

    /* If toggler exists → page may hide sidebar */
    .has-sidebar-toggle #sidebar-wrapper {
        transform: translateX(-100%);
    }

    .has-sidebar-toggle #sidebar-wrapper.show {
        transform: translateX(0);
    }

    #main-content {
        margin-left: 10px !important;
    }
}


/* Mobile ≤ 768px: form/table sizing reduced */
@media (max-width: 768px) {
    .btn { font-size: .85rem; padding: .4rem .8rem; }
    table { font-size: 1rem; }
    form { padding: 15px; }
}

/* Mobile ≤ 576px: small refinements */
@media (max-width: 576px) {
    .card { padding: .5rem; }
    .btn { font-size: .8rem; padding: .3rem .6rem; }
}

/* Dark Mode --------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
    .alert { background: rgba(0,0,0,0.9); color: #fff; }
    .bg-light-subtle { background: #3a2f00 !important; }
}


/* END OF FILE ------------------------------------------------------------- */
