/* ==========================================================================
   OPRIŢI VÂNĂTOAREA - Dashboard Light Design System
   Inspired by clean modern SaaS interfaces (white cards, soft gray background,
   high-contrast typography & elegant pills) + Mobile Responsive Card View
   ========================================================================== */

:root {
    --bg-dark: #eef2f6;
    --bg-page: #e8ecf2;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-glass: rgba(255, 255, 255, 0.9);
    
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --border-subtle: #f1f5f9;

    --primary-red: #dc2626;
    --primary-red-glow: rgba(220, 38, 38, 0.15);
    --accent-gold: #d97706;
    --accent-green: #16a34a;
    --accent-blue: #2563eb;
    --dark-pill: #0f172a;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --header-height: 64px;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 30px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-card: 0 4px 20px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.02);
    --shadow-hover: 0 10px 30px rgba(15, 23, 42, 0.08);
}

/* Reset & Global Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    min-height: 100vh;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color-scheme: light;
    background-image: 
        radial-gradient(circle at 10% 10%, rgba(220, 38, 38, 0.03) 0%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(37, 99, 235, 0.03) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #e2e8f0;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Header */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.03);
}

.header-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: opacity var(--transition-fast);
}
.brand-link:hover {
    opacity: 0.85;
}

.brand-title {
    color: var(--text-primary);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}
.nav-link:hover {
    color: var(--text-primary);
    background: #e2e8f0;
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--dark-pill);
    border: 1px solid var(--dark-pill);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-decoration: none;
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
    transition: all var(--transition-normal);
}
.cta-btn:hover {
    background: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.25);
}

/* Dashboard Content Layout */
.dashboard-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: calc(var(--header-height) + 32px) 24px 60px 24px;
}

/* Title Section */
.dashboard-header {
    margin-bottom: 32px;
}

.badge-tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--primary-red);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.dashboard-title h1 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    line-height: 1.2;
}

.dashboard-title p {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 720px;
    line-height: 1.5;
}

.dashboard-title strong {
    color: var(--text-primary);
    font-weight: 700;
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    position: relative;
    overflow: hidden;
}

.stat-card.highlight {
    border-color: #fca5a5;
    background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
}

.stat-icon {
    font-size: 1.75rem;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    flex-shrink: 0;
}

.stat-content {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.stat-card .label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-card .value {
    font-family: var(--font-mono);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.stat-card .subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

/* Controls Bar (Search & Filter Pills) */
.controls-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    background: var(--bg-card);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 280px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.search-input {
    width: 100%;
    padding: 11px 40px 11px 44px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.92rem;
    font-weight: 500;
    outline: none;
    transition: all var(--transition-normal);
}

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

.search-input:focus {
    border-color: var(--dark-pill);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}
.search-input:focus + .search-icon,
.search-box:focus-within .search-icon {
    color: var(--dark-pill);
}

.clear-search-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: #e2e8f0;
    border: none;
    color: var(--text-secondary);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all var(--transition-fast);
}
.clear-search-btn:hover {
    background: var(--dark-pill);
    color: white;
}

/* Category Filter Pills */
.filter-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-pill {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-pill:hover {
    color: var(--text-primary);
    background: #e2e8f0;
    border-color: var(--border-hover);
}

.filter-pill.active {
    background: var(--dark-pill);
    border-color: var(--dark-pill);
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

/* Table Container & Desktop Table Styling */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.table-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: nowrap;
}

.dashboard-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 16px 20px;
    border-bottom: 2px solid var(--border-color);
    user-select: none;
    position: sticky;
    top: 0;
    z-index: 10;
}

.dashboard-table th.sortable {
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast);
}
.dashboard-table th.sortable:hover {
    color: var(--text-primary);
    background: #f1f5f9;
}

.dashboard-table th .sort-icon {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.75rem;
    opacity: 0.4;
    transition: opacity var(--transition-fast);
}

.dashboard-table th.sortable:hover .sort-icon {
    opacity: 0.8;
}

.dashboard-table th.sort-asc .sort-icon,
.dashboard-table th.sort-desc .sort-icon {
    opacity: 1;
    color: var(--dark-pill);
}

.dashboard-table th.number-col,
.dashboard-table td.number-col {
    text-align: right;
}

.dashboard-table th.portrait-cell,
.dashboard-table td.portrait-cell {
    width: 64px;
    padding: 12px 12px 12px 20px;
    text-align: center;
}

.dashboard-table tbody tr {
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition-fast);
}

.dashboard-table tbody tr:hover {
    background: #f8fafc;
}

.dashboard-table td {
    padding: 14px 20px;
    font-size: 0.95rem;
    vertical-align: middle;
}

/* Hide Mobile Elements on Desktop */
.mobile-portrait-link,
.mobile-cell-label {
    display: none;
}

.species-info-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Species Portrait Thumbnail */
.species-portrait,
.mobile-portrait {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
    background-color: #f1f5f9;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
    display: block;
}

tr:hover .species-portrait {
    transform: scale(1.12);
    border-color: var(--dark-pill);
}

/* Species Name & Details */
.species-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.species-name-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
    transition: color var(--transition-fast);
}

.species-link:hover .species-name-title,
td.species-name:hover .species-name-title {
    color: var(--primary-red);
}

.species-scientific {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-style: italic;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Quota Values & Visual Badges */
.quota-value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    display: inline-block;
}

.quota-value.has-quota {
    color: var(--text-primary);
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.quota-value.no-quota {
    color: var(--text-muted);
    font-weight: 400;
}

/* YoY Difference Badges */
.diff-badge {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.diff-badge.increase {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.diff-badge.decrease {
    color: #16a34a;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.diff-badge.neutral {
    color: var(--text-muted);
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

/* Footer Aggregation Row */
.dashboard-table tfoot tr {
    background: #f8fafc;
    border-top: 2px solid var(--border-color);
    font-weight: 800;
}

.dashboard-table tfoot td {
    padding: 18px 20px;
    font-size: 1rem;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.dashboard-table tfoot .footer-metric-value {
    font-family: var(--font-mono);
    font-size: 1.12rem;
    color: var(--primary-red);
    font-weight: 800;
}

/* Site Footer */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 30px 24px;
    text-align: center;
    background: #ffffff;
    margin-top: 40px;
    box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.02);
}

.footer-container {
    max-width: 1280px;
    margin: 0 auto;
    color: var(--text-muted);
    font-size: 0.88rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.footer-link {
    color: var(--primary-red);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-fast);
}
.footer-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   MOBILE RESPONSIVE CARD VIEW (< 680px)
   Transforms table into zero-overflow mobile cards for 100% visibility
   ========================================================================== */

@media (max-width: 680px) {
    .dashboard-wrapper {
        padding-left: 14px;
        padding-right: 14px;
        padding-top: calc(var(--header-height) + 16px);
    }

    .header-container {
        padding: 0 14px;
        gap: 8px;
    }

    .brand-link {
        flex-shrink: 1;
        min-width: 0;
    }

    .brand-title {
        font-size: 0.92rem;
        letter-spacing: 0.5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .cta-btn {
        padding: 6px 14px;
        font-size: 0.78rem;
        letter-spacing: 0.3px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .dashboard-title h1 {
        font-size: 1.6rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .controls-bar {
        padding: 14px;
        gap: 12px;
    }

    .filter-pills {
        width: 100%;
    }

    .filter-pill {
        flex: 1;
        text-align: center;
        padding: 8px 10px;
        font-size: 0.82rem;
    }

    /* Transform Table Container on Mobile */
    .table-container {
        background: transparent;
        border: none;
        box-shadow: none;
        overflow: visible;
    }

    .table-scroll-wrapper {
        overflow-x: visible;
    }

    .dashboard-table {
        display: block;
        width: 100%;
        white-space: normal;
    }

    /* Sorting Bar Header on Mobile */
    .dashboard-table thead {
        display: block;
        background: #ffffff;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        margin-bottom: 12px;
        padding: 8px 12px;
        box-shadow: var(--shadow-card);
    }

    .dashboard-table thead tr {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 4px;
    }

    .dashboard-table th {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        padding: 6px 8px;
        border: none;
        font-size: 0.72rem;
        letter-spacing: 0;
        position: static;
        flex: 1;
        text-align: center;
    }

    .dashboard-table th.portrait-cell {
        display: none;
    }

    .dashboard-table th .sort-icon {
        margin-left: 2px;
    }

    /* Species Card List on Mobile */
    .dashboard-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .dashboard-table tbody tr.species-row {
        display: flex;
        flex-direction: column;
        background: #ffffff;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 14px;
        box-shadow: var(--shadow-card);
        gap: 10px;
        transition: transform 0.15s ease, box-shadow 0.15s ease;
    }

    .dashboard-table tbody tr.species-row:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-hover);
        background: #ffffff;
    }

    /* Hide desktop standalone portrait cell */
    .dashboard-table td.portrait-cell {
        display: none;
    }

    /* Top Row inside Card: Mobile Portrait + Species Title & Subtitle */
    .dashboard-table td.species-name {
        display: block;
        padding: 0;
        width: 100%;
        border: none;
    }

    .mobile-portrait-link {
        display: block;
        flex-shrink: 0;
    }

    .mobile-portrait {
        width: 42px;
        height: 42px;
    }

    .species-info-wrapper {
        gap: 12px;
    }

    .species-name-title {
        font-size: 1.05rem;
        line-height: 1.25;
    }

    .species-scientific {
        font-size: 0.8rem;
        margin-top: 1px;
    }

    /* Metrics Section inside Mobile Card (3 Columns) */
    .dashboard-table td.number-col {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 8px 4px;
        border: none;
    }

    /* Group the 3 data cells inside a 3-column grid container */
    .dashboard-table tbody tr.species-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    /* Target the 3 metric cells in grid */
    .dashboard-table tbody tr.species-row td.col-quota-2025,
    .dashboard-table tbody tr.species-row td.col-quota-2026,
    .dashboard-table tbody tr.species-row td.col-diff {
        background: #f8fafc;
        border: 1px solid #f1f5f9;
        border-radius: var(--radius-sm);
    }

    /* Container layout for metrics: 3 columns */
    .dashboard-table tbody tr.species-row {
        display: grid;
        grid-template-areas: 
            "species species species"
            "q2025   q2026   qdiff";
        grid-template-columns: 1fr 1fr 1fr;
        gap: 8px;
    }

    .dashboard-table tbody tr.species-row td.species-name {
        grid-area: species;
        margin-bottom: 2px;
    }
    .dashboard-table tbody tr.species-row td.col-quota-2025 {
        grid-area: q2025;
    }
    .dashboard-table tbody tr.species-row td.col-quota-2026 {
        grid-area: q2026;
    }
    .dashboard-table tbody tr.species-row td.col-diff {
        grid-area: qdiff;
    }

    .mobile-cell-label {
        display: block;
        font-size: 0.65rem;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--text-muted);
        letter-spacing: 0.5px;
        margin-bottom: 4px;
    }

    .quota-value {
        font-size: 0.85rem;
        padding: 3px 6px;
        width: 100%;
        text-align: center;
    }

    .diff-badge {
        font-size: 0.8rem;
        padding: 3px 6px;
        width: 100%;
        justify-content: center;
    }

    /* Footer Total Card on Mobile */
    .dashboard-table tfoot {
        display: block;
        margin-top: 12px;
    }

    .dashboard-table tfoot tr.footer-row {
        display: grid;
        grid-template-areas: 
            "title  title  title"
            "q2025  q2026  qdiff";
        grid-template-columns: 1fr 1fr 1fr;
        gap: 8px;
        background: #ffffff;
        border: 2px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 14px;
        box-shadow: var(--shadow-card);
    }

    .dashboard-table tfoot td.footer-title-cell {
        grid-area: title;
        display: block;
        text-align: center;
        font-size: 0.85rem;
        font-weight: 800;
        color: var(--text-primary);
        letter-spacing: 1px;
        padding: 0 0 6px 0;
        border: none;
    }

    .dashboard-table tfoot td.number-col {
        background: #f8fafc;
        border: 1px solid #f1f5f9;
        border-radius: var(--radius-sm);
        padding: 8px 4px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .dashboard-table tfoot td.col-quota-2025 { grid-area: q2025; }
    .dashboard-table tfoot td.col-quota-2026 { grid-area: q2026; }
    .dashboard-table tfoot td.col-diff { grid-area: qdiff; }

    .dashboard-table tfoot .footer-metric-value {
        font-size: 0.95rem;
    }
}

@media (max-width: 360px) {
    .brand-title {
        font-size: 0.82rem;
        letter-spacing: 0;
    }
    .cta-btn {
        padding: 5px 10px;
        font-size: 0.72rem;
    }
}

