/* Nakordoni Premium Queue Dashboard */
:root {
    --nq-primary: #006543;
    /* Brand Green */
    --nq-bg: #f8f9fa;
    --nq-border: #e9ecef;
    --nq-text: #2c3e50;
    --nq-text-light: #95a5a6;
    --nq-green: #2ecc71;
    --nq-yellow: #f1c40f;
    --nq-red: #e74c3c;
}

.bsp-dashboard {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    margin-bottom: 40px;
}

/* Controls Header */
.bsp-controls {
    padding: 20px;
    border-bottom: 1px solid var(--nq-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    background: #fff;
}

.bsp-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--nq-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bsp-best-badge {
    display: inline-block;
    background: var(--nq-green) !important;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    text-transform: uppercase;
    font-weight: 700;
}

.bsp-filters {
    display: flex;
    gap: 10px;
}

.bsp-btn-filter {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--nq-border);
    background: #fff;
    color: var(--nq-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.bsp-btn-filter:hover {
    background: var(--nq-bg);
}

.bsp-btn-filter.active {
    background: var(--nq-primary);
    color: #fff;
    border-color: var(--nq-primary);
}

/* Table Styles */
.bsp-table-container {
    overflow-x: auto;
}

.bsp-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.bsp-table th {
    background: #fafafa;
    padding: 15px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--nq-text-light);
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--nq-border);
}

.bsp-table th:hover {
    color: var(--nq-primary);
    background: #f1f3f5;
}

.bsp-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--nq-border);
    vertical-align: middle;
    color: var(--nq-text);
    font-size: 14px;
    transition: background 0.2s;
}

.bsp-row {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.bsp-row:hover td {
    background-color: #f8fcfb;
}

/* Columns */
.bsp-col-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bsp-flag {
    font-size: 1.4em;
}

.bsp-badge-source {
    font-size: 0.85em;
    padding: 2px 6px;
    background: #f1f3f5;
    border-radius: 4px;
    color: var(--nq-text-light);
}

.bsp-col-count {
    font-weight: 700;
    font-size: 16px;
}

.bsp-progress-wrapper {
    width: 80px;
    height: 6px;
    background: #edf2f7;
    border-radius: 3px;
    margin-top: 6px;
    overflow: hidden;
}

.bsp-progress-bar {
    height: 100%;
    border-radius: 3px;
}

.bsp-col-time {
    color: var(--nq-text-light);
    font-size: 13px;
    white-space: nowrap;
}

.bsp-col-wait {
    font-weight: 600;
    color: var(--nq-text);
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Status Colors - Text */
.status-green {
    color: var(--nq-green) !important;
}

.status-yellow {
    color: var(--nq-yellow) !important;
}

.status-red {
    color: var(--nq-red) !important;
}

/* Status Colors - Backgrounds (for progress bars) */
.bg-green {
    background-color: var(--nq-green) !important;
}

.bg-yellow {
    background-color: var(--nq-yellow) !important;
}

.bg-red {
    background-color: var(--nq-red) !important;
}

.bsp-btn-tg-header {
    background: #e3f2fd;
    color: #229ED9;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bsp-btn-tg-header:hover {
    background: #229ED9;
    color: white;
}

.bsp-trend-up {
    color: #e74c3c;
    font-weight: bold;
}

.bsp-trend-down {
    color: #2ecc71;
    font-weight: bold;
}

/* Mobile Tweaks */
@media (max-width: 768px) {
    .bsp-table thead {
        display: none;
    }

    .bsp-table {
        min-width: 0;
        /* Reset desktop min-width */
    }

    .bsp-table,
    .bsp-table tbody,
    .bsp-table tr,
    .bsp-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
        /* Ensure padding doesn't overflow width */
    }

    .bsp-row {
        margin-bottom: 16px;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        border: 1px solid #eef0f2;
        padding: 16px;
        position: relative;
    }

    .bsp-table td {
        padding: 6px 0;
        border: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        min-height: 30px;
    }

    .bsp-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        font-size: 13px;
        text-align: left;
        margin-right: 10px;
    }

    /* Name Column - Card Header */
    .bsp-table td[data-label="Пункт пропуску"] {
        display: block;
        text-align: left;
        padding-bottom: 12px;
        margin-bottom: 12px;
        border-bottom: 1px solid #f0f0f0;
    }

    .bsp-table td[data-label="Пункт пропуску"]::before {
        display: none;
    }

    .bsp-col-name {
        justify-content: flex-start;
        font-size: 17px;
        color: #2c3e50;
    }

    .bsp-kpp-link {
        color: #2c3e50;
        text-decoration: none;
    }

    /* Data Columns */
    .bsp-col-count,
    .bsp-col-wait {
        font-size: 15px;
        font-weight: 700;
    }

    .bsp-progress-wrapper {
        display: block;
        /* Restored progress bar */
        margin-top: 4px;
        height: 4px;
        /* Slightly thinner for mobile */
    }

    /* Status Borders for Cards */
    .status-row-red {
        border-left: 4px solid var(--nq-red);
    }

    .status-row-yellow {
        border-left: 4px solid var(--nq-yellow);
    }

    .status-row-green {
        border-left: 4px solid var(--nq-green);
    }

    /* Update Time - Card Footer */
    .bsp-table td[data-label="Оновлено"] {
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px dashed #f0f0f0;
        justify-content: flex-end;
    }

    .bsp-table td[data-label="Оновлено"]::before {
        content: "Оновлено:";
        font-weight: 400;
        font-size: 11px;
    }

    .bsp-col-time {
        font-size: 11px;
        color: #adb5bd;
    }

    /* Controls Stack */
    .bsp-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 15px;
    }

    .bsp-title {
        justify-content: center;
        margin-bottom: 5px;
    }

    .bsp-filters {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .bsp-btn-filter {
        width: 100%;
        text-align: center;
        justify-content: center;
        padding: 10px;
    }

    /* Make Copy and Telegram buttons full width on their row if needed, or keep grid */
    .bsp-btn-tg-header {
        grid-column: span 2;
    }
}