/* Core Styling & Modern UI Variables tokens tokens matching PRD requirements */
:root {
    --primary-color: #2563eb;
    --success-color: #16a34a;
    --warning-color: #ea580c;
    --danger-color: #dc2626;
    --dark-bg: #1e293b;
    --light-bg: #f8fafc;
    --text-main: #334155;
    --border-color: #e2e8f0;
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--light-bg);
    color: var(--text-main);
    line-height: 1.5;
}

/* Header Area styling */
.app-header {
    background-color: var(--dark-bg);
    color: white;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 2rem;
}

.logo-area h1 {
    font-size: 1.25rem;
    font-weight: 700;
}

.logo-area p {
    font-size: 0.85rem;
    color: #94a3b8;
}

.url-badge {
    background-color: rgba(255,255,255,0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Layout Management */
.main-layout {
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 70px);
}

/* Sidebar Styling - Mobile First Carousel Transformation Support */
.sidebar {
    background-color: white;
    display: flex;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 68px;
    z-index: 90;
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.nav-btn {
    padding: 1rem;
    border: none;
    background: transparent;
    color: #64748b;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    min-height: 48px; /* Meet mobile hit target rule */
}

.nav-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: #eff6ff;
}

/* Content Container styling */
.content-area {
    flex: 1;
    padding: 1rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.section-title-wrapper {
    margin-bottom: 1.5rem;
}

.section-title-wrapper h2 {
    font-size: 1.35rem;
    color: #0f172a;
}

.section-title-wrapper p {
    font-size: 0.9rem;
    color: #64748b;
}

/* Content boxes cards */
.content-box {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    margin-bottom: 1rem;
}

/* KPI Swipeable Grid Layout tokens */
.kpi-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    padding: 1.25rem;
    border-radius: 8px;
    color: white;
    box-shadow: var(--card-shadow);
}

.card-blue { background: linear-gradient(135deg, #1e40af, #2563eb); }
.card-purple { background: linear-gradient(135deg, #6b21a8, #9333ea); }
.card-green { background: linear-gradient(135deg, #065f46, #16a34a); }

.kpi-card h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    opacity: 0.9;
    font-weight: 600;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0.25rem 0;
}

.kpi-sub {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Adaptive Grids layout */
.grid-2-col {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Alert system box components */
.status-alert-box {
    padding: 1rem;
    border-radius: 6px;
    border-left: 5px solid transparent;
    margin-bottom: 1rem;
}

.alert-red {
    background-color: #fef2f2;
    border-left-color: var(--danger-color);
    color: #991b1b;
}

.alert-green {
    background-color: #f0fdf4;
    border-left-color: var(--success-color);
    color: #166534;
}

.status-alert-box h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.status-alert-box p {
    font-size: 0.85rem;
}

/* Custom Visual Bars comparison */
.tariff-comparison-bars {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.bar-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.bar-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
}

.bar-container {
    background-color: #f1f5f9;
    height: 32px;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.bar-fill {
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
}

.fill-recommended { background-color: #bfdbfe; border-right: 3px solid var(--primary-color); }
.fill-gov { background-color: #fed7aa; border-right: 3px solid var(--warning-color); }
.fill-recommended-tba { background-color: #e9d5ff; border-right: 3px solid #a855f7; }
.fill-gov-tba { background-color: #fca5a5; border-right: 3px solid var(--danger-color); }

.bar-value {
    position: absolute;
    left: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 10;
}

/* Forms and interactive layout entries */
.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
}

.input-group input[type="number"] {
    width: 100%;
    padding: 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

.range-slider {
    width: 100%;
    height: 8px;
    background: #cbd5e1;
    border-radius: 5px;
    outline: none;
    margin: 0.5rem 0;
}

.slider-value-badge {
    background-color: var(--dark-bg);
    color: white;
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-weight: 700;
    margin-top: 0.25rem;
}

/* Custom Table Controls Responsive */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

.data-table th, .data-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: #f1f5f9;
    color: #475569;
    font-weight: 700;
}

/* List Card Styling (Mobile-First Replacement for Tables) */
.mobile-card-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.respondent-card {
    background: white;
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 8px;
    position: relative;
}

.respondent-card.outlier {
    border-left: 4px solid var(--danger-color);
    background-color: #fff5f5;
}

.card-row-main {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 0.95rem;
}

.card-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.5rem;
}

.badge-outlier {
    background-color: var(--danger-color);
    color: white;
    padding: 0.1rem 0.4rem;
    font-size: 0.7rem;
    border-radius: 3px;
    font-weight: bold;
}

/* Toggle Switch Styling */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.toggle-container input { display: none; }
.toggle-slider {
    width: 44px;
    height: 24px;
    background-color: #cbd5e1;
    border-radius: 9999px;
    position: relative;
    transition: 0.3s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    background-color: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: 0.3s;
}

input:checked + .toggle-slider { background-color: var(--primary-color); }
input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-text { font-size: 0.85rem; font-weight: 600; }

/* Simulation Sandbox elements */
.border-red { border-top: 4px solid var(--danger-color); }
.border-green { border-top: 4px solid var(--success-color); }
.title-red { color: var(--danger-color); font-size: 1rem; margin-bottom: 1rem; }
.title-green { color: var(--success-color); font-size: 1rem; margin-bottom: 1rem; }

.sim-metric {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 0.35rem 0;
}

.sim-val.minus { color: var(--danger-color); }
hr { border: 0; border-top: 1px solid var(--border-color); margin: 0.5rem 0; }
hr.double { border-top: 2px dashed #94a3b8; }

.total-profit-card {
    background-color: #f8fafc;
    padding: 0.75rem;
    border-radius: 6px;
}

.text-large { font-size: 1.25rem; font-weight: 800; }
.text-green { color: var(--success-color); }
.margin-top { margin-top: 1rem; }
.hide { display: none !important; }

/* Advocacy Narrative report */
.narrative-p {
    font-size: 0.95rem;
    margin-bottom: 1rem;
    line-height: 1.6;
    text-align: justify;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    width: 100%;
}

/* Tablet & Desktop Layout Scaling Adjustments */
@media (min-width: 768px) {
    .main-layout {
        flex-direction: row;
    }
    .sidebar {
        width: 260px;
        flex-direction: column;
        border-bottom: none;
        border-right: 1px solid var(--border-color);
        position: sticky;
        top: 70px;
        height: calc(100vh - 70px);
    }
    .nav-btn {
        width: 100%;
        border-bottom: none;
        border-left: 4px solid transparent;
        padding: 1.1rem 1.25rem;
    }
    .nav-btn.active {
        border-left-color: var(--primary-color);
        border-bottom-color: transparent;
    }
    .kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .grid-2-col {
        grid-template-columns: repeat(2, 1fr);
    }
    .section-title-wrapper h2 { font-size: 1.6rem; }
}

/* Print Overrides for Official Documentation Standards */
@media print {
    .app-header, .sidebar, .filter-panel, .action-bar, input, .range-slider, .slider-value-badge {
        display: none !important;
    }
    .main-layout, .content-area, .tab-content {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .content-box {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    .narrative-p {
        font-size: 11pt;
        color: black;
    }
  }
