/* =============================================
   KARS-Net Dashboard — Clinical Mint & Teal Theme
   ============================================= */

:root {
    /* Bright clinical fresh background */
    --bg-gradient: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 50%, #f0fdfa 100%);

    /* Panel & Card Styles */
    --panel-bg: rgba(255, 255, 255, 0.92);
    --panel-border: rgba(13, 148, 136, 0.12);
    --card-shadow: 0 8px 30px 0 rgba(13, 148, 136, 0.08);

    /* Typography */
    --text-primary: #0f172a;
    --text-secondary: #0f766e;
    --text-muted: #64748b;

    /* Brand Accent Colours — vibrant, clean, medical/scientific */
    --accent-blue:   #0284c7;
    --accent-indigo: #4f46e5;
    --accent-purple: #8b5cf6;
    --accent-teal:   #0d9488;
    --accent-green:  #10b981;
    --accent-red:    #ef4444;
    --accent-pink:   #ec4899;
    --accent-amber:  #f59e0b;

    /* Sidebar colours — Deep Forest Teal to Ocean Emerald */
    --sidebar-bg: linear-gradient(175deg, #0f766e 0%, #115e59 60%, #134e4a 100%);
    --sidebar-text: rgba(255, 255, 255, 0.85);
    --sidebar-text-active: #ffffff;
    --sidebar-item-hover: rgba(255, 255, 255, 0.1);
    --sidebar-item-active: rgba(255, 255, 255, 0.18);

    /* Utilities */
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

/* ─── Reset ─────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background: var(--bg-gradient);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
}

/* ─── App Layout ────────────────────────────── */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* ─── Sidebar ───────────────────────────────── */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    padding: 2rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    height: 100%;
    z-index: 100;
    flex-shrink: 0;
    box-shadow: 4px 0 24px rgba(13, 148, 136, 0.15);
    position: relative;
    overflow: hidden;
}

/* subtle decorative blob */
.sidebar::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
    pointer-events: none;
}
.sidebar::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -40px;
    width: 220px;
    height: 220px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
    pointer-events: none;
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.3rem;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #ffffff;
}

/* Nav Menu */
.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    position: relative;
    z-index: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    cursor: pointer;
    position: relative;
}

.nav-link i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-link:hover {
    color: var(--sidebar-text-active);
    background: var(--sidebar-item-hover);
}

.nav-link.active {
    color: #ffffff;
    background: var(--sidebar-item-active);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 0 3px 3px 0;
}

/* sidebar bottom area */
.sidebar > div[style*="margin-top: auto"] {
    position: relative;
    z-index: 1;
}

/* ─── Main Content ──────────────────────────── */
.main-content {
    flex: 1;
    height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2rem 2.5rem;
}

/* ─── Header ────────────────────────────────── */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-title h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(to right, var(--text-secondary), var(--accent-teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.2rem;
}

.header-title p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Select Dropdown */
.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: '▾';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.select-control {
    appearance: none;
    background: #ffffff;
    border: 2px solid rgba(13, 148, 136, 0.2);
    border-radius: var(--radius-md);
    padding: 0.7rem 2.5rem 0.7rem 1.25rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.05);
}

.select-control:focus {
    outline: none;
    border-color: var(--text-secondary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

/* ─── Metric Cards ──────────────────────────── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: #ffffff;
    border: 1.5px solid rgba(13, 148, 136, 0.10);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 4px 20px rgba(13, 148, 136, 0.05);
    transition: var(--transition-smooth);
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(13, 148, 136, 0.1);
    border-color: rgba(13, 148, 136, 0.25);
}

.metric-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.metric-icon.blue   { background: #e0f2fe; color: var(--accent-blue); }
.metric-icon.indigo { background: #f0fdfa; color: var(--accent-teal); }
.metric-icon.teal   { background: #ecfdf5; color: var(--accent-green); }

.metric-info h3 {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.metric-info p {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

/* ─── Dashboard Grid ────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-grid > * {
    min-width: 0;
}

.dashboard-grid.equal {
    grid-template-columns: repeat(2, 1fr);
}

.dashboard-grid.full {
    grid-template-columns: 1fr;
}

/* ─── Glass Panel ───────────────────────────── */
.glass-panel {
    background: #ffffff;
    border: 1.5px solid rgba(13, 148, 136, 0.1);
    border-radius: 22px;
    padding: 1.75rem;
    box-shadow: 0 4px 20px rgba(13, 148, 136, 0.05);
    transition: var(--transition-smooth);
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.glass-panel:hover {
    box-shadow: 0 8px 28px rgba(13, 148, 136, 0.08);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.panel-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-title i {
    color: var(--text-secondary);
}

/* ─── Tabs ──────────────────────────────────── */
.tab-content {
    display: none;
    animation: fadeIn 0.35s ease;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Gender Donut Panel ────────────────────── */
.gender-panel {
    display: flex;
    flex-direction: column;
}

.gender-chart-container {
    position: relative;
    width: 100%;
    height: 200px;
    flex-shrink: 0;
}

.gender-legend {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.85rem;
}

.gender-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: var(--text-primary);
}

.gender-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ─── Data Tables ───────────────────────────── */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1.5px solid rgba(13, 148, 136, 0.1);
}

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

.data-table th {
    background: linear-gradient(90deg, #f0fdfa, #ccfbf1);
    padding: 0.875rem 1.25rem;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 2px solid rgba(13, 148, 136, 0.12);
    white-space: nowrap;
}

.data-table td {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid rgba(13, 148, 136, 0.06);
    color: var(--text-muted);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: rgba(13, 148, 136, 0.03);
    color: var(--text-primary);
}

.data-table td.strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ─── Badges ────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge.gp {
    background: #e0f2fe;
    color: var(--accent-blue);
    border: 1px solid #bae6fd;
}

.badge.gn {
    background: #fee2e2;
    color: var(--accent-red);
    border: 1px solid #fecaca;
}

/* ─── Buttons ───────────────────────────────── */
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--text-secondary), var(--accent-teal));
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.7rem 1.4rem;
    color: #fff;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.25);
    text-decoration: none;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(13, 148, 136, 0.35);
}

.action-btn.secondary {
    background: #f1f5f9;
    color: var(--text-primary);
    box-shadow: none;
    border: 1.5px solid rgba(13, 148, 136, 0.15);
}

.action-btn.secondary:hover {
    background: #f0fdfa;
    color: var(--text-secondary);
}

.action-btn.danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
}

.action-btn.danger:hover {
    box-shadow: 0 8px 20px rgba(220, 38, 38, 0.35);
}

/* ─── Forms ─────────────────────────────────── */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    background: #f8fafc;
    border: 2px solid rgba(13, 148, 136, 0.15);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    transition: var(--transition-smooth);
}

.form-control:focus {
    outline: none;
    border-color: var(--text-secondary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

/* ─── Scrollbar Styling ─────────────────────── */
.main-content::-webkit-scrollbar {
    width: 6px;
}
.main-content::-webkit-scrollbar-track {
    background: transparent;
}
.main-content::-webkit-scrollbar-thumb {
    background: rgba(13, 148, 136, 0.25);
    border-radius: 10px;
}
.main-content::-webkit-scrollbar-thumb:hover {
    background: rgba(13, 148, 136, 0.45);
}

/* ─── Responsive ────────────────────────────── */
@media (max-width: 1400px) {
    .dashboard-grid {
        grid-template-columns: 2fr 1fr;
    }
}

@media (max-width: 1200px) {
    .dashboard-grid,
    .dashboard-grid.equal {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 72px;
        padding: 1.5rem 0.5rem;
        align-items: center;
        gap: 1.5rem;
    }
    .brand-name,
    .nav-text {
        display: none;
    }
    .brand-icon {
        margin: 0 auto;
    }
    .nav-link {
        justify-content: center;
        padding: 0.875rem;
    }
    .nav-link.active::before {
        display: none;
    }
    .main-content {
        padding: 1.5rem;
    }
}

@media (max-width: 640px) {
    .main-content {
        padding: 1rem;
    }
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* =============================================
   Multi-Sectoral Navigation and Grid Colors
   ============================================= */
.sector-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.sector-card {
    background: var(--panel-bg);
    border: 1.5px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    cursor: pointer;
    box-shadow: var(--card-shadow);
    transition: var(--transition-smooth);
    user-select: none;
    position: relative;
    overflow: hidden;
}

.sector-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    transition: var(--transition-smooth);
}

.sector-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.08);
}

.sector-card.active {
    background: #ffffff;
    box-shadow: 0 10px 25px rgba(13, 148, 136, 0.06);
}

/* Human Sector Colors */
.sector-card.human:hover, .sector-card.human.active {
    border-color: var(--accent-teal);
}
.sector-card.human.active::after {
    background: var(--accent-teal);
}
.sector-card.human .sector-icon {
    background: #e6fffa;
    color: var(--accent-teal);
}

/* Animal Husbandry Sector Colors */
.sector-card.animal:hover, .sector-card.animal.active {
    border-color: var(--accent-amber);
}
.sector-card.animal.active::after {
    background: var(--accent-amber);
}
.sector-card.animal .sector-icon {
    background: #fffbeb;
    color: var(--accent-amber);
}

/* Fisheries Sector Colors */
.sector-card.fisheries:hover, .sector-card.fisheries.active {
    border-color: var(--accent-blue);
}
.sector-card.fisheries.active::after {
    background: var(--accent-blue);
}
.sector-card.fisheries .sector-icon {
    background: #e0f2fe;
    color: var(--accent-blue);
}

/* Food Sector Colors */
.sector-card.food:hover, .sector-card.food.active {
    border-color: var(--accent-green);
}
.sector-card.food.active::after {
    background: var(--accent-green);
}
.sector-card.food .sector-icon {
    background: #e8f5e9;
    color: var(--accent-green);
}

/* Drugs Sector Colors */
.sector-card.drugs:hover, .sector-card.drugs.active {
    border-color: var(--accent-purple);
}
.sector-card.drugs.active::after {
    background: var(--accent-purple);
}
.sector-card.drugs .sector-icon {
    background: #f3e8ff;
    color: var(--accent-purple);
}

.sector-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
    transition: var(--transition-smooth);
}

.sector-info {
    display: flex;
    flex-direction: column;
}

.sector-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.sector-desc {
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* Specific icon background classes */
.metric-icon.amber   { background: #fffbeb; color: var(--accent-amber); }
.metric-icon.purple  { background: #f3e8ff; color: var(--accent-purple); }
.metric-icon.emerald { background: #e8f5e9; color: var(--accent-green); }
.metric-icon.pink    { background: #fce7f3; color: #db2777; }

@media (max-width: 1200px) {
    .sector-nav {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .sector-nav {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .sector-nav {
        grid-template-columns: 1fr;
    }
}
