/* SAN-DASH Industrial Production Dashboard
 * Sober, high-contrast industrial design
 */

/* ===== CSS Variables ===== */
:root {
    --bg-dark: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-input: #252540;
    --text-primary: #ffffff;
    --text-secondary: #a8a8b8;
    --text-muted: #6b6b80;
    --accent-primary: #00d4aa;
    --accent-secondary: #ff6b35;
    --accent-warning: #ffc107;
    --accent-danger: #dc3545;
    --border-color: #2d2d45;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', 'Roboto', 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-secondary);
}

/* ===== Typography ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    margin-bottom: 1rem;
}

.text-accent {
    color: var(--accent-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-muted);
}

.text-warning {
    color: var(--accent-warning);
}

.text-danger {
    color: var(--accent-danger);
}

/* ===== Layout ===== */
.container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
}

.main-content {
    padding: 2rem 0;
}

/* ===== Navigation ===== */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.navbar-brand .icon {
    font-size: 2rem;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.navbar-menu a {
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.navbar-menu a:hover,
.navbar-menu a.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
}

.user-info .role-badge {
    background: var(--accent-primary);
    color: var(--bg-dark);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.card-body {
    padding: 1.5rem;
}

/* ===== Stats Cards (Dashboard) ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.stat-card.total::before {
    background: var(--accent-primary);
}

.stat-card.produced::before {
    background: var(--accent-secondary);
}

.stat-card.remaining::before {
    background: var(--accent-warning);
}

.stat-card.progress::before {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value.accent {
    color: var(--accent-primary);
}

.stat-value.warning {
    color: var(--accent-warning);
}

.stat-value.secondary {
    color: var(--accent-secondary);
}

.stat-value.warning,
.stat-value.accent {
    font-size: 2.0rem;
}

/* ===== Progress Bar ===== */
.progress-container {
    margin-top: 1rem;
}

.progress-bar {
    height: 12px;
    background: var(--bg-input);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 6px;
    transition: width 0.5s ease;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.2);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a8a8b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 10.5l-5-5h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #00a88a);
    color: var(--bg-dark);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 212, 170, 0.4);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-danger {
    background: var(--accent-danger);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

/* ===== Tables ===== */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--bg-input);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* ===== Alerts ===== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: rgba(0, 212, 170, 0.15);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
}

.alert-danger {
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid var(--accent-danger);
    color: var(--accent-danger);
}

.alert-warning {
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid var(--accent-warning);
    color: var(--accent-warning);
}

/* ===== Dashboard Specific ===== */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.contract-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.contract-selector select {
    min-width: 250px;
}

.datetime-display {
    text-align: right;
}

.datetime-display .date {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.datetime-display .time {
    font-family: 'Roboto Mono', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

/* ===== Chart Container ===== */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.chart-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-legend {
    display: flex;
    gap: 1.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.po {
    background: var(--accent-primary);
}

.legend-dot.pri {
    background: var(--accent-secondary);
}

/* ===== Last Entry ===== */
.last-entry {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.last-entry-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.last-entry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.entry-item {
    text-align: center;
    padding: 1rem;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

.entry-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.entry-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0.25rem;
}

.entry-value.highlight-po {
    color: var(--accent-primary);
}

.entry-value.highlight-pri {
    color: var(--accent-secondary);
}

/* ===== Login Page ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.login-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
    }

    .navbar-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .datetime-display .time {
        font-size: 1.75rem;
    }
}

/* ===== Dashboard Fullscreen Mode ===== */
/* Fullscreen Toggle Button */
.fullscreen-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9998;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 212, 170, 0.4);
    transition: var(--transition);
}

.fullscreen-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(0, 212, 170, 0.6);
}

.fullscreen-btn .icon {
    font-size: 1.25rem;
}

/* Hide button in actual fullscreen */
body.is-fullscreen .fullscreen-btn {
    display: none;
}

/* Exit Fullscreen Button */
.exit-fullscreen-btn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10001;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.exit-fullscreen-btn:hover {
    background: var(--accent-danger);
}

body.is-fullscreen .exit-fullscreen-btn {
    display: flex;
}

/* Fullscreen Container */
.dashboard-fullscreen-container {
    background: var(--bg-dark);
}

/* Hide navbar in fullscreen */
body.is-fullscreen .navbar {
    display: none !important;
}

/* Fullscreen main content adjustments */
body.is-fullscreen .main-content {
    padding: 1rem 2rem;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

body.is-fullscreen .container {
    max-width: 100%;
    padding: 0 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Fullscreen Dashboard Header */
body.is-fullscreen .dashboard-header {
    margin-bottom: 0.5rem;
}

body.is-fullscreen .contract-selector {
    display: none;
}

body.is-fullscreen .contract-info {
    flex: 2;
}

body.is-fullscreen .contract-info>div {
    font-size: 4rem !important;
}

body.is-fullscreen .datetime-display {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
    margin-right: 12rem;
    /* Avoid overlap with exit button */
}

body.is-fullscreen .datetime-display .date,
body.is-fullscreen .datetime-display .time {
    font-size: 2rem;
}

/* Fullscreen Stats Grid */
body.is-fullscreen .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

body.is-fullscreen .stat-card {
    padding: 0.5rem 0.75rem;
}

body.is-fullscreen .stat-label {
    font-size: 1rem;
    margin-bottom: 0.125rem;
}

body.is-fullscreen .stat-value {
    font-size: 5.0rem;
}

/* Fullscreen Bottom Section - Chart and PO/PRI side by side */
body.is-fullscreen .fullscreen-bottom-wrapper {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    flex: 1;
    min-height: 0;
    max-height: calc(100vh - 200px);
}

body.is-fullscreen .chart-container {
    flex: 2;
    margin-bottom: 0;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    padding-bottom: 0.5rem !important;
}

body.is-fullscreen .chart-container canvas {
    max-height: 100% !important;
}

body.is-fullscreen .chart-header {
    margin-bottom: 0.25rem;
    padding: 0.5rem;
}

body.is-fullscreen .chart-header h3 {
    font-size: 1.5rem;
    margin: 0;
}

/* Fullscreen Last Entry - Side panel */
body.is-fullscreen .last-entry {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1rem;
    min-width: 280px;
    max-width: 350px;
}

body.is-fullscreen .last-entry-header {
    margin-bottom: 0.5rem;
}

body.is-fullscreen .last-entry-header h3 {
    font-size: 1rem;
    margin: 0;
}

body.is-fullscreen .last-entry>div:nth-child(2) {
    flex-direction: column !important;
    gap: 0.5rem !important;
    padding: 0.5rem 0 !important;
    align-items: flex-start !important;
}

body.is-fullscreen .last-entry>div:nth-child(2)>div {
    gap: 0.5rem !important;
}

body.is-fullscreen .metrics-below-chart .metric-value {
    font-size: 8rem !important;
    font-family: 'Roboto Mono', monospace;
}

body.is-fullscreen .spec-label {
    font-size: 2.0rem !important;
    margin-bottom: 1rem !important;
}

body.is-fullscreen #specPoMin,
body.is-fullscreen #specPoMax,
body.is-fullscreen #specPriMin,
body.is-fullscreen #specPriMax {
    font-size: 8rem !important;
}

/* Metrics Below Chart - Base Styles */
.metrics-below-chart .metric-label {
    font-size: 1.5rem;
}

.metrics-below-chart .metric-value {
    font-size: 3rem;
}

.spec-label {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

/* Metrics Below Chart - Fullscreen Styles */
body.is-fullscreen .metrics-below-chart {
    gap: 3rem !important;
    padding: 0rem 1rem 0.5rem 1rem !important;
    margin-top: -0.5rem !important;
}

body.is-fullscreen .metrics-below-chart .metric-label {
    font-size: 2.5rem !important;
    line-height: 1 !important;
}

body.is-fullscreen .metrics-below-chart .metric-value {
    font-size: 8rem !important;
    line-height: 1 !important;
}

body.is-fullscreen .po0-label {
    font-size: 1.5rem !important;
}

body.is-fullscreen .last-entry>div:nth-child(2) span:first-child {
    font-size: 1.5rem !important;
}

/* ===== Animations ===== */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.updating {
    animation: pulse 1s ease-in-out infinite;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* ===== Checkbox Toggle ===== */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toggle-switch input[type="checkbox"] {
    width: 48px;
    height: 24px;
    appearance: none;
    background: var(--bg-input);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.toggle-switch input[type="checkbox"]::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--text-secondary);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: var(--transition);
}

.toggle-switch input[type="checkbox"]:checked {
    background: var(--accent-primary);
}

.toggle-switch input[type="checkbox"]:checked::after {
    left: 26px;
    background: white;
}

/* ===== Updated Dashboard Layout (Normal Mode) ===== */
.fullscreen-bottom-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.chart-container {
    flex: 2;
    min-width: 600px;
    margin-bottom: 0;
}

.last-entry {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
}

/* Ensure mobile responsiveness */
@media (max-width: 992px) {
    .fullscreen-bottom-wrapper {
        flex-direction: column;
    }

    .chart-container,
    .last-entry {
        width: 100%;
        min-width: 0;
    }
}

/* ===== Final Adjustment for Fullscreen Fonts ===== */
body.is-fullscreen .stat-label {
    font-size: 2rem !important;
    margin-bottom: 0.5rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
}

body.is-fullscreen .stat-value {
    font-size: 6rem !important;
}

body.is-fullscreen #cardPalette,
body.is-fullscreen #cardPanier {
    font-size: 3rem !important;
}

/* ===== Enhanced Standard Dashboard Fonts ===== */
.stat-label {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 3.5rem;
}

#lastPo,
#lastPri {
    font-size: 5rem;
}

/* ===== PO/PRI Labels ===== */
.po-pri-label {
    font-size: 5rem;
    font-weight: 700;
    text-transform: uppercase;
}

.po-pri-label.po {
    color: var(--accent-primary);
}

.po-pri-label.pri {
    color: var(--accent-secondary);
}

/* Fullscreen Override - Huge Labels */
body.is-fullscreen .po-pri-label {
    font-size: 6rem !important;
}

/* ===== PO/PRI Label Sizes ===== */
.po-label,
.pri-label {
    font-size: 3rem;
    font-weight: 700;
}

body.is-fullscreen .po-label,
body.is-fullscreen .pri-label {
    font-size: 6rem !important;
}

/* ===== Responsive Table (Mobile Card View) ===== */
@media screen and (max-width: 768px) {
    .table-responsive {
        border: 0;
    }

    .table-container table {
        border: 0;
    }

    .table-container thead {
        display: none;
    }

    .table-container tr {
        display: block;
        margin-bottom: 1.5rem;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
        padding: 1rem;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    }

    .table-container td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid var(--border-color);
        padding: 0.75rem 0;
        text-align: right;
    }

    .table-container td:last-child {
        border-bottom: 0;
    }

    .table-container td::before {
        content: attr(data-label);
        font-weight: 600;
        text-transform: uppercase;
        font-size: 0.75rem;
        color: var(--text-secondary);
        margin-right: 1rem;
        text-align: left;
    }
}

/* ===== Mobile Navbar ===== */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
}

@media screen and (max-width: 992px) {
    .navbar .container {
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
    }

    .hamburger-btn {
        display: block;
    }

    .navbar-menu,
    .user-info {
        width: 100%;
        display: none;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        margin-top: 1rem;
        border-top: 1px solid var(--border-color);
    }

    .navbar-menu.active,
    .user-info.active {
        display: flex;
    }

    .navbar-menu li {
        width: 100%;
    }

    .navbar-menu a {
        display: block;
        padding: 1rem 0;
        border-bottom: 1px solid var(--border-color);
    }

    .user-info {
        flex-direction: row;
        justify-content: space-between;
        margin-top: 0;
        padding-top: 1rem;
        border-bottom: 1px solid var(--border-color);
    }
}


/* ===== Improved Mobile Navbar Animations ===== */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.hamburger-btn .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    -webkit-transition: all 0.3s ease-in-out;
    transition: all 0.3s ease-in-out;
    background-color: var(--text-primary);
    border-radius: 2px;
}

.hamburger-btn.active .bar:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger-btn.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

@media screen and (max-width: 992px) {

    .navbar-menu,
    .user-info {
        width: 100%;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.4s ease-out, opacity 0.3s ease-out;
        display: flex;
        /* Keep flex context but hide via max-height */
    }

    .navbar-menu.active,
    .user-info.active {
        max-height: 500px;
        /* Arbitrary large height */
        opacity: 1;
        display: flex;
    }

    .navbar-menu a {
        padding: 1rem 1.5rem;

        /* More breathing room */
        &:hover {
            background-color: rgba(255, 255, 255, 0.05);
            border-left: 3px solid var(--accent-primary);
        }
    }
}


@media screen and (max-width: 992px) {
    .hamburger-btn {
        display: block;
    }
}

/* ===== Fix Mobile Navbar Height & Layout ===== */
@media screen and (max-width: 992px) {
    .navbar {
        padding: 0.5rem 0;
        /* Reduced padding */
    }

    .navbar .container {
        display: flex;
        flex-direction: row;
        /* Force row for brand + button */
        flex-wrap: wrap;
        /* Allow menu to wrap below */
        justify-content: space-between;
        align-items: center;
    }

    .navbar-brand {
        font-size: 1.25rem;
        /* Smaller font */
        margin-right: auto;
    }

    .hamburger-btn {
        margin-left: auto;
        padding: 0.25rem 0.5rem;
        /* Smaller button padding */
    }

    .navbar-menu,
    .user-info {
        flex-basis: 100%;
        /* Force menu to take full width when open */
    }
}

/* ===== Super Slim Mobile Navbar ===== */
@media screen and (max-width: 992px) {
    .navbar {
        padding: 0.25rem 0 !important;
        /* Aggressive reduction */
        min-height: auto !important;
    }

    .navbar .container {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .navbar-brand {
        margin: 0 !important;
        padding: 0 !important;
        height: 40px;
        display: flex;
        align-items: center;
    }

    .hamburger-btn {
        margin: 0 !important;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Adjust menu top margin to sit flush */
    .navbar-menu {
        margin-top: 0.25rem !important;
    }
}

/* ===== Super Size Fullscreen PO/PRI ===== */
/* ===== Super Size Fullscreen PO/PRI (Main Panel) ===== */
body.is-fullscreen .po-label,
body.is-fullscreen .pri-label {
    font-size: 4rem !important;
}

body.is-fullscreen #lastPo,
body.is-fullscreen #lastPri {
    font-size: 13rem !important;
    line-height: 1.1;
}

/* Old PO0 Below Chart Fullscreen block removed */

/* ===== Dropdown Menu ===== */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    list-style: none;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    border-radius: 0;
}

.dropdown-menu li a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* Mobile adjust for dropdown */
@media (max-width: 768px) {
    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        background: transparent;
        opacity: 1;
        visibility: visible;
        transform: none;
        padding-left: 1rem;
        display: none;
    }

    .dropdown.active .dropdown-menu {
        display: flex;
    }
}