/* =========================================================
   UNIDA Gateway Unified Dashboard Styles
   File: assets/css/dashboard.css

   Use inside includes/header.php after main.css:
   <link rel="stylesheet" href="<?= e(asset_url('css/main.css')); ?>">
   <link rel="stylesheet" href="<?= e(asset_url('css/dashboard.css')); ?>">
========================================================= */

:root {
    --primary-blue: #0A5DB7;
    --deep-blue: #083B7A;
    --sky-blue: #4CC1E0;
    --light-aqua: #DDF3FB;
    --primary-green: #28A745;
    --teal-green: #20C997;
    --dark-green: #0E7C6B;
    --light-gray: #F2F6F9;
    --text-dark: #1D2939;
    --white: #FFFFFF;
    --muted: #667085;
    --border: rgba(8, 59, 122, 0.12);
    --border-strong: rgba(8, 59, 122, 0.18);
    --shadow-soft: 0 18px 44px rgba(8, 59, 122, 0.10);
    --shadow-card: 0 10px 28px rgba(8, 59, 122, 0.08);
    --radius: 24px;

    --gradient-main: linear-gradient(135deg, #083B7A 0%, #0A5DB7 55%, #4CC1E0 100%);
    --gradient-green: linear-gradient(135deg, #0E7C6B 0%, #20C997 100%);
    --gradient-growth: linear-gradient(135deg, #0A5DB7 0%, #20C997 100%);
    --gradient-admin: linear-gradient(135deg, #071529 0%, #083B7A 58%, #0A5DB7 100%);
    --gradient-investor: linear-gradient(135deg, #083B7A 0%, #0A5DB7 52%, #20C997 100%);
    --gradient-stakeholder: linear-gradient(135deg, #083B7A 0%, #0E7C6B 55%, #20C997 100%);
}

/* GLOBAL DASHBOARD FIXES */
.dashboard-page,
.dashboard-page * {
    box-sizing: border-box;
}

.dashboard-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 10% 2%, rgba(76, 193, 224, 0.16), transparent 28%),
        radial-gradient(circle at 96% 22%, rgba(32, 201, 151, 0.12), transparent 28%),
        var(--light-gray);
}

.dashboard-page a {
    text-decoration: none;
}

.dashboard-page .container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

/* DASHBOARD HERO */
.dashboard-hero {
    color: var(--white);
    background:
        radial-gradient(circle at 12% 18%, rgba(221, 243, 251, 0.22), transparent 32%),
        var(--gradient-main);
    padding: 48px 0 34px;
}

.dashboard-hero.admin {
    background:
        radial-gradient(circle at 12% 18%, rgba(76, 193, 224, 0.22), transparent 32%),
        var(--gradient-admin);
}

.dashboard-hero.investor {
    background:
        radial-gradient(circle at 12% 18%, rgba(32, 201, 151, 0.22), transparent 32%),
        var(--gradient-investor);
}

.dashboard-hero.stakeholder {
    background:
        radial-gradient(circle at 12% 18%, rgba(221, 243, 251, 0.20), transparent 32%),
        var(--gradient-stakeholder);
}

.dashboard-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 24px;
    align-items: center;
}

.dashboard-hero h1 {
    font-size: clamp(30px, 4vw, 50px);
    line-height: 1.05;
    letter-spacing: -1.5px;
    margin: 0 0 14px;
}

.dashboard-hero p {
    max-width: 780px;
    color: rgba(255, 255, 255, 0.86);
    font-size: 16px;
    line-height: 1.65;
    margin: 0;
}

.dashboard-hero .page-kicker {
    color: var(--white);
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.dashboard-profile-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(16px);
}

.profile-avatar {
    flex: 0 0 62px;
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    color: var(--white);
    background: var(--gradient-growth);
    border-radius: 22px;
    font-size: 18px;
    font-weight: 900;
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.16);
}

.admin-avatar {
    background: linear-gradient(135deg, #071529, var(--sky-blue));
}

.investor-avatar {
    background: var(--gradient-green);
}

.dashboard-profile-card h3 {
    margin: 0 0 4px;
    color: var(--white);
    font-size: 18px;
}

.dashboard-profile-card p {
    margin: 0 0 8px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 13px;
}

/* DASHBOARD MAIN SHELL */
.dashboard-shell {
    padding: 26px 0 76px;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.dashboard-main {
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
}

.dashboard-main .container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
}

.dashboard-content {
    min-width: 0;
    display: grid;
    gap: 18px;
    padding-right: 0;
}

/* SIDEBAR */
.dashboard-sidebar {
    position: sticky;
    top: 96px;
    width: 100%;
    max-height: calc(100vh - 112px);
    display: grid;
    gap: 12px;
    padding: 16px 16px 16px 22px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(10, 93, 183, 0.45) rgba(8, 59, 122, 0.08);
}

.dashboard-sidebar::-webkit-scrollbar {
    width: 10px;
}

.dashboard-sidebar::-webkit-scrollbar-track {
    background: rgba(8, 59, 122, 0.08);
    border-radius: 999px;
}

.dashboard-sidebar::-webkit-scrollbar-thumb {
    background: rgba(10, 93, 183, 0.45);
    border-radius: 999px;
}

.dashboard-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(10, 93, 183, 0.62);
}

.sidebar-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 6px 12px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--light-aqua);
    border: 1px solid rgba(10, 93, 183, 0.10);
}

.sidebar-dot {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: var(--gradient-growth);
}

.sidebar-head strong {
    display: block;
    color: var(--deep-blue);
    font-size: 14px;
    line-height: 1.15;
}

.sidebar-head small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.sidebar-nav,
.sidebar-footer {
    display: grid;
    gap: 7px;
}

.sidebar-nav a,
.sidebar-footer a,
.dashboard-sidebar > a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #475467;
    padding: 12px 13px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: 850;
    transition: 0.2s ease;
}

.sidebar-nav a i,
.sidebar-footer a i,
.dashboard-sidebar > a i {
    width: 18px;
    text-align: center;
    color: var(--primary-blue);
}

.sidebar-nav a:hover,
.sidebar-nav a.active,
.sidebar-footer a:hover,
.dashboard-sidebar > a:hover,
.dashboard-sidebar > a.active {
    color: var(--primary-blue);
    background: var(--light-aqua);
    transform: translateX(2px);
}

.sidebar-footer {
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.logout-link {
    color: #991b1b !important;
    background: #fff5f5;
}

.logout-link i {
    color: #dc2626 !important;
}

/* DASHBOARD GRIDS */
.dashboard-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.dashboard-main-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

/* STAT CARDS */
.dash-stat {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 18px;
    border-radius: 22px;
    background: var(--white);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

.dash-icon {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 17px;
    color: var(--white);
    background: var(--gradient-main);
}

.dash-icon.green {
    background: var(--gradient-green);
}

.dash-icon.cyan {
    background: linear-gradient(135deg, var(--sky-blue), var(--teal-green));
}

.dash-icon.dark {
    background: linear-gradient(135deg, var(--deep-blue), #071529);
}

.dash-stat strong {
    display: block;
    color: var(--deep-blue);
    font-size: 23px;
    line-height: 1;
    margin-bottom: 5px;
    word-break: break-word;
}

.dash-stat small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

/* PANELS */
.dashboard-panel,
.info-card,
.auth-card {
    padding: 22px;
    border-radius: var(--radius);
    background: var(--white);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.panel-head h3,
.info-card h3 {
    color: var(--deep-blue);
    margin: 0 0 5px;
}

.panel-head p,
.info-card p {
    color: var(--muted);
    margin: 0;
    line-height: 1.6;
}

/* CARDS GRID */
.cards-grid {
    display: grid;
    gap: 18px;
}

.three-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 17px;
    display: grid;
    place-items: center;
    color: var(--white);
    background: var(--gradient-main);
    margin-bottom: 14px;
}

/* LISTS */
.task-list,
.activity-list,
.pipeline-list {
    display: grid;
    gap: 10px;
}

.task,
.activity-list div,
.pipeline-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 14px;
    border-radius: 16px;
    background: #f8fcff;
    border: 1px solid rgba(8, 59, 122, 0.08);
    color: #475467;
    font-size: 14px;
    font-weight: 750;
}

.task {
    justify-content: flex-start;
}

.task i,
.activity-list i {
    color: var(--primary-blue);
}

.task.done i {
    color: var(--primary-green);
}

.pipeline-list span {
    color: var(--muted);
}

.pipeline-list strong {
    color: var(--deep-blue);
    font-size: 13px;
    text-align: right;
}

/* STATUS BADGES */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.status-progress {
    color: var(--deep-blue);
    background: var(--light-aqua);
}

.status-verified {
    color: var(--dark-green);
    background: rgba(32, 201, 151, 0.16);
}

.status-open {
    color: var(--primary-blue);
    background: rgba(76, 193, 224, 0.16);
}

/* TOP NAV ROLE */
.role-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--deep-blue);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.role-indicator i {
    color: var(--primary-blue);
}

/* FUNDING / OPPORTUNITY */
.funding-card,
.opportunity-card {
    padding: 18px;
    border-radius: 20px;
    background:
        radial-gradient(circle at 95% 10%, rgba(76, 193, 224, 0.20), transparent 28%),
        var(--light-gray);
    border: 1px solid rgba(8, 59, 122, 0.08);
}

.funding-card strong {
    display: block;
    color: var(--deep-blue);
    font-size: 34px;
    line-height: 1;
    margin-bottom: 6px;
}

.funding-card span,
.funding-card small,
.opportunity-card p,
.opportunity-meta span {
    color: var(--muted);
}

.opportunity-card h4 {
    color: var(--deep-blue);
    margin: 0 0 8px;
}

.opportunity-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.opportunity-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--white);
    border: 1px solid var(--border);
    font-size: 12px;
    font-weight: 800;
}

.progress-bar {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(10, 93, 183, 0.12);
    margin: 16px 0 8px;
}

.progress-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--gradient-growth);
}

/* TABLES */
.dashboard-table-wrap {
    overflow-x: auto;
    border-radius: 18px;
    border: 1px solid var(--border);
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

.dashboard-table th,
.dashboard-table td {
    padding: 13px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.dashboard-table th {
    color: var(--deep-blue);
    background: #f8fcff;
    font-weight: 900;
}

.dashboard-table td {
    color: #475467;
    font-weight: 650;
}

/* FORMS + ALERTS */
.form-alert {
    padding: 14px 16px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 750;
}

.form-alert p {
    margin: 0;
}

.form-alert p + p {
    margin-top: 6px;
}

.form-alert-error {
    color: #991b1b;
    background: #fee2e2;
    border: 1px solid #fecaca;
}

.form-alert-success {
    color: #065f46;
    background: #d1fae5;
    border: 1px solid #a7f3d0;
}

/* BUSINESS WORKSPACE FORMS */
.dashboard-panel .form-group small {
    color: #344054;
    font-size: 13px;
    font-weight: 800;
}

.dashboard-panel .form-control {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 11px 13px;
    font: inherit;
    background: var(--white);
}

.dashboard-panel textarea.form-control {
    min-height: 110px;
    resize: vertical;
}

.dashboard-panel .form-control:focus {
    outline: none;
    border-color: var(--sky-blue);
    box-shadow: 0 0 0 4px rgba(76, 193, 224, 0.18);
}

.readiness-item {
    display: block;
}

.readiness-check {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #344054;
    font-weight: 700;
}

/* RESPONSIVE */
@media (max-width: 1080px) {
    .dashboard-hero-grid,
    .dashboard-layout,
    .dashboard-main-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-sidebar {
        position: static;
        left: auto;
        width: auto;
        max-height: none;
        overflow: visible;
        scrollbar-width: auto;
        padding-left: 16px;
    }

    .dashboard-main {
        margin-left: 0;
    }

    .dashboard-content {
        padding-right: 0;
    }

    .sidebar-nav,
    .sidebar-footer {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 760px) {
    .dashboard-layout {
        width: min(100% - 24px, 1180px);
    }

    .dashboard-page .container {
        width: min(100% - 24px, 1180px);
    }

    .dashboard-main .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .dashboard-hero {
        padding: 34px 0 24px;
    }

    .dashboard-hero h1 {
        font-size: 30px;
    }

    .dashboard-profile-card,
    .panel-head {
        display: grid;
    }

    .sidebar-nav,
    .sidebar-footer,
    .dashboard-stat-grid,
    .cards-grid.three-columns,
    .cards-grid.two-columns {
        grid-template-columns: 1fr;
    }

    .task,
    .activity-list div,
    .pipeline-list div {
        align-items: flex-start;
        flex-direction: column;
    }

    .pipeline-list strong {
        text-align: left;
    }

    .dash-stat {
        padding: 16px;
    }
}