*, *::before, *::after {
  box-sizing: border-box;
}

:root {
    /* Apple System Colors - Dark Mode Default */
    --system-background: #000000;
    --system-secondary-background: #1c1c1e;
    --system-tertiary-background: #2c2c2e;
    --system-grouped-background: #000000;
    --system-secondary-grouped-background: #1c1c1e;
    --system-separator: rgba(84, 84, 88, 0.65);

    --system-label: #FFFFFF;
    --system-secondary-label: rgba(235, 235, 245, 0.6);
    --system-tertiary-label: rgba(235, 235, 245, 0.3);

    --system-blue: #0A84FF;
    --system-green: #30D158;
    --system-indigo: #5E5CE6;
    --system-orange: #FF9F0A;
    --system-pink: #FF375F;
    --system-purple: #BF5AF2;
    --system-red: #FF453A;
    --system-teal: #64D2FF;
    --system-yellow: #FFD60A;

    /* Mapped Variables for Compatibility */
    --grafana-dark-bg: var(--system-background);
    --grafana-panel-bg: rgba(28, 28, 30, 0.7); /* Translucent */
    --grafana-border: rgba(84, 84, 88, 0.4);
    --grafana-text-primary: var(--system-label);
    --grafana-text-secondary: var(--system-secondary-label);
    --grafana-accent-blue: var(--system-blue);
    --grafana-accent-green: var(--system-green);
    --grafana-input-bg: rgba(118, 118, 128, 0.24);

    --board-light-square: #E3E3E3;
    --board-dark-square: #6B6B6B;
    --board-selected-square: rgba(10, 132, 255, 0.6);
    --board-last-move-square: rgba(48, 209, 88, 0.6);

    --radius-l: 12px;
    --radius-m: 10px;
    --radius-s: 8px;

    --shadow-depth: 0 4px 20px rgba(0,0,0,0.3);
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: var(--system-background);
    color: var(--system-label);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* Background gradient for depth */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000000 100%);
    z-index: -1;
}

.container {
    height: 100%;
    width: 100%;
    max-width: none;
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 16px;
    padding-top: 50px; /* Space for top toolbar/toggle */
    overflow: hidden;
    gap: 16px;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--system-blue);
    font-size: 24px;
    cursor: pointer;
    position: absolute;
    top: 8px;
    left: 16px;
    z-index: 200;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    transition: background 0.2s;
}

.sidebar-toggle:hover {
    background: rgba(118, 118, 128, 0.12);
}

#dashboard {
    display: flex;
    gap: 16px;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    flex-grow: 1;
    height: 100%;
    overflow: hidden;
}

/* Sidebar Collapsed State */
.sidebar-collapsed .sidebar {
    width: 0;
    padding: 0;
    opacity: 0;
    margin-right: -16px; /* Offset gap */
    pointer-events: none;
}

.chessboard-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    background: transparent !important; /* Board floats */
    border: none !important;
    padding: 0 !important;
}

.sidebar {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    padding-right: 4px; /* Scrollbar space */
    flex-shrink: 0;
    height: 100%;
    transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s;
}

/* Scrollbar styling */
.sidebar::-webkit-scrollbar,
.panel-content::-webkit-scrollbar,
#move-history::-webkit-scrollbar {
    width: 8px;
}
.sidebar::-webkit-scrollbar-track,
.panel-content::-webkit-scrollbar-track,
#move-history::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb,
.panel-content::-webkit-scrollbar-thumb,
#move-history::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.panel {
    background-color: var(--grafana-panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-l);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    overflow: hidden;
    max-width: 100%;
}

.panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--grafana-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
}

.panel-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--system-blue);
    font-size: 17px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(10, 132, 255, 0.1);
}

.panel-content {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Board Layout */
.board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    width: 100%;
    height: 100%;
    max-width: var(--board-max-width, 100%);
    margin: 0 auto;
    flex-grow: 1;
    min-height: 0;
    overflow: hidden;
    container-type: size;
}

#eval-bar-container {
    width: 12px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 6px;
    position: relative;
    display: flex;
    flex-direction: column-reverse;
    overflow: hidden;
    height: 100%;
    max-height: 100%;
}

#eval-bar-fill {
    width: 100%;
    background-color: var(--system-label);
    height: 50%;
    transition: height 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.board-wrapper {
    position: relative;
    aspect-ratio: 1 / 1;
    display: flex;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    box-shadow: var(--shadow-depth);
    border-radius: 4px;
}

@container (min-aspect-ratio: 1/1) {
  .board-wrapper {
    height: 100%;
    width: 100cqh;
  }
}
@container (max-aspect-ratio: 1/1) {
  .board-wrapper {
    width: 100%;
    height: 100cqw;
  }
}

#chessboard {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  user-select: none;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  overflow: hidden;
}

.square {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.square .coordinate {
    position: absolute;
    font-size: 10px;
    font-weight: 700;
    pointer-events: none;
    z-index: 5;
    line-height: 1;
}

.square .coordinate.file {
    bottom: 1px;
    right: 2px;
}

.square .coordinate.rank {
    top: 2px;
    left: 2px;
}

.square.white .coordinate { color: var(--board-dark-square); }
.square.black .coordinate { color: var(--board-light-square); }

.legal-move-hint::after {
    content: '';
    position: absolute;
    width: 24%;
    height: 24%;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    pointer-events: none;
}
.white .legal-move-hint::after { background-color: rgba(0, 0, 0, 0.15); }
.black .legal-move-hint::after { background-color: rgba(0, 0, 0, 0.25); }


.legal-move-hint.capture-hint::after {
    width: 80%;
    height: 80%;
    background: transparent;
    border: 5px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    box-sizing: border-box;
}

.piece {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
}

.white {
  background-color: var(--board-light-square);
  color: var(--board-dark-square);
}

.black {
  background-color: var(--board-dark-square);
  color: var(--board-light-square);
}

.selected {
    background-color: var(--board-selected-square) !important;
}

.last-move {
    background-color: var(--board-last-move-square) !important;
}

/* Controls */
.button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

button {
    flex-grow: 1;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background-color: rgba(118, 118, 128, 0.24);
    color: var(--system-blue);
    border: none;
    border-radius: 8px;
    transition: all 0.2s;
    min-height: 32px;
}

button:active {
    background-color: rgba(118, 118, 128, 0.35);
    transform: scale(0.98);
}

/* Primary Button Style (Blue filled) */
button#new-game-btn,
button.primary-btn {
    background-color: var(--system-blue);
    color: white;
}
button#new-game-btn:active {
    background-color: #0060df;
}

/* Destructive Actions */
button#resign-btn,
button#stop-tournament-btn,
button#factory-reset-btn {
    color: var(--system-red);
    background-color: rgba(255, 69, 58, 0.25);
}

.btn-danger {
    background-color: #F2495C !important;
    color: white !important;
}
.btn-danger:active {
    background-color: #D43F4F !important;
}

button#resign-btn:active {
    background-color: rgba(255, 69, 58, 0.35);
}

#status {
    padding: 10px;
    background-color: rgba(255,255,255,0.05);
    border-radius: 8px;
    margin-bottom: 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--system-secondary-label);
}

#engine-output, #system-log, #packet-log {
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 11px;
    border-radius: 8px;
    background-color: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--system-secondary-label);
    padding: 10px;
    white-space: pre-wrap;
    height: 150px;
    overflow-y: auto;
    overflow-x: hidden;
}

.debug-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #30D158; /* system-green */
    padding: 8px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    pointer-events: none;
    z-index: 100;
    border: 1px solid rgba(255,255,255,0.2);
}

#uci-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.option-group {
    border: none;
    padding: 0;
    margin: 0;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    overflow: hidden;
}

.option-group legend {
    color: var(--system-secondary-label);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 10px 16px 5px;
    width: 100%;
    background: transparent;
}

.separator {
    border: 0;
    border-top: 1px solid var(--system-separator);
    margin: 16px 0;
    opacity: 0.3;
}

.option-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    margin-bottom: 0;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: rgba(255,255,255,0.03);
    max-width: 100%;
}

.option-group .option-item:last-child {
    border-bottom: none;
}
.option-group .option-item:first-of-type {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.option-item label {
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
    white-space: nowrap;
}

/* Form Controls */
.option-item input[type="number"],
.option-item input[type="text"],
.option-item select,
.option-item textarea {
    padding: 6px 10px;
    background-color: rgba(118, 118, 128, 0.24);
    border: none;
    color: var(--system-label);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    flex-shrink: 0;
    max-width: 50%;
}

.option-item input:focus, .option-item select:focus {
    box-shadow: 0 0 0 2px var(--system-blue);
}

.option-item select option {
    background-color: var(--system-secondary-grouped-background);
    color: var(--system-label);
}

/* Switch Toggle Style for Checkboxes */
.option-item input[type="checkbox"] {
    appearance: none;
    width: 36px;
    height: 20px;
    background: rgba(120, 120, 128, 0.32);
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    outline: none;
    transition: background 0.25s;
    flex-shrink: 0;
}

.option-item input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.25s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.option-item input[type="checkbox"]:checked {
    background: var(--system-green);
}

.option-item input[type="checkbox"]:checked::after {
    transform: translateX(16px);
}

/* Sliders */
input[type="range"] {
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: rgba(118, 118, 128, 0.5);
    border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    -webkit-appearance: none;
    margin-top: -8px;
}


/* Search Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.stat-card {
    background-color: rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-label {
    font-size: 11px;
    color: var(--system-secondary-label);
    margin-bottom: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--system-label);
    font-feature-settings: "tnum";
}

.pv-container {
    background-color: rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
}

/* Graphs */
.graph-container {
    width: 100%;
    height: 200px;
    background-color: rgba(255,255,255,0.05);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* Move History */
.move-history-list {
    background-color: transparent;
    border: none;
    padding: 0;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.move-number {
    color: var(--system-secondary-label);
    padding: 6px 4px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 12px;
}

.move-san {
    cursor: pointer;
    padding: 6px 8px;
    color: var(--system-label);
    border-radius: 4px;
    transition: background 0.1s;
}

.move-san:hover {
    background-color: rgba(255,255,255,0.1);
}

.move-san.active {
    background-color: var(--system-blue);
    color: white;
    font-weight: 600;
}

/* Player Info */
.player-info {
    display: grid;
    grid-template-areas: "avatar details bar captured clock";
    grid-template-columns: auto 1fr auto auto auto;
    align-items: center;
    padding: 8px 0;
    background-color: transparent;
    gap: 12px;
    margin-bottom: 10px;
}

.player-avatar {
    grid-area: avatar;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.player-details {
    grid-area: details;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.material-bar-container {
    grid-area: bar;
}

.player-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--system-label);
}

.material-diff {
    font-size: 13px;
    color: var(--system-secondary-label);
}

.captured-pieces {
    grid-area: captured;
    background-color: rgba(118, 118, 128, 0.24);
    border-radius: 6px;
    padding: 2px 4px;
    min-height: 24px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.clock {
    grid-area: clock;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: 22px;
    font-weight: 500;
    color: var(--system-label);
    background-color: rgba(0,0,0,0.2);
    padding: 8px 12px;
    border-radius: 8px;
    min-width: 90px;
    text-align: center;
    font-feature-settings: "tnum";
}

.clock.active {
    background-color: rgba(10, 132, 255, 0.15);
    color: var(--system-blue);
}

.clock.low-time {
    color: var(--system-red);
    background-color: rgba(255, 69, 58, 0.1);
}

/* Tabs */
.tabs {
    display: flex;
    background: rgba(118, 118, 128, 0.24);
    padding: 2px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: none;
}

.tab-btn {
    flex: 1;
    padding: 6px 12px;
    background-color: transparent;
    color: var(--system-label);
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    text-align: center;
}

.tab-btn.active {
    background-color: rgba(99, 99, 102, 1); /* Apple Segmented Control Selected Gray */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    color: white;
}
.light-mode .tab-btn.active {
    background-color: white;
    color: black;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4); /* Dimming */
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background-color: rgba(28, 28, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    transform: scale(0.95);
    transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(84, 84, 88, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
}

.modal-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.modal-close-btn {
    background: rgba(118, 118, 128, 0.24);
    border: none;
    color: var(--system-label);
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s;
}

.modal-close-btn:hover {
    background: rgba(118, 118, 128, 0.4);
}

.modal-content {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(84, 84, 88, 0.3);
    background: transparent;
}

/* Light Mode */
body.light-mode {
    --system-background: #F2F2F7;
    --grafana-panel-bg: rgba(255, 255, 255, 0.8);
    --system-label: #000000;
    --system-secondary-label: #8A8A8E;
    --grafana-border: rgba(60, 60, 67, 0.18);
    --grafana-input-bg: rgba(118, 118, 128, 0.12);
    --board-light-square: #F0D9B5;
    --board-dark-square: #B58863;
}

body.light-mode::before {
    background: radial-gradient(circle at center, #ffffff 0%, #f2f2f7 100%);
}

body.light-mode .panel {
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

body.light-mode .clock {
    background-color: rgba(255,255,255,0.5);
}

/* Responsive */
@media (max-width: 768px) {
    .player-info {
        grid-template-areas:
            "avatar details clock"
            "captured captured captured";
        grid-template-columns: auto 1fr auto;
        row-gap: 8px;
        column-gap: 12px;
    }
    .material-bar-container {
        display: none;
    }

    html, body {
        height: auto;
        overflow: visible;
    }
    .container {
        padding: 10px;
        gap: 10px;
        overflow: visible;
        display: block;
    }
    #dashboard {
        flex-direction: column;
        overflow: visible;
    }
    .sidebar {
        width: 100%;
        height: auto;
        overflow: visible;
        margin-top: 20px;
    }
    .chessboard-panel {
        position: sticky;
        top: 0;
        z-index: 50;
        background: transparent;
    }
    /* Blur behind board on scroll */
    .chessboard-panel::before {
        content: '';
        position: absolute;
        inset: -10px;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(10px);
        z-index: -1;
        border-radius: 0 0 20px 20px;
        opacity: 0;
        transition: opacity 0.3s;
    }

    .board-container {
        container-type: normal;
        height: auto;
        overflow: visible;
    }

    .board-wrapper {
        max-height: 80vh;
        width: 100% !important;
        height: auto !important;
        max-width: 100%;
        aspect-ratio: 1/1;
    }
    .sidebar-toggle {
        font-size: 20px;
        top: 5px;
        left: 5px;
    }
}

/* Utility / Misc */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; }
.mt-10 { margin-top: 10px; }
.piece-set-pixel { image-rendering: pixelated; image-rendering: crisp-edges; }

/* Arrows & Highlights (Kept from original) */
#arrow-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }
.arrow { stroke-width: 1.5%; stroke-linecap: round; opacity: 0.7; }
.arrow-head { fill-opacity: 0.7; }
.arrow-best { stroke: var(--system-blue); fill: var(--system-blue); }
.arrow-ponder { stroke: var(--system-green); fill: var(--system-green); }
.arrow-threat { stroke: var(--system-red); fill: var(--system-red); }
.arrow-last { stroke: var(--system-orange); fill: var(--system-orange); }
.check-highlight { background-image: radial-gradient(circle, rgba(255, 69, 58, 0.8) 0%, transparent 70%); }

/* Toast */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast { background-color: rgba(28, 28, 30, 0.9); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.1); color: white; padding: 12px 16px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); font-size: 14px; display: flex; align-items: center; min-width: 250px; animation: slideIn 0.3s ease-out forwards; }
.toast.error { border-left: 4px solid var(--system-red); }
.toast.success { border-left: 4px solid var(--system-green); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* Voice Indicator */
.voice-indicator {
    position: fixed;
    top: 70px; /* Below sidebar toggle and header area */
    right: 20px;
    background: rgba(255, 69, 58, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 69, 58, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 69, 58, 0); }
}

/* Zen Mode */
body.zen-mode #dashboard { justify-content: center; align-items: center; height: 100vh; }
body.zen-mode .sidebar, body.zen-mode .panel-header, body.zen-mode .sidebar-toggle { display: none; }
body.zen-mode .panel { background: transparent; border: none; box-shadow: none; backdrop-filter: none; }

.voice-indicator.hearing {
    background: var(--system-green);
    animation: pulse-green 1s infinite;
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(48, 209, 88, 0); }
    100% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0); }
}

#accessibility-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    font-size: 24px;
    background-color: var(--grafana-panel-bg);
    border: 1px solid var(--grafana-border);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

#accessibility-btn:hover {
    background-color: var(--grafana-input-bg);
}

@media (max-width: 768px) {
    #accessibility-btn {
        bottom: 10px;
        left: 10px;
    }
}
