/* Sidebar */
.sidebar {
    width: 220px;
    min-width: 220px;
    flex-shrink: 0;
    min-height: calc(100vh - 56px);
    position: sticky;
    top: 56px;
}

.sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

/* Login */
.login-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* Main content */
.main-content {
    min-height: calc(100vh - 56px);
    background: #f8f9fa;
}

/* Deal table */
.deal-row-green { background-color: #d4edda !important; }
.deal-row-yellow { background-color: #fff3cd !important; }
.deal-row-red { background-color: #f8d7da !important; }

.discount-badge {
    font-size: 1.1em;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 20px;
}

.discount-high { background: #28a745; color: white; }
.discount-medium { background: #ffc107; color: #333; }
.discount-low { background: #6c757d; color: white; }

/* Stats cards */
.stat-card {
    border-radius: 12px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
}

/* Thumbnail */
.deal-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.deal-thumb-placeholder {
    width: 80px;
    height: 60px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,.15);
    position: relative;
    overflow: hidden;
}
.deal-thumb-placeholder .brand-init {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    z-index: 1;
}
.deal-thumb-placeholder .brand-sub {
    position: absolute;
    bottom: 2px;
    font-size: .55rem;
    font-weight: 600;
    opacity: .7;
    letter-spacing: .5px;
    text-transform: uppercase;
    z-index: 1;
}

/* Price */
.price-auction {
    color: #28a745;
    font-weight: bold;
    font-size: 1.05em;
}

.price-market {
    color: #6c757d;
}

.price-mileage {
    color: #0d6efd;
}

/* Multi-select dropdowns (brands & platforms) */
#brand-dropdown-menu,
#platform-dropdown-menu {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
}

#brand-dropdown-menu label.dropdown-item:hover,
#platform-dropdown-menu label.dropdown-item:hover {
    background: #f0f0f0;
    border-radius: 4px;
}

#brand-dropdown-menu .form-check-input,
#platform-dropdown-menu .form-check-input {
    margin-top: 0;
}

/* Sortable columns */
.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.table-dark .sortable:hover {
    background-color: #343a40 !important;
}

.table-dark .sortable.active-sort {
    background-color: #3d4349 !important;
}

.sort-icon {
    font-size: 0.75em;
    opacity: 0.6;
    margin-left: 2px;
}

.active-sort .sort-icon {
    opacity: 1;
}

/* Platform badges */
.bg-outline-platform {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
    font-weight: normal;
    font-size: 0.85em;
    padding: 4px 10px;
    border-radius: 12px;
    transition: all 0.15s;
}

.bg-outline-platform:hover {
    background: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

/* Scan progress */
#scan-progress .card {
    animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% { border-color: rgba(13, 110, 253, 0.4); }
    50% { border-color: rgba(13, 110, 253, 1); }
}

/* Settings toggles */
.form-check-input:checked {
    background-color: #28a745;
    border-color: #28a745;
}

/* Statistics — liquidity badges */
.liquidity-high { background: #28a745; color: white; padding: 3px 10px; border-radius: 12px; font-size: 0.8em; font-weight: bold; }
.liquidity-medium { background: #ffc107; color: #333; padding: 3px 10px; border-radius: 12px; font-size: 0.8em; font-weight: bold; }
.liquidity-low { background: #dc3545; color: white; padding: 3px 10px; border-radius: 12px; font-size: 0.8em; font-weight: bold; }

.stats-table .brand-row:hover { background: #e9ecef; }
.chart-container { position: relative; height: 400px; }

/* Risk badge — orange level */
.bg-orange { background-color: #fd7e14 !important; color: white; }

/* Risk tooltip */
.risk-tooltip {
    position: relative;
    cursor: help;
}

/* Viewed deals */
.deal-viewed { opacity: 0.65; }
.deal-viewed:hover { opacity: 1; }

/* NEW badge */
.badge-new { font-size: 0.7em; vertical-align: middle; }

/* Active toggle buttons */
.btn-outline-warning.active { background: #ffc107; color: #333; border-color: #ffc107; }
.btn-outline-info.active { background: #0dcaf0; color: #333; border-color: #0dcaf0; }

/* Documentation flow diagrams */
.doc-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.doc-flow .flow-arrow {
    color: #adb5bd;
    font-size: 1.4em;
    line-height: 1;
    padding: 2px 0;
}
.doc-flow .flow-step {
    width: 100%;
    max-width: 620px;
}
.doc-flow .flow-step .card {
    border-left: 4px solid;
    transition: box-shadow 0.15s;
}
.doc-flow .flow-step .card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.doc-flow .flow-split {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 620px;
}
.doc-flow .flow-split .card {
    flex: 1;
    border-left: 4px solid;
}
.doc-check-flow .check-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-left: 3px solid #dee2e6;
    margin-left: 16px;
    margin-bottom: 0;
    transition: background 0.15s;
}
.doc-check-flow .check-item:hover {
    background: #f8f9fa;
}
.doc-check-flow .check-item.check-pass {
    border-left-color: #28a745;
}
.doc-check-flow .check-item.check-fail {
    border-left-color: #dc3545;
}
.doc-check-flow .check-arrow {
    color: #adb5bd;
    margin-left: 28px;
    font-size: 1.1em;
}

/* Platform status chips (scan progress) */
.plat-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.75em;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s;
}
.plat-chip i { font-size: 0.9em; }
.plat-pending   { background: #e9ecef; color: #868e96; }
.plat-parsing   { background: #cce5ff; color: #004085; }
.plat-parsed    { background: #d4edda; color: #155724; }
.plat-comparing { background: #fff3cd; color: #856404; }
.plat-done      { background: #28a745; color: white; }
.plat-error     { background: #f8d7da; color: #721c24; }
.plat-spin i { animation: plat-spin-anim 1s linear infinite; }
@keyframes plat-spin-anim {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        min-height: auto;
        position: static;
    }

    .d-flex > .sidebar + .main-content {
        width: 100%;
    }

    .deal-thumb, .deal-thumb-placeholder {
        width: 60px;
        height: 45px;
    }

    .table-responsive {
        font-size: 0.85em;
    }
}

.deal-thumb-logo {
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}
.deal-thumb-logo img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}
/* Global filter panel */
#filterPanel .form-label {
    font-size: 0.7em;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
#filterPanel .input-group-sm .form-control,
#filterPanel .input-group-sm .input-group-text {
    font-size: 0.85em;
}
#filterPanel .input-group-text {
    background: transparent;
    border-left: 0;
    border-right: 0;
    padding: 0.2rem 0.3rem;
}
#filterPanel .country-btn {
    font-size: 0.8em;
    padding: 2px 10px;
}
#filterPanel .country-btn.active {
    font-weight: 700;
}
@media (max-width: 768px) {
    #filterPanel .row .col-md-2,
    #filterPanel .row .col-md-3 {
        margin-bottom: 0.5rem;
    }
}

/* Compact filter panel */
.fp-num { font-size:.78em !important; padding:2px 6px !important; min-width:0 !important; }
.fp-num::-webkit-inner-spin-button, .fp-num::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
.fp-num { -moz-appearance:textfield; }
.fp-date { font-size:.72em !important; padding:2px 4px !important; width:115px !important; }
#fp .dropdown-menu { position:absolute; z-index:1055; }
