/* === Global styles === */
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;
}

/* === Container and 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;
}

/* === 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;
}
.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;
}

/* === Cards === */
/* Removed old card styles */

/* === Dashboard Card Styles === */
.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;
}

/* === 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;
}

/* === 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;
}

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

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

/* === Floating CloEE Logo Button === */
.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);
}

.custom-btn:hover {
    background-color: #f3e8ff !important;
    transition: background-color 0.3s ease-in-out;
}

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

    .custom-btn {
        background-color: #374151 !important;
        color: white !important;
    }

    .custom-btn:hover {
        background-color: #4b5563 !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;
}

  .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%); }
  }

.chart-container {
    width: 45%;
    display: inline-block;
}


.chart-small {
max-width: 150px;
margin: 0 auto;
}

#gantt {
width: 100%;
height: 400px;
border: 1px solid #ddd;
margin-top: 1rem;
}

/* === Card Styles === */
.card {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    border: none;
    padding: 20px; /* Ensure uniform card padding */
    margin-bottom: 15px; /* Consistent vertical spacing */
  }

/* Remove hover animation from dashboard-card except for .machine-card */
.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;
}

/* Keep animation for .dashboard-card.machine-card if needed */
.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);
}

/* === DataTables Styles === */

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #f9f9f9;
  margin-top: 0;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0;
    border-radius: 8px;
  box-shadow: 0 1px 3px rgba(161, 118, 118, 0.1);
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 0.5rem 0.75rem;
  margin: 0 0.2rem;
  border: 1px solid rgb(95, 95, 95);
  background-color: #ffffff;
  color: #0d6efd;
  border-radius: 0.375rem;
  transition: all 0.2s ease-in-out;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background-color: rgb(3, 27, 61);
  color: #ffffff;
}

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

h1, h5 {
  font-weight: 600;
}

.gauge-container {
    max-width: 180px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
}

/* === Under Development Page Styles === */


    .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;
    }

    .dev-back-link:hover {
        border-bottom: 1px solid #212529;
    }

/* === Navbar Image Styles === */


.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 */
}

.bodycote-nav-text {
  color: #fff;
  font-size: 1.25rem; /* Reset to standard navbar brand size */
  font-weight: normal; /* Or bold, depending on desired emphasis */
  line-height: normal; /* Reset line-height */
}

.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;
  }

/* === Alarms Dashboard Card Styles === */
.alarms-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;
    background: #fff;
    margin-bottom: 2rem;
}

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

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

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

.alarms-dashboard-card .table {
    margin-bottom: 0;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: none;
}

.alarms-dashboard-card .table th {
    background: #f8f9fa;
    color: #212529;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

.alarms-dashboard-card .table tr.table-danger {
    background-color: #fff3f4;
}

.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;
}

/* === Electricity Dashboard Card Styles === */
.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;
}

.electricity-card-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
}

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

/* === Gas Dashboard Card Styles === */
.gas-card {
    box-shadow: 0 4px 8px rgba(22, 206, 218, 0.10);
    border-radius: 8px;
    overflow: hidden;
    transition: 0.3s ease-in-out;
    text-decoration: none;
    color: inherit;
    background: #f8feff;
    border: 1px solid #16ceda;
    margin-bottom: 2rem;
}
.gas-card:hover {
    transform: scale(1.03);
    box-shadow: 0 12px 24px rgba(22, 206, 218, 0.18);
    text-decoration: none;
}
.gas-card .card-header {
    font-size: 1rem;
    font-weight: 600;
    padding: 10px 16px;
    background-color: #16ceda;
    color: #fff;
    text-align: center;
}
.gas-card .card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.95rem;
}

/* === Gas Dashboard Buttons === */
.btn-gas {
    background-color: #16ceda;
    color: #fff;
    border: none;
}
.btn-gas:hover, .btn-gas:focus {
    background-color: #139eaa;
    color: #fff;
}
.btn-outline-gas {
    background: transparent;
    color: #16ceda;
    border: 1.5px solid #16ceda;
}
.btn-outline-gas:hover, .btn-outline-gas:focus {
    background: #e6fcff;
    color: #139eaa;
    border-color: #139eaa;
}

/* === Chat Modal Styles === */
.chat-modal-content {
    border-radius: 1rem !important;
    overflow: hidden;
    background: #23272b !important;
    height: calc(100vh - 60px);
    max-height: calc(100vh - 20px);
    display: flex;
    flex-direction: column;
}

.chat-modal-header {
    background: transparent !important;
    border-top-left-radius: inherit !important;
    border-top-right-radius: inherit !important;
    padding: 0 !important;
    overflow: hidden;
    border-bottom: none !important;
}

.chat-modal-header-bg {
    background: #23272b;
    color: #fff;
    width: 100%;
    display: flex;
    align-items: center;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
    padding: 1rem 1.5rem; /* Set your header height here */
}

.chat-modal-body {
    background: #fff !important;
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
    margin: 0;
    padding: 0 !important;
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
}

.chat-modal-body iframe {
    flex: 1 1 0;
    width: 100%;
    min-height: 0;

    border: none;
    display: block;
}

.chat-modal-btn-close:focus {
    box-shadow: none;
    outline: none;
}

#chatModal .modal-dialog {
    max-width: 760px;
    width: 100%;
}

/* Accordion visual containment and highlight fixes */
.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;
}

/* === CloEE Advisor Panel Styles === */
.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;
}
.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;
}
.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);
    }
}

/* === Assistant Panel Styles === */
.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;
}

.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: 9999;
  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; }
}

/* === Scroll-to-Bottom Button === */
.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);
}
