/* ─── TABLE OF CONTENTS ──────────────────────────────────
    1. Global / Reset
    2. Layout             (container, main-content)
    3. Login Page
    4. Sidebar
    5. Cards              (dashboard-card, machine-card, idle-card)
    6. OEE Summary Banner
    7. Progress Bars
    8. Animations & Floating Button
    9. Toasts
   10. DataTables
   11. Gauges
   12. Responsive Columns (Dashboard)
   13. Under Development Page
   14. Navbar
   15. Alarms             (alarm-card, alarms-summary-banner)
   16. Electricity Cards
   17. Buttons            (.btn-gas)
   18. Accordion
   19. CloEE Advisor Panel
   20. Chat Messages
   21. Table Scroll & Modal
   22. Scroll-to-Bottom
   23. Table Card Wrapper (production flow dashboard style)
─────────────────────────────────────────────────────────── */

/* === 1. Global / Reset === */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

h1 {
    color: #333;
}

ul {
    list-style-type: none;
    padding: 0;
}

li {
    margin: 10px 0;
}

a {
    text-decoration: none;
    color: #007BFF;
    font-size: 18px;
}

a:hover {
    text-decoration: underline;
}

/* === 2. Layout === */
.container {
    width: 100%;
    max-width: 1600px; /* Optional max width */
    margin: 0 auto;
    padding: 20px 40px; /* Consistent spacing left and right */
}

.main-content {
    margin-left: 200px;
    transition: margin-left 0.3s ease;
    padding: 60px 20px 20px 20px;
}

/* Flicker-free sidebar collapse: use .sidebar-collapsed on html/body */
.sidebar-collapsed .main-content {
    margin-left: 60px;
}

/* === 3. Login Page === */
/* Applied via class="login-page" on <body> in login.html */
html:has(body.login-page) {
    height: 100%;
}
.login-page {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 40px;
    padding-bottom: 40px;
    background-color: #f5f5f5;
}

/* === 4. Sidebar === */
#sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    transition: width 0.3s ease;
    overflow: hidden;
    white-space: nowrap;
    padding-top: 60px;
    position: fixed;
    width: 220px;
    z-index: 100;
}

.sidebar-collapsed #sidebar {
    width: 60px;
}

/* Sidebar toggle button */
#sidebar-toggle {
    position: absolute;
    top: 60px;
    right: -2px;
    width: 20px;
    height: 20px;
    background-color: rgba(52, 58, 64, 0.3);
    color: white;
    text-align: center;
    line-height: 18px;
    font-size: 12px;
    border-radius: 3px 0 0 3px;
    cursor: pointer;
    z-index: 1050;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s ease;
}

#sidebar-toggle:hover {
    background-color: rgba(52, 58, 64, 0.7);
}

/* Sidebar links */
.sidebar-link {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.sidebar-link:hover {
    background-color: #e9ecef;
}

.sidebar-link.active {
    font-weight: bold;
    color: #212529;
    background-color: #dee2e6;
    border-left: 4px solid #adb5bd;
    border-radius: 6px;
}

.sidebar-link.active:hover {
    background-color: #ced4da;
}

.sidebar-link i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.sidebar-collapsed #sidebar .sidebar-link span {
    display: none;
}

.sidebar-collapsed #sidebar .sidebar-link i {
    margin-right: 0;
}

.sidebar-collapsed #sidebar .sidebar-link.active {
    background-color: #dee2e6;
    border-left: none;
    border-radius: 8px;
}

.sidebar-collapsed #sidebar .sidebar-link.active i {
    color: #0d6efd;
}

.sidebar-links {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-user-info {
    flex-shrink: 0;
    /* Remove absolute positioning and related properties */
    position: static;
    left: unset;
    bottom: unset;
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    opacity: 0.5;
    font-size: 0.95em;
    pointer-events: auto;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 200;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.sidebar-user-info * {
    pointer-events: auto;
}
.sidebar-user-info .sidebar-logout-btn,
.sidebar-user-info .sidebar-user-email-text {
    display: inline-flex;
}
.sidebar-collapsed #sidebar .sidebar-user-info .sidebar-logout-btn,
.sidebar-collapsed #sidebar .sidebar-user-info .sidebar-user-email-text {
    display: none !important;
}
.sidebar-collapsed #sidebar .sidebar-user-info .bi-person-circle {
    display: inline-block;
}
.sidebar-collapsed #sidebar .sidebar-user-info .bi-person-circle {
    font-size: 20px !important;
    margin-right: 0 !important;
}
.sidebar-collapsed #sidebar .sidebar-user-info {
    text-align: center;
    padding-left: 0 !important;
    padding-right: 0 !important;
    display: flex;
    justify-content: center;
    align-items: center;
}
.sidebar-collapsed #sidebar .sidebar-user-info .bi-person-circle {
    font-size: 20px !important;
    margin-right: 0 !important;
    display: inline-block;
}

/* Factory and employee selectors: hide in collapsed state, show icon-only alternatives */
.sidebar-factory-icon,
.sidebar-employee-icon {
    display: none;
}
.sidebar-collapsed #sidebar .sidebar-factory-select,
.sidebar-collapsed #sidebar .sidebar-employee-select {
    display: none;
}
.sidebar-collapsed #sidebar .sidebar-factory-icon,
.sidebar-collapsed #sidebar .sidebar-employee-icon {
    display: block;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    font-size: 0.93em;
    color: #222 !important;
    margin-left: 0;
    padding: 0;
    background: none;
    border: none;
    text-decoration: none;
    gap: 3px;
    opacity: 0.7;
    transition: opacity 0.2s, color 0.2s;
    cursor: pointer;
}
.sidebar-logout-btn i {
    color: #222 !important;
    font-size: 1em;
    transition: color 0.2s;
}
.sidebar-logout-btn:hover {
    opacity: 1;
    color: #0d6efd !important;
    text-decoration: underline;
}
.sidebar-logout-btn:hover i {
    color: #0d6efd !important;
}

/* === 5. Cards === */
.dashboard-card {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    transition: 0.3s ease-in-out;
    text-decoration: none;
    color: inherit;
}

.dashboard-card:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

.dashboard-card.machine-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.dashboard-card.machine-card .card-header {
    font-size: 1rem;
    font-weight: 600;
    padding: 10px 16px;
    background-color: #212529;
    color: #fff;
}

.dashboard-card.machine-card .card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.95rem;
}

/* Card state for idle machines */
.idle-card {
    background-color: #fff3f4;
    border: 1px solid #f5c6cb;
}

/* === 6. OEE Summary Banner === */
.oee-summary-banner {
    background-color: #ffc107;
    padding: 5px 10px; /* Less vertical space */
    color: #212529;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border-radius: 6px;

    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 20px;
    flex-wrap: wrap;
    text-align: center;
}
.alarms-summary-text,
.oee-summary-text {
    font-size: 3rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
    margin: 0;
}

.alarms-summary-value,
.oee-summary-value {
    font-size: 3rem;
    font-weight: 800;
    margin: 0;
}

/* === 7. Progress Bars === */
.progress {
    background-color: #e9ecef;
    border-radius: 10px;
    height: 16px;
    overflow: hidden;
}

.progress-bar {
    font-size: 0.8rem;
    line-height: 16px;
    border-radius: 10px;
}

/* === 8. Animations & Floating Button === */
.fade-in {
    animation: fadeIn 0.7s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Floating CloEE logo (display: none — kept for structural reference) */
.floating-logo-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 240px;
    height: 240px;
    z-index: 9999;
    transition: transform 0.3s ease;
    display: none !important;
}

.floating-logo-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.floating-logo-btn:hover {
    transform: scale(1.2);
}

.custom-bg {
    background: linear-gradient(to right, #e2e8f0, #e5e7eb);
}

@media (prefers-color-scheme: dark) {
    .custom-bg {
        background: linear-gradient(to right, #1f2937, #111827);
        color: white !important;
    }
}

/* Disable card hover effect for jobs configuration page */
.dashboard-detail-card
.dashboard-detail-card:hover
.jobs-configuration-card,
.jobs-configuration-card:hover {
    transform: none !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

/* === 9. Toasts === */
  .toast-container {
    position: fixed;
    bottom: 1rem;
    right: -350px;
    z-index: 1055;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: right 0.5s ease-in-out, opacity 0.5s ease-in-out;
  }

  .toast-container.show {
    right: 1rem;
  }

  .toast-message {
    min-width: 250px;
    max-width: 350px;
    opacity: 0;
    animation: fadeSlideIn 0.5s forwards, fadeOut 0.5s 4.5s forwards;
  }

  @keyframes fadeSlideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
  }

  @keyframes fadeOut {
    to { opacity: 0; transform: translateX(100%); }
  }

/* Card overrides (disable hover except on machine-card) */
.card {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    border: none;
    padding: 20px;
    margin-bottom: 15px;
  }

.dashboard-card {
  transition: none !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.dashboard-card:hover {
  transform: none !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

.dashboard-card.machine-card {
  transition: transform 0.2s ease-in-out;
}
.dashboard-card.machine-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

/* === 10. DataTables === */

.dataTables_wrapper {
  padding: 0.75rem;
  background-color: #f8f9fa;
  border-radius: 0 0 0.75rem 0.75rem;
  margin-top: 0;
  width: 100%;
}

.dataTables_wrapper .row { margin: 0; }

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  display: block !important;
  visibility: visible !important;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #495057;
  margin-bottom: 0;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter input:focus {
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.dataTables_wrapper .dataTables_info {
  font-size: 0.875rem;
  color: #6c757d;
  padding-top: 0.75rem;
}

.dataTables_wrapper .dataTables_paginate { padding-top: 0.75rem; }

.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 0.375rem 0.75rem;
  margin: 0 0.125rem;
  border: 1px solid #dee2e6;
  background-color: #ffffff;
  color: #0d6efd;
  border-radius: 0.375rem;
  transition: all 0.15s ease-in-out;
  font-size: 0.875rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background-color: #0d6efd;
  color: #ffffff;
  border-color: #0d6efd;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background-color: #0d6efd;
  color: #ffffff;
  border-color: #0d6efd;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

h1, h5 {
  font-weight: 600;
}

/* === 11. Gauges === */
.gauge-container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
    position: relative;
}

/* Constrain gauge size on larger screens */
@media (min-width: 768px) {
    .gauge-container {
        max-width: 200px;
    }
}

/* Smaller sizing for electricity and dashboard cards to prevent overlap */
@media (min-width: 768px) {
    .electricity-card .gauge-container,
    .dashboard-card .gauge-container {
        max-width: 160px;
    }
}

/* Allow gauges to shrink on smaller screens */
@media (max-width: 767px) {
    .gauge-container {
        max-width: 150px;
    }
}

/* Extra responsive breakpoints for tighter layouts */
@media (max-width: 1400px) {
    .electricity-card .gauge-container,
    .dashboard-card .gauge-container {
        max-width: 140px;
    }
}

@media (max-width: 1200px) {
    .electricity-card .gauge-container,
    .dashboard-card .gauge-container {
        max-width: 130px;
    }
}

/* When chat panel is open, allow flexible sizing */
.cloee-assistant-open .gauge-container {
    max-width: 100%;
}

/* Ensure canvas elements resize properly */
.gauge-container canvas {
    max-width: 100% !important;
    height: auto !important;
    display: block;
}

/* Minimum readable size for all gauge types */
.gauge-card .gauge-container,
.electricity-card .gauge-container,
.dashboard-card .gauge-container {
    min-width: 120px;
}

/* Progressive sizing when chat panel is open */
.cloee-assistant-open .gauge-card .gauge-container,
.cloee-assistant-open .electricity-card .gauge-container,
.cloee-assistant-open .dashboard-card .gauge-container {
    max-width: 160px;
}

@media (max-width: 1400px) {
    .cloee-assistant-open .gauge-container {
        max-width: 140px;
    }
}

@media (max-width: 1200px) {
    .cloee-assistant-open .gauge-container {
        max-width: 120px;
    }
}

@media (max-width: 992px) {
    .cloee-assistant-open .gauge-container {
        max-width: 100px;
    }
}

/* Gauge wrapper */
.gauge-wrapper {
    width: 100%;
    max-width: 210px;
    margin: 0 auto;
}

/* Make gauges readable even with many columns */
@media (min-width: 1400px) {
    .electricity-card .gauge-wrapper,
    .dashboard-card .gauge-wrapper {
        max-width: 180px;
    }
}

@media (max-width: 1399px) {
    .electricity-card .gauge-wrapper,
    .dashboard-card .gauge-wrapper {
        max-width: 160px;
    }
}

@media (max-width: 1200px) {
    .electricity-card .gauge-wrapper,
    .dashboard-card .gauge-wrapper {
        max-width: 140px;
    }
}

/* When chat panel is open, ensure gauges remain readable */
.cloee-assistant-open .electricity-card .gauge-wrapper,
.cloee-assistant-open .dashboard-card .gauge-wrapper {
    max-width: 180px;
}

@media (max-width: 1400px) {
    .cloee-assistant-open .electricity-card .gauge-wrapper,
    .cloee-assistant-open .dashboard-card .gauge-wrapper {
        max-width: 160px;
    }
}

@media (max-width: 1200px) {
    .cloee-assistant-open .electricity-card .gauge-wrapper,
    .cloee-assistant-open .dashboard-card .gauge-wrapper {
        max-width: 140px;
    }
}

@media (max-width: 992px) {
    .cloee-assistant-open .electricity-card .gauge-wrapper,
    .cloee-assistant-open .dashboard-card .gauge-wrapper {
        max-width: 120px;
    }
}

.gauge-wrapper canvas {
    max-width: 100% !important;
    height: auto !important;
}

/* === 12. Responsive Columns (Dashboard) === */
/* Default: 6 per row when chat is closed */
@media (min-width: 992px) {
    .dashboard-row .dashboard-col {
        flex: 0 0 16.666667% !important; /* 6 per row */
        max-width: 16.666667% !important;
    }
}

/* When chat is open, make dashboard columns wider (4 per row) */
@media (min-width: 1200px) {
    .cloee-assistant-open .dashboard-col {
        flex: 0 0 25% !important; /* col-xl-3 equivalent (4 per row) */
        max-width: 25% !important;
    }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    .cloee-assistant-open .dashboard-col {
        flex: 0 0 25% !important; /* 4 per row when chat opens */
        max-width: 25% !important;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .cloee-assistant-open .dashboard-col {
        flex: 0 0 50% !important; /* col-md-6 equivalent (2 per row) */
        max-width: 50% !important;
    }
}

/* === 13. Under Development Page === */


    .under-dev-page {
        background: linear-gradient(135deg, #f8f9fa, #ffffff);
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        text-align: center;
        padding: 2rem;
        animation: fadeIn 0.8s ease-in;
    }

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

    .dev-icon {
        font-size: 4rem;
        margin-bottom: 1rem;
    }

    .dev-title {
        font-size: 3rem;
        font-weight: 700;
        color: #212529;
    }

    .dev-subtext {
        font-size: 1.2rem;
        color: #495057;
        margin-bottom: 2rem;
    }

/* === 14. Navbar === */


.cloee-logo-img path.cls-1 {
  fill: #fff !important;
}

.nav-separator {
  color: rgba(255, 255, 255, 0.5); /* Lighter color for the pipe */
  margin: 0 0.5rem; /* Spacing around the pipe */
  font-size: 1.25rem; /* Match text size */
}

.navbar-brand.d-flex {
    gap: 0.25rem; /* Adjust gap for items with explicit separator margins */
    align-items: center; /* Ensure vertical alignment */
}

/* Remove underline from navbar brand on hover */
.navbar-brand:hover,
.navbar-brand:focus {
    text-decoration: none !important;
}


  .gauge-container {
    padding-top: 0 !important;
    margin-top: 0 !important;
  }

  .gauge-card {
    padding-top: 10px !important;
  }

/* === 15. Alarms === */

.alarms-summary-link:hover {
    text-decoration: none !important;
}

/* Alarms Summary Banner */
.alarms-summary-banner {
    background-color: #dc3545;
    padding: 5px 10px;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border-radius: 6px;

    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 20px;
    flex-wrap: wrap;
    text-align: center;
    transition: transform 0.3s ease-in-out;
}

.alarms-summary-banner:hover {
    transform: scale(1.01);
}

/* Alarm Card Colors */
.alarm-card-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
}

.alarm-card-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

/* === 16. Electricity Cards === */
.electricity-card {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    transition: 0.3s ease-in-out;
    text-decoration: none;
    color: inherit;
    background: #fff;
    margin-bottom: 2rem;
}




.electricity-card .card-header {
    font-size: 1rem;
    font-weight: 600;
    padding: 10px 16px;
    background-color: #212529;
    color: #fff;
    text-align: center;
}

.electricity-card .card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.95rem;
}

/* === 17. Buttons (.btn-gas) === */
/* Gas action buttons; also used on the Downtimes page */
.btn-gas {
    background-color: #16ceda;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-gas:hover, .btn-gas:focus {
    background-color: #139eaa;
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}
.btn-gas[data-selected="true"] {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    transform: scale(1.05);
}

/* === 18. Accordion === */
.accordion-item {
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 1rem;
}

.accordion-button:not(.collapsed) {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: none;
    background-color: #f1f1f1 !important;
    color: #212529;
}

.accordion-collapse {
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
    overflow: hidden;
}

.accordion-button:focus {
    box-shadow: none;
}

/* === 19. CloEE Advisor Panel === */
.cloee-assistant-panel {
  position: fixed;
  top: 60px;
  right: -32px;
  width: 32px;
  min-width: 0;
  max-width: 32px;
  height: calc(100vh - 60px);
  background: transparent;
  border-left: none;
  box-shadow: none;
  z-index: 1040;
  transition: right 0.3s cubic-bezier(.4,0,.2,1), width 0.3s cubic-bezier(.4,0,.2,1), min-width 0.3s, max-width 0.3s;
  pointer-events: none;
}
.cloee-assistant-panel .cloee-assistant-header,
.cloee-assistant-panel .cloee-assistant-body {
  display: none !important;
}
.cloee-assistant-panel.open {
  right: 0 !important;
  width: 33.33%;
  min-width: 320px;
  max-width: 33.33vw;
  background: #fff;
  border-left: 1px solid #dee2e6;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
  transition: right 0.3s cubic-bezier(.4,0,.2,1), width 0.3s cubic-bezier(.4,0,.2,1), min-width 0.3s, max-width 0.3s;
  pointer-events: auto;
}
.cloee-assistant-panel.open .cloee-assistant-header,
.cloee-assistant-panel.open .cloee-assistant-body {
  display: block !important;
}

.cloee-assistant-header {
    position: relative; /* Use positioning instead of flexbox */
    padding: 0.5rem 1.5rem;
    padding-right: 4rem; /* Make room for close button */
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    min-height: 45px;
    box-sizing: border-box;
}

.cloee-assistant-header h5 {
    color: #212529;
    font-weight: 600;
    margin: 0;
    line-height: 1.5;
    font-size: 1.1rem;
    padding-top: 0.2rem; /* Adjust vertical centering */
}

.cloee-assistant-header .btn-close {
    position: absolute;
    top: 50%;
    right: 1.5rem;
    transform: translateY(-50%); /* Perfect vertical centering */
    margin: 0;
}

.cloee-assistant-body {
    height: calc(100vh - 60px - 45px); /* Total height minus navbar minus smaller header */
    padding: 0.5rem 1.5rem 0.5rem 1.5rem;
    overflow-y: auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Main content adjustment when panel is open */
.main-content.cloee-assistant-open {
    margin-right: 33.33%;
    max-width: calc(66.67vw - 200px); /* Account for sidebar */
}

.sidebar-collapsed .main-content.cloee-assistant-open {
    max-width: calc(66.67vw - 60px); /* Account for collapsed sidebar */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .cloee-assistant-panel {
        width: 100%;
        min-width: 100%;
        max-width: 100vw;
        right: -100%;
    }

    .main-content.cloee-assistant-open {
        margin-right: 100%;
        max-width: 0;
    }

    .sidebar-collapsed .main-content.cloee-assistant-open {
        max-width: 0;
    }
}

@media (min-width: 769px) and (max-width: 1200px) {
    .cloee-assistant-panel {
        min-width: 320px;
        max-width: 400px;
        width: 400px;
    }

    .main-content.cloee-assistant-open {
        margin-right: 400px;
        max-width: calc(100vw - 400px - 200px);
    }

    .sidebar-collapsed .main-content.cloee-assistant-open {
        max-width: calc(100vw - 400px - 60px);
    }
}

/* === 20. Chat Messages === */
.assistant-panel-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  width: 100%;
}

.session-toolbar {
  flex: 0 0 auto;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0 !important;
  margin-bottom: 10px !important;
  margin-top: 10px !important;
}

.session-strip {
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0 !important;
  margin-bottom: 10px !important;
}

#session-list .btn {
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  line-height: 1.2;
  margin-right: 0.34rem;
  border: 1px solid #e0e0e0;
  background: #f9f9f9;
  color: #666;
  transition: all 0.2s;
}

#session-list .btn:hover {
  background: #f0f0f0;
  border-color: #28a745;
  color: #28a745;
}

#session-list .btn:last-child {
  margin-right: 0;
}

#session-list .btn.active,
#session-list .btn:focus {
  background: #28a745;
  color: white;
  border-color: #28a745;
  box-shadow: 0 2px 6px 0 rgba(40, 167, 69, 0.25);
}

#create-session {
  border-radius: 999px;
  padding: 0rem 0.4rem;
  line-height: 1.2;
  margin-right: 0.1rem;
  border: 1px solid #ccc;
  color: #333;
  background: transparent;
  font-weight: 500;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  font-size: 1.1rem;
}

#create-session:hover {
  background: #f0f0f0;
  color: #333;
  border-color: #ccc;
}

.chat-outer-wrapper {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  position: relative;
  background: transparent !important;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.chat-inner-scroll {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 0.7rem 0.7rem 0 0.7rem;
  box-sizing: border-box;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  border: none;
  transition: background 0.2s;
  align-items: flex-start;
  justify-content: flex-start;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
  scroll-padding-bottom: 0 !important;
  padding-left: 0 !important;
}

.chat-bottom-bar-fixed {
  flex: 0 0 auto;
  width: 100%;
  position: static;
  background: #fff;
  border-top: 1px solid #ececec;
  box-shadow: 0 -2px 8px 0 rgba(31,38,135,0.03);
  padding: 0;
  margin: 0;
  z-index: 10;
}

.chat-bottom-bar-fixed,
#chat-bottom-bar {
  border-top: none !important;
}

.chat-form {
  width: 100%;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0;
  padding: 0.75rem 0.75rem 0 0.75rem;
  box-sizing: border-box;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
}

.chat-input-animated {
  flex: 1 1 auto;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  font-size: 1.08rem;
  padding: 0.65rem 1rem;
  transition: border 0.2s, box-shadow 0.2s, background 0.2s;
  background: rgba(255,255,255,0.7);
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.04);
  backdrop-filter: saturate(180%) blur(10px);
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
  resize: none;
  min-height: 40px;
  max-height: 90px;
  overflow-y: auto;
  font-family: inherit;
  line-height: 1.5;
}

.chat-input-animated:focus {
  border: 1px solid #28a745;
  box-shadow: 0 2px 8px 0 rgba(40, 167, 69, 0.15);
  outline: none;
}

.chat-form .chat-send-btn {
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: #28a745;
  border-color: #28a745;
  color: white;
  box-shadow: 0 1px 2px 0 rgba(40, 167, 69, 0.15);
  transition: background 0.2s, box-shadow 0.2s;
}

.chat-form .chat-send-btn:hover {
  background: #218838;
  border-color: #218838;
  box-shadow: 0 2px 8px 0 rgba(40, 167, 69, 0.25);
}

.chat-form .chat-send-btn:active {
  background: #1e7e34;
  border-color: #1e7e34;
  box-shadow: 0 2px 8px 0 rgba(40, 167, 69, 0.35);
}

.chat-message {
  padding: 0.85rem 1.2rem;
  border-radius: 1.2rem;
  max-width: 90%;
  word-wrap: break-word;
  transition: background 0.2s, color 0.2s;
  opacity: 0;
  animation: fadeIn 0.35s forwards;
  font-size: 1rem;
  line-height: 1.6;
}

.chat-message.welcome-message {
  font-size: 1rem;
  padding: 0.7rem 1rem;
  max-width: 100%;
  width: 100%;
  text-align: left;
}

.chat-message.welcome-message ul {
  margin-top: 0.3em;
  margin-bottom: 0.3em;
  padding-left: 1.1em;
  text-align: left;
}

.chat-message.welcome-message li {
  font-size: 0.98em;
  margin-bottom: 0.12em;
  margin-top: 0;
  line-height: 1.2;
  font-weight: 600;
  position: relative;
  display: block;
  margin-right: 0;
  text-align: left;
}

.chat-message.welcome-message li::before {
  content: '\2022';
  color: #0d6efd;
  font-size: 1.1em;
  margin-right: 0.5em;
  vertical-align: middle;
  display: inline-block;
}

.chat-message .cloee-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e3f7e7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #2e7d32;
  flex-shrink: 0;
  border: none;
}

.user-message {
  align-self: flex-end;
  background: #e8e8e8;
  color: #333;
  margin-right: 0;
  font-weight: 500;
}

.assistant-message {
  align-self: stretch;
  background: transparent;
  border: none;
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  width: 100%;
  max-width: none;
}

.assistant-message .cloee-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e3f7e7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #2e7d32;
  flex-shrink: 0;
  border: none;
}

.assistant-content {
  flex: 1;
  padding: 0;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-align: left;
}

.assistant-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.assistant-content table th,
.assistant-content table td {
  border: 1px solid #ddd;
  padding: 0.5rem;
  text-align: left;
}

.assistant-content table th {
  background: #f5f5f5;
  font-weight: bold;
}

.assistant-content table tbody tr:nth-child(even) {
  background: #f9f9f9;
}

/* === 21. Table Scroll & Modal === */
.table-scroll-wrapper {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.5rem 0;
  border-radius: 4px;
  box-sizing: border-box;
  position: relative;
}

.table-scroll-wrapper table {
  width: auto;
  min-width: 100%;
}

.table-expand-btn {
  position: fixed;
  padding: 0.4rem 0.8rem;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.2s;
  z-index: 5;
  display: none;
}

.table-expand-btn:hover {
  background: #218838;
}

.table-expand-btn-top {
  top: 8px;
  left: 8px;
}

.table-expand-btn-bottom {
  bottom: 8px;
  left: 8px;
}

.table-scroll-wrapper:hover .table-expand-btn {
  display: block;
}

.table-actions {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.75rem;
  font-size: 0.95rem;
  align-items: center;
}

.table-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 500;
  padding: 0.25rem 0;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.table-action-btn:active {
  transform: scale(0.98);
}

.table-expand-link {
  color: #28a745;
  text-decoration: none;
}

.table-expand-link:hover {
  color: #218838;
  text-decoration: underline;
}

.table-download-btn {
  color: #28a745;
  text-decoration: none;
}

.table-download-btn:hover {
  color: #218838;
  text-decoration: underline;
}

.table-modal {
  display: none;
  position: fixed;
  z-index: 1055;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s;
}

.table-modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-modal-content {
  background-color: white;
  border-radius: 8px;
  width: auto;
  height: auto;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s;
}

.table-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.table-modal-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.table-modal-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.table-modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.table-modal-close:hover {
  color: #000;
}

.table-modal-body {
  flex: 1;
  padding: 1.5rem;
  overflow: auto;
  background: #f9f9f9;
}

.table-modal-body table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-modal-body table th,
.table-modal-body table td {
  border: 1px solid #ddd;
  padding: 0.75rem;
  text-align: left;
  font-size: 1rem;
}

.table-modal-body table th {
  background: #f5f5f5;
  font-weight: bold;
}

.table-modal-body table tbody tr:hover {
  background: #f0f0f0;
}

.table-modal-body table tbody tr:nth-child(even) {
  background: #fafafa;
}

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

.assistant-content h1, .assistant-content h2, .assistant-content h3, .assistant-content h4, .assistant-content h5, .assistant-content h6 {
  margin: 0.75rem 0 0.5rem 0;
  font-weight: 600;
  line-height: 1.4;
}

.assistant-content h1 { font-size: 1.4em; }
.assistant-content h2 { font-size: 1.3em; }
.assistant-content h3 { font-size: 1.2em; }
.assistant-content h4 { font-size: 1.1em; }
.assistant-content h5 { font-size: 1em; }
.assistant-content h6 { font-size: 0.95em; }

.assistant-content code {
  background: #f3f6fa;
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.assistant-content pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}

.assistant-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.assistant-content ul, .assistant-content ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.assistant-content li {
  margin: 0.25rem 0;
  line-height: 1.6;
}

.assistant-content blockquote {
  border-left: 3px solid #0d6efd;
  padding-left: 1rem;
  margin: 0.5rem 0;
  color: #555;
}

.assistant-content strong { font-weight: 700; }
.assistant-content em { font-style: italic; }
.assistant-content a {
  color: #0d6efd;
  text-decoration: none;
}

.assistant-content a:hover {
  text-decoration: underline;
}

.typing-dot-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  height: 20px;
  overflow: hidden;
}

.typing-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #0d6efd;
  border-radius: 50%;
  opacity: 0.6;
  animation: typing-bounce 1.2s infinite;
  flex-shrink: 0;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* === 22. Scroll-to-Bottom === */
.scroll-to-bottom-btn {
  position: absolute;
  bottom: 70px;
  right: 15px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #28a745;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
  transition: all 0.2s ease;
  z-index: 20;
}

.scroll-to-bottom-btn:hover {
  background: #218838;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
  transform: translateY(-2px);
}

.scroll-to-bottom-btn:active {
  background: #1e7e34;
  transform: translateY(0);
}

/* === 23. Table Card Wrapper (production flow dashboard style) === */

.table-card-wrapper {
  background: white;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.125);
  display: flex;
  flex-direction: column;
}

.table-card-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.125);
  border-radius: 0.75rem 0.75rem 0 0;
  flex-shrink: 0;
}

.table-card-body {
  padding: 0;
  background: white;
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.table-card-body .table-responsive {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.table-card-body .table {
  margin-bottom: 0;
  border-radius: 0;
}

.table-card-body .table thead th {
  border-top: none;
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #495057;
  padding: 0.75rem 1rem;
}

.table-card-body .table tbody td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
  font-size: 0.9rem;
}

.table-card-wrapper.table-card-collapsed {
  border-radius: 0.75rem !important;
}

/* ─── 21. Active Employee Selector Pulse ─────────────────────────────────── */
@keyframes employee-selector-pulse {
  0%   { border-color: #ffc107; box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.6); }
  50%  { border-color: #ffc107; box-shadow: 0 0 0 6px rgba(255, 193, 7, 0); }
  100% { border-color: #ffc107; box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}
.employee-selector-pulse {
  animation: employee-selector-pulse 0.8s ease 2;
}
