/* =====================================================
   IBISWorld Data Navigator - Shared Styles
   Common styles used across all pages
   ===================================================== */

:root {
    /* IBISWorld Brand Colors */
    --primary-color: #0C1C31;
    --primary-dark: #162F50;
    --primary-light: #F97066;
    --secondary-color: #2E90FA;
    --secondary-dark: #2970FF;
    --accent-green: #17B26A;
    --accent-orange: #F79009;
    --accent-yellow: #FEC84B;
    --accent-purple: #7A5AF8;
    --accent-teal: #15B79E;
    --logo-red: #CC1011;
    --background-color: #FAFAFA;
    --card-background: #FFFFFF;
    --text-color: #181D27;
    --text-light: #535862;
    --border-color: #D5D7DA;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);

    /* Gray Scale */
    --gray-50: #f8f9fa;
    --gray-100: #f0f0f0;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #D5D7DA;
    --gray-500: #adb5bd;
    --gray-600: #6b7280;
    --gray-700: #475569;
    --gray-800: #334155;
    --gray-900: #1a1a1a;

    /* Typography Scale */
    --font-size-2xs: 0.65rem;
    --font-size-xs: 0.7rem;
    --font-size-sm: 0.75rem;
    --font-size-base: 0.8rem;
    --font-size-md: 0.85rem;
    --font-size-lg: 0.9rem;
    --font-size-xl: 0.95rem;
    --font-size-2xl: 1rem;
    --font-size-3xl: 1.1rem;

    /* Layout Tokens */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 20px;
    --space-2xl: 30px;
    --transition-fast: 0.15s;
    --transition-normal: 0.2s;
    --transition-slow: 0.3s;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-xl: 0 4px 20px rgba(0,0,0,0.3);
    --hover-bg: #f0f0f0;
    --bg-subtle: #f8f9fa;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.3;
    font-size: 11px;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 12px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 15px 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.header-logo {
    height: 40px;
    width: auto;
}

.header-text h1 {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.header-text p {
    opacity: 0.9;
    font-size: 0.85rem;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    margin-left: auto;
    gap: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.nav-tab {
    padding: 8px 14px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    white-space: nowrap;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
}

.nav-tab:hover {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

.nav-tab.active {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

.nav-tab svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Filter Panel - Base Styles */
.filter-panel {
    background: var(--card-background);
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
}

.filter-panel h2 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-light);
}

.filter-group select {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-group select:hover {
    border-color: var(--primary-color);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: #e9ecef;
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: #dee2e6;
}

/* Status Badge Colors */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-complete {
    background-color: #17B26A;
    color: #FFFFFF;
}

.status-in-progress {
    background-color: #2E90FA;
    color: #FFFFFF;
}

.status-planned {
    background-color: #F79009;
    color: #212121;
}

.status-tbd {
    background-color: #D5D7DA;
    color: #616161;
}

/* Card Base */
.card {
    background: var(--card-background);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 20px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Search Box */
.search-box {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
}

.search-box:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Table Base Styles */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

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

th {
    background-color: var(--background-color);
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th:hover {
    background-color: #e9ecef;
}

th.sorted-asc::after {
    content: ' \2191';
}

th.sorted-desc::after {
    content: ' \2193';
}

tr:hover {
    background-color: #f8f9fa;
}

/* Tooltip (shared across matrix and country pages) */
.tooltip {
    position: fixed;
    background: #1a1a1a;
    color: white;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    max-width: 350px;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-normal);
    box-shadow: var(--shadow-xl);
}

.tooltip.visible {
    opacity: 1;
}

.tooltip-title {
    font-weight: 700;
    margin-bottom: 6px;
    color: #EF5350;
}

.tooltip-definition {
    color: #e0e0e0;
    line-height: 1.5;
}

/* Data-tooltip tooltips (shared across dictionary and releases) */
.avail-badge[data-tooltip],
.release-tag[data-tooltip] {
    position: relative;
}

.avail-badge[data-tooltip]::after,
.release-tag[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: #1e293b;
    color: white;
    font-size: 0.65rem;
    font-weight: 500;
    border-radius: 4px;
    white-space: normal;
    max-width: 160px;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    z-index: 10;
}

.avail-badge[data-tooltip]:hover::after,
.release-tag[data-tooltip]:hover::after {
    opacity: 1;
}

/* Empty State (shared across country, dictionary, and other pages) */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    fill: var(--border-color);
    margin-bottom: 15px;
}

.empty-state h3 {
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.85rem;
}

/* Export Dropdown (shared across matrix, dictionary) */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 100;
    margin-top: var(--space-xs);
}

.export-menu.show {
    display: block;
}

.export-menu-item {
    padding: 10px 14px;
    font-size: var(--font-size-base);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: background-color var(--transition-fast);
}

.export-menu-item:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.export-menu-item:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.export-menu-item:hover {
    background-color: #f5f5f5;
}

.export-menu-item svg {
    width: 16px;
    height: 16px;
    fill: var(--text-light);
}

.export-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 2px 0;
}

/* Toast Notification (shared across matrix, dictionary) */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--gray-800);
    color: white;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-md);
    font-size: var(--font-size-md);
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all var(--transition-slow);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: var(--accent-green);
}

/* Print Styles */
@media print {
    .filter-panel, .pagination, .search-box, .nav-tabs {
        display: none;
    }

    .card, .chart-card, .summary-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ── Mobile Banner ──────────────────────────────────────── */

.mobile-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 10px;
    background: #e8f4fd;
    border: 1px solid #b6dff7;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--primary-color);
}

.mobile-banner-text {
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
}

.mobile-banner-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 2px 6px;
    line-height: 1;
    border-radius: 4px;
    flex-shrink: 0;
}

.mobile-banner-close:hover {
    background: rgba(0,0,0,0.08);
}

/* ── Hamburger Button ──────────────────────────────────── */

.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    margin-left: auto;
}

.hamburger-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 1px;
    transition: transform 0.25s, opacity 0.25s;
}

.hamburger-btn.is-active span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.hamburger-btn.is-active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.is-active span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Responsive Utilities */
@media (max-width: 768px) {
    .mobile-banner {
        display: flex;
    }

    .header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        position: relative;
    }

    /* Show hamburger, hide nav tabs by default */
    .hamburger-btn {
        display: flex;
        position: absolute;
        top: 12px;
        right: 12px;
    }

    .nav-tabs {
        display: none;
        margin-left: 0;
        width: 100%;
        flex-direction: column;
        background: rgba(255,255,255,0.12);
        border-radius: 6px;
        overflow: hidden;
    }

    .nav-tabs.nav-open {
        display: flex;
    }

    .nav-tab {
        padding: 10px 14px;
        font-size: 0.85rem;
        justify-content: flex-start;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .nav-tab:last-child {
        border-bottom: none;
    }

    .nav-tab:hover,
    .nav-tab.active {
        background: rgba(255,255,255,0.2);
    }

    .tooltip {
        max-width: calc(100vw - 32px);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    .header {
        padding: 12px 14px;
        margin-bottom: 10px;
    }

    .header-text h1 {
        font-size: 1.15rem;
    }

    .header-text p {
        font-size: 0.75rem;
    }

    .filter-panel {
        padding: 10px 12px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}
