/* Dark theme override for Bootstrap */
body {
    background-color: #252525 !important;
    color: #e0e0e0 !important;
}

/* Override Bootstrap table styling for dark theme */
.table {
    --bs-table-bg: #1c1c1c;
    --bs-table-hover-bg: #2a2a2a;
    color: #e0e0e0;
}

.table-dark {
    --bs-table-bg: #151515;
    --bs-table-striped-bg: #1a1a1a;
    --bs-table-hover-bg: #1f1f1f;
    --bs-table-border-color: #333;
}

.table thead {
    border-color: #333;
}

.table tbody {
    border-color: #333;
}

.table th {
    color: #000000;
    border-color: #333;
}

.table td {
    border-color: #333;
}

/* Override Bootstrap form-select and form-control for dark theme */
.form-select,
.form-control {
    --bs-form-control-bg: #333;
    --bs-form-control-border-color: #555;
    color: #000000;
}

.form-select:focus,
.form-control:focus {
    --bs-form-control-bg: #333;
    --bs-form-control-border-color: #007acc;
    --bs-form-control-focus-border-color: #007acc;
    --bs-form-control-focus-bg: #333;
    color: #000000;
}

.form-select option {
    background-color: #333;
    color: #000000;
}

/* Override Bootstrap button colors */
.btn-primary {
    --bs-btn-bg: #007acc;
    --bs-btn-border-color: #007acc;
    --bs-btn-hover-bg: #005a9e;
    --bs-btn-hover-border-color: #005a9e;
}

.btn-primary:focus {
    --bs-btn-focus-shadow-rgb: 0, 122, 204;
}

.btn-success {
    --bs-btn-bg: #28a745;
    --bs-btn-border-color: #28a745;
    --bs-btn-hover-bg: #218838;
    --bs-btn-hover-border-color: #218838;
}

.btn-success:focus {
    --bs-btn-focus-shadow-rgb: 40, 167, 69;
}

/* Header styles */
header {
    background-color: #1c1c1c;
    border-bottom: 1px solid #333;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo img {
    height: 40px;
    width: auto;
    padding-top: 2px;
    padding-bottom: 2px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    padding-right: 12px;
}

.logo-text h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    border-left: 3px solid #fff;
    padding-left: 12px;
}

.logo-text p {
    margin: 0;
    font-size: 12px;
    color: #999;
    border-left: 3px solid #fff;
    padding-left: 12px;
}

/* Navigation styles */
nav {
    display: flex;
    gap: 0;
    margin: 0;
    flex-wrap: wrap;
}

nav a {
    color: #ccc;
    text-decoration: none;
    margin: 0 15px;
    font-size: 16px;
    padding: 10px 0;
    border-bottom: 2px solid transparent;
    transition: color 0.3s, border-bottom 0.3s;
    white-space: nowrap;
}

nav a.active,
nav a:hover {
    color: #fff;
    border-bottom: 2px solid #007acc;
}

/* DB Status indicator */
.db-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.status-ok {
    background-color: #28a745;
    box-shadow: 0 0 8px #28a745;
    color: #28a745 !important;
}

.status-error {
    background-color: #dc3545;
    box-shadow: 0 0 8px #dc3545;
    color: #dc3545 !important;
}

.status-disconnected {
    color: #d3d3d3 !important;
}

.status-warning {
    color: #ffa500 !important;
}

/* Main content area */
main {
    padding: 20px 20px 0px 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.content {
    width: 100%;
}

.table-container {
    margin-bottom: 20px;
}

.long-scrollable-table {
    max-height: calc(100vh - 78px);
    overflow-y: auto;
    border: 0px solid #333;
}

.long-scrollable-table table thead {
    font-size: 14px;
}

.long-scrollable-table table tbody {
    font-size: 13px;
}

.long-scrollable-table table tfoot {
    font-size: 13px;
    font-weight: bold;
}

.scrollable-table {
    margin-bottom: 0px;
    max-height: 30vh;
    overflow-y: auto;
    border-radius: 4px;
    border: 1px solid #333;
}

h2 {
    font-weight: 300;
    font-size: 20px;
    margin-bottom: 20px;
    margin-top: 0;
    color: #fff;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
}

h3 {
    font-weight: 400;
    font-size: 18px;
    margin-bottom: 20px;
    color: #fff;
}

/* Table styles - complement Bootstrap */
table {
    background-color: #1c1c1c;
    color: #e0e0e0;
}

/* Interactive table row styles */
.line-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.agv-row.hidden {
    display: none;
}

/* Reports page filter form */
.filters {
    background-color: #1c1c1c;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
    border: 1px solid #333;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    align-items: end;
}

/* Table wrapper for scrolling */
.table-wrapper {
    max-height: 60vh;
    overflow-y: auto;
    border-radius: 4px;
    border: 1px solid #333;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    /* Mobile header adjustments */
    header {
        flex-direction: column;
        gap: 10px;
        padding: 10px !important;
    }

    .logo {
        gap: 8px;
    }

    .logo img {
        height: 30px;
    }

    .logo-text h1 {
        font-size: 14px;
    }

    .logo-text p {
        font-size: 10px;
    }

    nav {
        font-size: 11px;
        flex-direction: column;
        gap: 5px;
        width: 100%;
    }

    nav a {
        margin: 0;
        font-size: 11px;
        padding: 5px 0;
        display: block;
        text-align: center;
    }

    .db-status {
        width: 100%;
        justify-content: center;
    }

    /* Main content adjustments */
    main {
        padding: 10px !important;
    }

    h2 {
        font-size: 14px;
    }

    h3 {
        font-size: 14px;
    }

    .scrollable-table {
        max-height: 25vh;
    }

    .table-wrapper {
        max-height: 45vh;
    }

    .filters {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 15px;
    }

    .filters select,
    .filters input {
        font-size: 13px;
    }

    /* Hide export button on very small screens */
    #export-btn {
        width: 100%;
    }
}

@media (max-width: 768px) {
    header {
        padding: 10px 15px !important;
        flex-wrap: wrap;
    }

    .logo {
        gap: 10px;
    }

    .logo img {
        height: 35px;
    }

    .logo-text h1 {
        font-size: 16px;
    }

    .logo-text p {
        font-size: 11px;
    }

    nav {
        margin: 5px 0;
        font-size: 12px;
    }

    nav a {
        margin: 0 8px;
        font-size: 12px;
    }

    main {
        padding: 15px !important;
    }

    .filters {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 10px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    main {
        padding: 20px !important;
    }

    .filters {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .scrollable-table {
        max-height: 40vh;
    }

    .table-wrapper {
        max-height: 60vh;
    }
}

@media (min-width: 1025px) {
    main {
        padding: 30px 30px 0px 50px !important;
    }

    .filters {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

/* Dark theme adjustments for readability */
a {
    color: #007acc;
}

a:hover {
    color: #0099cc;
}

/* Print styles */
@media print {
    header,
    nav {
        display: none;
    }

    body {
        background-color: #fff;
        color: #000;
    }

    table {
        background-color: #fff;
        color: #000;
    }

    table th {
        background-color: #f5f5f5;
        color: #000;
    }
}
