:root {
    --bg-color: #02040a;
    /* Siyaha yakın lacivert */
    --sidebar-bg: rgba(10, 15, 30, 0.6);
    --card-bg: rgba(20, 25, 45, 0.4);
    --border-color: rgba(255, 255, 255, 0.08);
    --primary-gradient: linear-gradient(135deg, #0A84FF 0%, #0056D4 100%);
    /* Pars Mavisi tonları */
    --primary-glow: 0 0 20px rgba(10, 132, 255, 0.4);
    --text-main: #F5F5F7;
    --text-muted: #86868B;
    --danger-color: #FF453A;
    --success-color: #30D158;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 50% 0%, #0a1835 0%, var(--bg-color) 60%);
    color: var(--text-main);
    font-family: "Inter", var(--font-stack);
    height: 100vh;
    overflow: hidden;
    display: flex;
    -webkit-font-smoothing: antialiased;
}

/* Sidebar Style */
.sidebar {
    width: 280px;
    height: 100%;
    background: var(--sidebar-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.sidebar.collapsed {
    width: 80px;
    padding: 24px 12px;
}

.sidebar-toggle-btn {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
}

.sidebar.collapsed .sidebar-toggle-btn svg {
    transform: rotate(180deg);
}

/* Clean up old collapsed handling */

.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 40px;
    text-align: center;
}

.brand-logo {
    width: 100px;
    height: auto;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 15px rgba(10, 132, 255, 0.3));
}

.brand-text {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.brand-main {
    font-weight: 800;
    font-size: 16px;
    background: linear-gradient(to right, #ffffff, #e0e0e0);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.brand-sub {
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 2px;
    color: var(--primary-color);
    text-transform: uppercase;
    background: linear-gradient(to right, #0A84FF, #5CABFF);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 4px;
    opacity: 0.9;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-menu-btn {
    display: none;
    /* Hidden on Desktop */
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 8px;
}

.nav-item {
    position: relative;
}

/* Adjust Nav Link for Icons */
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 12px;
    transition: all 0.3s ease;
    white-space: nowrap;
    /* Prevent text wrapping when collapsing */
    overflow: hidden;
}

.nav-link svg {
    min-width: 20px;
    /* Ensure icon doesn't shrink */
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-link.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--primary-glow);
    font-weight: 600;
}

/* Collapsed State Handling */
.sidebar.collapsed .brand-text {
    display: none;
}

.sidebar.collapsed .brand-logo {
    width: 32px;
    margin-bottom: 0;
}

.sidebar.collapsed .nav-link span {
    opacity: 0;
    width: 0;
    margin-left: 0;
    pointer-events: none;
}

.sidebar.collapsed .nav-link {
    padding: 12px;
    /* Reduce padding for icon-only look */
    justify-content: center;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    position: relative;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 0 10px rgba(10, 132, 255, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 0 20px rgba(10, 132, 255, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary.recording-active {
    background: rgba(255, 69, 58, 0.2);
    color: #FF453A;
    border-color: rgba(255, 69, 58, 0.4);
    box-shadow: 0 0 15px rgba(255, 69, 58, 0.3);
    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);
    }
}

/* File Select Dropdown */
.file-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    min-width: 220px;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2386868B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.file-select:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.file-select:focus {
    outline: none;
    border-color: rgba(10, 132, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2);
}

.file-select option {
    background: #1a1a2e;
    color: var(--text-main);
}

/* Settings Styles */
.settings-container {
    padding: 20px;
}

.settings-grid-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1fr;
    gap: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
}

.settings-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 12px;
    align-items: center;
}

.settings-label {
    font-size: 14px;
    color: var(--text-main);
}

.settings-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-main);
    font-size: 13px;
    transition: all 0.2s ease;
}

.settings-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: rgba(255, 255, 255, 0.08);
}

.settings-actions {
    margin-top: 25px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.settings-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-main);
    font-size: 13px;
    cursor: pointer;
}

.settings-select option {
    background: #1a1a2e;
}

/* Tank Pressure Bar */
.chart-container-flex {
    display: flex;
    gap: 16px;
    height: 100%;
    align-items: stretch;
}

.tank-pressure-bar {
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

.bar-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bar-wrapper {
    flex: 1;
    width: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}

.bar-fill {
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, #0A84FF, #30D158);
    border-radius: 20px;
    transition: height 0.3s ease;
    box-shadow: 0 0 20px rgba(10, 132, 255, 0.6);
}

.bar-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.chart-flex {
    flex: 1;
}

/* Fullscreen Button */
.chart-container {
    position: relative;
}

.title-with-btn {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.header-icon-btn:hover {
    background: rgba(10, 132, 255, 0.1);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Modal Content */
.modal-content {
    width: 90%;
    height: 90%;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal Header */
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 59, 48, 0.2);
    color: #FF3B30;
    border-color: #FF3B30;
}

/* Modal Chart */
.modal-chart {
    flex: 1;
    padding: 24px;
    overflow: hidden;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(48, 209, 88, 0.1);
    color: var(--success-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(48, 209, 88, 0.2);
}

.time-badge {
    background: rgba(10, 132, 255, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(10, 132, 255, 0.2);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    /* Monospace numbers for time */
    margin-right: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success-color);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.status-badge.disconnected {
    background: rgba(255, 69, 58, 0.1);
    color: var(--danger-color);
    border-color: rgba(255, 69, 58, 0.2);
}

.status-badge.disconnected .status-dot {
    background-color: var(--danger-color);
    box-shadow: 0 0 10px var(--danger-color);
    animation: none;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    height: calc(100vh - 120px);
    grid-template-rows: repeat(2, 1fr);
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Added to keep children contained */
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.max-value-container {
    display: flex;
    gap: 12px;
    font-size: 12px;
}

.max-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.max-label {
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
}

.max-number {
    color: var(--text-main);
    font-weight: 700;
    font-feature-settings: "tnum";
}

.chart-container {
    flex: 1;
    width: 100%;
    min-height: 0;
    position: relative;
}

/* Section Management */
.section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        flex-direction: column;
        height: auto;
        overflow-y: auto;
        padding-bottom: 20px;
    }

    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 16px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg-color);
        /* Ensure opacity */
    }

    .brand {
        flex-direction: row;
        margin-bottom: 0;
        gap: 12px;
        text-align: left;
    }

    .brand-logo {
        width: 40px;
        margin-bottom: 0;
    }

    .brand-title {
        font-size: 14px;
        line-height: 1.2;
    }

    /* Show only active tab or a simplified menu on mobile? 
       For now, let's make the nav horizontal scrollable */
    /* Mobile Menu styles */
    .mobile-menu-btn {
        display: block;
        /* Visible ONLY on mobile */
    }

    .nav-menu {
        display: none;
        /* Hidden by default on mobile */
        width: 100%;
        flex-direction: column;
        position: absolute;
        top: 100%;
        /* Below header */
        left: 0;
        background: var(--sidebar-bg);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        padding: 16px;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    }

    .nav-menu.open {
        display: flex;
        animation: slideDown 0.3s ease;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .main-content {
        padding: 16px;
        height: auto;
        overflow: visible;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        /* Reset fixed rows */
        height: auto;
        gap: 16px;
        display: flex;
        flex-direction: column;
    }

    .card {
        min-height: 300px;
        /* Ensure charts have height on mobile */
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 24px;
    }
}

/* ========== FILE SELECTOR MODAL STYLES ========== */

.file-selector-content {
    width: 800px;
    max-width: 95vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.file-selector-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0 24px 24px 24px;
}

.file-filter-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.search-bar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
}

.search-bar svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 15px;
    font-family: inherit;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.date-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 14px;
}

.date-filter svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.date-filter input[type="date"] {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    min-width: 140px;
}

.date-filter input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    opacity: 0.6;
}

.date-filter input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.date-clear-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.date-clear-btn:hover {
    background: rgba(255, 69, 58, 0.15);
    color: #FF453A;
}

.file-table-container {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.file-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(20, 25, 45, 0.95);
    backdrop-filter: blur(10px);
}

.file-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.file-table th:hover {
    color: var(--text-main);
}

.file-table th.sortable::after {
    content: ' ⇅';
    opacity: 0.4;
    font-size: 10px;
}

.file-table th.sort-asc::after {
    content: ' ▲';
    opacity: 1;
    color: #0A84FF;
}

.file-table th.sort-desc::after {
    content: ' ▼';
    opacity: 1;
    color: #0A84FF;
}

.file-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.file-table tbody tr {
    transition: background 0.15s ease;
}

.file-table tbody tr:hover {
    background: rgba(10, 132, 255, 0.08);
}

.file-table tbody tr:last-child td {
    border-bottom: none;
}

/* Column widths */
.file-table th:nth-child(1),
.file-table td:nth-child(1) {
    width: 140px;
}

.file-table th:nth-child(2),
.file-table td:nth-child(2) {
    width: auto;
}

.file-table th:nth-child(3),
.file-table td:nth-child(3) {
    width: 90px;
}

.file-table th:nth-child(4),
.file-table td:nth-child(4) {
    width: 80px;
    text-align: right;
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success {
    background: rgba(48, 209, 88, 0.15);
    color: #30D158;
    border: 1px solid rgba(48, 209, 88, 0.3);
}

.badge-warning {
    background: rgba(255, 159, 10, 0.15);
    color: #FF9F0A;
    border: 1px solid rgba(255, 159, 10, 0.3);
}

/* Small button variant */
.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 6px;
}

/* Action buttons in file table */
.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-action-select {
    background: rgba(48, 209, 88, 0.15);
    color: #30D158;
    border: 1px solid rgba(48, 209, 88, 0.3);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-action-select:hover {
    background: rgba(48, 209, 88, 0.25);
    border-color: #30D158;
}

.btn-action-download {
    background: rgba(10, 132, 255, 0.15);
    color: #0A84FF;
    border: 1px solid rgba(10, 132, 255, 0.3);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-action-download:hover {
    background: rgba(10, 132, 255, 0.25);
    border-color: #0A84FF;
}

/* Download Modal */
.download-modal-content {
    width: 500px;
    max-width: 95vw;
}

.download-modal-body {
    padding: 0 24px 24px 24px;
}

.download-filename {
    font-family: monospace;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 14px;
}

.format-options {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.format-option {
    flex: 1;
    cursor: pointer;
}

.format-option input {
    display: none;
}

.format-card {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s ease;
}

.format-option:hover .format-card {
    border-color: rgba(255, 255, 255, 0.15);
}

.format-option input:checked+.format-card {
    border-color: #0A84FF;
    background: rgba(10, 132, 255, 0.1);
}

.format-name {
    display: block;
    font-weight: 600;
    font-size: 16px;
    color: var(--text-main);
    margin-bottom: 4px;
}

.format-desc {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.data-type-toggle {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    margin-bottom: 20px;
}

.data-type-toggle>span:first-child {
    font-weight: 500;
    color: var(--text-muted);
}

.toggle-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.toggle-option input {
    accent-color: #0A84FF;
}

.toggle-option span {
    color: var(--text-main);
    font-size: 14px;
}

.download-actions {
    display: flex;
    gap: 12px;
}

.download-actions .btn {
    flex: 1;
    justify-content: center;
}

/* Stats cells in file table */
.stat-cell {
    text-align: center;
}

.stat-value {
    font-weight: 600;
    color: var(--text-main);
    font-size: 14px;
}

.stat-unit {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 2px;
}

/* Wider file selector for more columns */
.file-selector-content {
    width: 1400px;
    max-width: 98vw;
}

/* Updated column widths for extended table */
.file-table th:nth-child(1),
.file-table td:nth-child(1) {
    width: 85px;
}

/* Stats columns - compact */
.file-table th:nth-child(2),
.file-table td:nth-child(2),
.file-table th:nth-child(3),
.file-table td:nth-child(3),
.file-table th:nth-child(4),
.file-table td:nth-child(4),
.file-table th:nth-child(5),
.file-table td:nth-child(5),
.file-table th:nth-child(6),
.file-table td:nth-child(6),
.file-table th:nth-child(7),
.file-table td:nth-child(7),
.file-table th:nth-child(8),
.file-table td:nth-child(8),
.file-table th:nth-child(9),
.file-table td:nth-child(9),
.file-table th:nth-child(10),
.file-table td:nth-child(10) {
    width: 70px;
    text-align: center;
}

/* Action column */
.file-table th:nth-child(11),
.file-table td:nth-child(11) {
    width: 100px;
    text-align: right;
}

/* Settings action button */
.btn-action-settings {
    background: rgba(175, 82, 222, 0.15);
    color: #AF52DE;
    border: 1px solid rgba(175, 82, 222, 0.3);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-action-settings:hover {
    background: rgba(175, 82, 222, 0.25);
    border-color: #AF52DE;
}

/* Settings View Modal */
.settings-view-content {
    width: 600px;
    max-width: 95vw;
}

.settings-view-body {
    padding: 0 24px 24px 24px;
}

.settings-filename {
    font-family: monospace;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 13px;
}

.settings-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.settings-table th,
.settings-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.settings-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-table td {
    color: var(--text-main);
}

.settings-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.channel-badge {
    display: inline-block;
    background: rgba(10, 132, 255, 0.2);
    color: #0A84FF;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    font-weight: 600;
}

.settings-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.settings-empty svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.settings-empty p {
    margin: 0;
    line-height: 1.6;
}

.settings-meta {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Custom Chart Builder */
.custom-chart-builder {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-top: 20px;
    overflow: hidden;
}

.builder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    transition: background 0.2s;
}

.builder-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.builder-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text-main);
}

.builder-chevron {
    color: var(--text-muted);
    transition: transform 0.2s;
}

.builder-header.open .builder-chevron {
    transform: rotate(180deg);
}

.builder-content {
    padding: 0 18px 18px 18px;
    border-top: 1px solid var(--border-color);
}

.builder-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin: 14px 0;
}

.param-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.param-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    cursor: grab;
    transition: all 0.2s;
    user-select: none;
}

.param-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.param-chip:active {
    cursor: grabbing;
}

.param-chip.dragging {
    opacity: 0.5;
}

.param-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.drop-zone {
    min-height: 80px;
    background: rgba(255, 255, 255, 0.02);
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px;
    transition: all 0.2s;
    margin-bottom: 14px;
}

.drop-zone.drag-over {
    border-color: #0A84FF;
    background: rgba(10, 132, 255, 0.1);
}

.drop-zone-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

.drop-zone-placeholder svg {
    opacity: 0.4;
}

.drop-zone.has-items .drop-zone-placeholder {
    display: none;
}

.selected-params {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.selected-param {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(10, 132, 255, 0.15);
    border: 1px solid rgba(10, 132, 255, 0.3);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
}

.selected-param .remove-param {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    margin-left: 4px;
    transition: background 0.2s;
}

.selected-param .remove-param:hover {
    background: rgba(255, 69, 58, 0.3);
}

.selected-param .remove-param svg {
    width: 10px;
    height: 10px;
}

/* Custom chart card */
.custom-chart-card {
    position: relative;
}

.custom-chart-card .chart-delete-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 69, 58, 0.15);
    border: 1px solid rgba(255, 69, 58, 0.3);
    border-radius: 6px;
    cursor: pointer;
    color: #FF453A;
    transition: all 0.2s;
    z-index: 10;
}

.custom-chart-card .chart-delete-btn:hover {
    background: rgba(255, 69, 58, 0.25);
    border-color: #FF453A;
}

#custom-charts-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
    padding: 0 20px;
}

#custom-charts-container:empty {
    display: none;
}

#custom-charts-container .card {
    margin: 0;
}

/* Spin animation for loading */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* ApexCharts toolbar dark theme */
.apexcharts-toolbar {
    z-index: 5 !important;
}

.apexcharts-menu {
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
}

.apexcharts-menu-item {
    color: var(--text-main) !important;
}

.apexcharts-menu-item:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}