/* Reset and base styles  new comment*/



* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, sans-serif;
}

:root {
    /* Light mode variables */
    --bg-color: #f5f5f5;
    --sidebar-bg: white;
    --topnav-bg: white;
    --box-bg: white;
    --text-color: #333;
    --text-muted: #666;
    --border-color: #eee;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --accent-color: #4a6cf7;
    --accent-dark: #3a5bd9;
    --hover-bg: #f5f5f5;
    --decorative-line: #eee;
}

/* Dark mode variables */
.dark-theme {
    --bg-color: #121212;
    --sidebar-bg: #222;
    --topnav-bg: #222;
    --box-bg: #2a2a2a;
    --text-color: #f0f0f0;
    --text-muted: #aaa;
    --border-color: #444;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --accent-color: #5a77ff;
    --accent-dark: #4a67ef;
    --hover-bg: #333;
    --decorative-line: #666;
}

body {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease;
}

/* Sidebar Styles */
.sidebar {
    width: 250px;
    height: 100%;
    background-color: var(--sidebar-bg);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    transition: width 0.3s ease, background-color 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-y: hidden;
    z-index: 1000;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--decorative-line);
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.sidebar.collapsed .sidebar-title {
    display: none;
}

.sidebar-title {
    margin-left: 15px;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color);
}

.nav-items {
    padding: 10px 0;
}

.sidebar-button {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    width: 100%;
    background-color: transparent;
    color: var(--text-color);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    border-left: 3px solid transparent;
}

.sidebar-button:hover,
.sidebar-button.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border-left: 3px solid var(--accent-color);
}

.sidebar-button i {
    font-size: 18px;
    min-width: 24px;
    display: flex;
    justify-content: center;
}

.sidebar-button span {
    margin-left: 12px;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-button span {
    display: none;
}

.sidebar.collapsed .sidebar-button {
    justify-content: center;
    padding: 12px 0;
}

.decorative-line {
    height: 1px;
    background-color: var(--decorative-line);
    margin: 12px 0px;
}

.sidebar-copyright {
    padding: 16px;
    text-align: center;
    margin-top: auto;
    font-size: 12px;
    color: #adb5bd;

}

.sidebar-img {
    margin-bottom: 8px;
    max-width: 32px;
    opacity: 0.8;
}

.sidebar.collapsed .sidebar-copyright p {
    display: none;
}

/* Overlay */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* TopNav Styles */
.topnav {
    position: fixed;
    top: 0;
    left: 250px;
    width: calc(100% - 250px);
    height: 60px;
    background-color: var(--topnav-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    transition: left 0.3s ease, width 0.3s ease, background-color 0.3s ease;
    z-index: 900;
}


.sidebar.collapsed~.topnav {
    left: 60px;
    width: calc(100% - 60px);
}

/* Search Bar Styles */
.search-container {
    flex: 1;
    max-width: 500px;
    position: relative;
    margin: auto;
}

.search-container input {
    width: 100%;
    padding: 8px 14px;
    border-radius: 3px;
    border: 1px solid var(--border-color);
    font-size: 14px;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.search-container input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 108, 247, 0.2);
    background-color: var(--topnav-bg);
}

.search-container .submit {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
}

/* Profile Dropdown Styles */
.profile {
    position: relative;
    margin-left: 20px;
}

.profile-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.profile-icon:hover {
    background-color: var(--accent-dark);
}

.dropdown {
    position: absolute;
    top: 55px;
    right: 0;
    background-color: var(--box-bg);
    border-radius: 3px;
    border: 1px solid var(--border-color);
    width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    overflow: hidden;
    color: var(--text-color);
}

.dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.username {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.username h2 {
    font-size: 16px;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: var(--hover-bg);
}

.dropdown-item img {
    margin-left: 10px;
    filter: invert(var(--icon-invert));
}

/* Theme toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: var(--accent-color);
}

input:checked+.toggle-slider:before {
    transform: translateX(24px);
}

/* Main Content Styles */
.main-content {
    margin-left: 250px;
    margin-top: 60px;
    padding: 20px;
    width: calc(100% - 250px);
    transition: margin-left 0.3s ease, width 0.3s ease;
}

.sidebar.collapsed~.main-content {
    margin-left: 60px;
    width: calc(100% - 60px);
}

/* Box Layout Styles */
.box-container {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    height: 100%;
    flex-wrap: wrap;
}

.box-container-form {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    height: 100%;
    flex-wrap: wrap;
    justify-content: center;
    align-items:center;
    flex-direction: column;
}


.box-left-column {
    flex: 1;
    max-width: 30%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.box-center-column {
    flex: 1;
    min-width: 30%;
}
.box-right-column {
    flex: 1;
    min-width: 30%;
}
.bottom-row {
    height: min-content;
}

.popup {
  display: none; /* Hidden by default */
  position: fixed;
  top: 0; 
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
}

.popup-content-input{
  padding: 20px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  min-width: 300px;
  width: 40%;
  background-color: #2a2a2a;
  margin-top: 1.5rem; 
  margin-right: auto; 
  margin-left: auto; 
}

.close-popup {
  --bg: #000;
  --hover-bg: #ccc;
  --hover-text: #000;
  color: #fff;
  cursor: pointer;
  border: 1px solid var(--bg);
  border-radius: 4px;
  background: var(--bg);
  width: 25px;
  height: 25px;
}

.box {
    background-color: var(--box-bg);
    border-radius: 3px;
    border: 1px solid var(--border-color);
    padding: 16px;
    height: 100%;
    transition: background-color 0.3s ease;
}

.box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.box-header h2 {
    font-size: 18px;
    color: var(--text-color);
    margin: 0;
}

.top-box {
    min-height: 200px;
    max-height: 50%;
}

.full-height-box {
    min-height: 420px;
    /* Approximately the height of the two stacked boxes + gap */
}

/* Section dividers for right column box */
.box-section {
    padding: 15px 0;
    overflow-y: scroll;
    scrollbar-width: none;
}



.section-header {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--text-color);
}

footer.copyright {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    background-color: var(--box-bg);
    margin-top: 20px;
    margin-left: 250px;
    width: calc(100% - 250px);
    transition: margin-left 0.3s ease, width 0.3s ease, background-color 0.3s ease;
}

.sidebar.collapsed~footer.copyright {
    margin-left: 60px;
    width: calc(100% - 60px);
}

/* Search Results Styling */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: white;
    border-radius: 0 0 3px 3px;
    border: 1px solid var(--border-color);
    border-top: none;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

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


.search-result-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    font-size: 15px;
}

.search-result-details {
    color: #666;
    font-size: 0.9em;
    line-height: 1.4;
    margin-bottom: 8px;
}

.search-result-tag {
    display: inline-block;
    background-color: #e6f2ff;
    color: #044484;
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 3px;
    margin-right: 5px;
}

.search-no-results {
    padding: 15px;
    text-align: center;
    color: #666;
}


/* Form Styles */
form {
background-color: var(--box-bg);
padding: 24px;
border-radius: 3px;
max-width: 700px;
width: 100%;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
}

form h2 {
    display: flex;
    justify-content: center;
}
input[type="text"]:not(.search-container input),
input[type="checkbox"]:not(.search-container input),
input[type="date"]:not(.search-container input),
textarea:not(.search-container textarea),
select:not(.search-container select) {
    padding: 9px 10px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    box-sizing: border-box;
    font-size: 16px;
    width: 100%;
    background-color: var(--bg-color);
    color: var(--text-color);
}

        
input[type="range"] {
    margin: 0.5rem auto;
    font-size: 1.075rem;
    width: 100%;
}


input[type="checkbox"] {
    display: none;
}

input[type="checkbox"] + label {
    display: inline-block;
    margin-right: 15px;
    font-weight: normal;
    position: relative;
    padding-left: 30px;
    cursor: pointer;
}

input[type="checkbox"] + label:before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background-color: #fff;
}

input[type="checkbox"]:checked + label:before {
    background-color: #4CAF50;
}

input[type="submit"] {
    background-color: var(--accent-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    transition: background-color 0.3s ease;
    width: 100%;
}
.submitButton{
    background-color: var(--accent-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    transition: background-color 0.3s ease;
    width: 100%;
}

input[type="submit"]:hover {
    background-color: #0056b3;
}

/* Mobile Styles 
@media (max-width: 768px) {
    .sidebar {
        top: 60px;
        transform: translateX(0%);
        width: 100%;
        z-index: 0;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: 60px;
        transform: translateX(-100%);
    }

    .topnav {
        left: 0;
        width: 100%;
    }

    .search-container {
        max-width: 70%;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .box-left-column,
    .box-right-column {
        flex: 100%;
    }

    .sidebar.collapsed~.topnav,
    .sidebar~.topnav,
    .sidebar.collapsed~.main-content,
    .sidebar~.main-content,
    .sidebar.collapsed~footer.copyright,
    .sidebar~footer.copyright {
        margin-left: 0;
        width: 100%;
        left: 0;
    }

    .sidebar-copyright {
        margin-bottom: auto;
    }

    .overlay.active {
        display: block;
    }

    .toggle-btn {
        display: none;
    }

    .search-container .submit {
        right: -40px;
    }

    .sidebar-img {
        max-width: 128px;
    }
}*/

/* Dark mode specific adjustments */
.dark-theme .search-container .submit img,
.dark-theme .dropdown-item img,
.dark-theme .sidebar-img {
    filter: invert(1);
}

.export-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-right: 20px;
}

.export-button:hover {
    background-color: #1d4ed8;
}

.export-button:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.header h1 {
    color: #111827;
    font-size: 2rem;
    font-weight: 700;
}

.header p {
    color: #6b7280;
}

.dashboard {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    gap: 1.5rem;
}

.category-card {
    border-radius: 3px;
    border: 1px solid var(--border-color);
    overflow: auto;
}

.category-header {
    background-color: var(--topnav-bg);
    padding: 1.25rem;
}

.category-header h2 {
    color: var(--text-color);
    font-size: 1.25rem;
    font-weight: 600;
}

.category-content {
    padding: 1.5rem;
    background: var(--box-bg);
}

.view-item {
    background: var(--sidebar-bg);
    border-radius: 3px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.view-button {
    width: 100%;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-weight: 500;
    color: var(--text-color);
}
.chevron {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.view-button.active .chevron {
    transform: rotate(180deg);
}

.view-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.view-content.active {
    max-height: 2000px;
    transition: max-height 0.5s ease-in;
}

.table-container {
    overflow: auto;
    height: 500px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th {
    background-color: var(--topnav-bg);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    top: 0;
}

td {
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    border-top: 1px solid #e5e7eb;
}

tr:hover td {
    background-color: #f9fafb;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

.error {
    color: #dc2626;
    padding: 1rem;
    text-align: center;
}

footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.usage-unused {
    background-color: #d1fae5;
    color: #065f46;
}

.usage-used {
    background-color: #fef2f2;
    color: #991b1b;
}

.usage-select {
    background: none;
    border: none;
    color: inherit;
    width: 100%;
    padding: 2px;
    font-weight: inherit;
    cursor: pointer;
}

.usage-select option {
    background-color: white;
    color: black;
}

.search-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: end;
}

.search-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

tr.hidden {
    display: none;
}

@media (max-width: 640px) {
    body {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 20px auto;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}


.status-working {
    background-color: #d1fae5;
    color: #065f46;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-weight: 600;
}

.status-broken {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-weight: 600;
}

.load-more-button {
    display: block;
    width: 100%;
    padding: 0.75rem;
    background-color: #f3f4f6;
    color: #374151;
    text-align: center;
    border: 1px solid #e5e7eb;
    border-radius: 3px;
    margin-top: 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.load-more-button:hover {
    background-color: #e5e7eb;
}

.load-more-button:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}
.sticky-controls {
    position: sticky;
    top: 0;
    background-color: var(--sidebar-bg);
    z-index: 100;
    padding: 1rem;
    margin: -1rem -1rem 1rem -1rem;
}

.table-wrapper {
    position: relative;
}

table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.search-input {
    flex: 1;
    max-width: 300px;
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .main-content {
        margin-top: 0px;
        margin-left: 60px;
        padding: 0px;
        z-index: 100;
        width: 100%;
    }

    .topnav{
        display: flex;
        justify-content: flex-end;
    }

    .search-container{
        display: none;
    }

    .dashboard {
        flex-direction: row;
        gap: initial;
    }
    body {
        overflow-x: hidden;
        padding-right: 0px;
        padding-bottom: 0px;
    }

    .sidebar {
        position: fixed;
        top: 0;
        height: 100%;
        transition: left 0.3s ease;
        z-index: 1000;
        overflow-y: hidden;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar.collapsed~.main-content {
        margin-left: 44px;
        margin-top: 44px;
        width: 100%;
    }


    .box-container {
        flex-direction: column;
        width: 95%;
    }

    .box-container-form {
        justify-content: normal;
        align-items: normal;
    }

    .form{
        margin-top: 0px;
    }

    .box-left-column{
        max-width: 100%;
    }
    .box-right-column{
        max-width: 100%;
    }

    .box-center-column {
        width: 100%;
    }


    /* Responsive chart and box adjustments */
    .box,
    .chart-container {
        width: 95%;
        max-width: 100%;
        margin-left: 15px;
        margin-top: 10px;
        height: auto;
    }
    #tab10 {
        display: none;
      }
}

/* Ensure chart containers are responsive */
canvas {
    max-width: 100%;
    height: auto !important;
}
.chat-bubble {
    max-width: 300px;
    background-color: #e0f7fa;
    border-radius: 4px;
    padding: 10px 15px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    position: relative;
}

.subject {
    font-weight: bold;
    font-size: 1em;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;   
}

.message {
    font-size: 0.95em;
    margin-bottom: 8px;
    color: var(--text-color);
}

.time {
    font-size: 0.75em;
    color: var(--text-color);;
    text-align: right;
    display: flex;
    justify-content: space-between;   
}

.bubble.user {
  background-color: #dcf8c6;
  align-self: flex-end;
  text-align: right;
}
