/* NBC Procedure Analytics Dashboard Styles */

:root {
    --primary-green: #2E7D32;
    --primary-green-light: #4CAF50;
    --primary-green-dark: #1B5E20;
    --accent-blue: #1976D2;
    --bg-light: #F5F7FA;
    --bg-white: #FFFFFF;
    --text-dark: #1A1A2E;
    --text-gray: #64748B;
    --text-light: #94A3B8;
    --positive: #16A34A;
    --negative: #DC2626;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #e8f5e9 0%, #f5f7fa 50%, #e3f2fd 100%);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
}

/* App Container - Grid Layout with Sidebar */
.app-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    background: linear-gradient(180deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    color: white;
    padding: 24px 16px;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-logo img {
    width: 150px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.sidebar-logo div {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    font-weight: 600;
}

.nav-link::before {
    content: attr(data-icon);
    font-size: 18px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
}

/* Main Content Area */
.main-content {
    background: var(--bg-light);
    overflow-x: hidden;
}

/* Dashboard Views - Toggle Visibility */
.dashboard-view {
    display: none;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-view.active {
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: -250px;
        top: 0;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    border-radius: 0;
    padding: 48px 40px;
    margin-bottom: 32px;
    color: white;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    font-size: 48px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.period-selector {
    display: flex;
    align-items: center;
    gap: 24px;
    background: rgba(255, 255, 255, 0.15);
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.selector-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.period-selector label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.95;
    color: white;
}

.period-selector select {
    background: white;
    border: none;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-green-dark);
    cursor: pointer;
    appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231B5E20' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.main-title {
    font-size: 42px;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: -1px;
}

/* Section Titles */
.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* PowerPoint-Style Summary Section */
.summary-section {
    margin-bottom: 32px;
}

.summary-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
}

.summary-left {
    background: var(--bg-white);
    border: 3px solid var(--primary-green);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.summary-kpi-item {
    text-align: center;
}

.summary-kpi-label {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.summary-kpi-percent {
    font-size: 28px;
    font-weight: 700;
}

.summary-kpi-percent.negative {
    color: #DC2626;
}

.summary-kpi-percent.positive {
    color: #16A34A;
}

.summary-kpi-values {
    font-size: 13px;
    color: var(--text-gray);
}

.summary-right {
    background: var(--bg-white);
    border: 3px solid var(--primary-green);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.summary-proc-item {
    text-align: center;
    padding: 12px;
    background: #FAFAFA;
    border-radius: var(--radius-sm);
}

.summary-proc-item.new {
    background: #E8F5E9;
}

.summary-proc-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.summary-proc-percent {
    font-size: 22px;
    font-weight: 700;
}

.summary-proc-percent.negative {
    color: #DC2626;
}

.summary-proc-percent.positive {
    color: #16A34A;
}

.summary-proc-values {
    font-size: 11px;
    color: var(--text-gray);
}

@media (max-width: 1200px) {
    .summary-container {
        grid-template-columns: 1fr;
    }

    .summary-left {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 800px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* KPI Section */
.kpi-section {
    margin-bottom: 32px;
}

.kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

/* Grid Column Helpers */
.kpi-cards.three-col {
    grid-template-columns: repeat(3, 1fr);
}

.kpi-cards.four-col {
    grid-template-columns: repeat(4, 1fr);
}

.kpi-cards.seven-col {
    grid-template-columns: repeat(7, 1fr);
}

/* Responsive adjustments for narrow grids */
@media (max-width: 1400px) {
    .kpi-cards.seven-col {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1024px) {
    .kpi-cards.seven-col, 
    .kpi-cards.four-col,
    .kpi-cards.three-col {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

.kpi-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 28px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.kpi-icon {
    width: 72px;
    /* Increased from 64px */
    height: 72px;
    /* Increased from 64px */
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
    background: #ffffff !important;
    border: 2px solid var(--primary-green);
    /* Added strong green border */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
}

.kpi-icon img {
    width: 48px;
    /* Increased from 40px */
    height: 48px;
    object-fit: contain;
}

.logo-img {
    height: 60px;
    /* Increased from 48px */
    width: auto;
    object-fit: contain;
}

/* Vertical Layout for Procedure Cards - RESTORED */
.procedures-cards .kpi-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.procedures-cards .kpi-content {
    width: 100%;
}

.procedures-cards .kpi-values {
    justify-content: center;
}

.procedures-cards .procedure-details {
    width: 100%;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* Override existing gradients with white, handled by base class !important */
.kpi-icon.enquiry,
.kpi-icon.consultation,
.kpi-icon.procedure,
.kpi-icon.balloon,
.kpi-icon.surgery,
.kpi-icon.injectable,
.kpi-icon.psychotherapy,
.kpi-icon.removal,
.kpi-icon.bowel,
.kpi-icon.diykits {
    background: #ffffff !important;
}

.procedures-cards.four-col {
    grid-template-columns: repeat(4, 1fr);
}

.procedures-cards.seven-col {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1200px) {

    .procedures-cards.four-col,
    .procedures-cards.seven-col,
    .kpi-cards.three-col {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {

    .procedures-cards.four-col,
    .procedures-cards.seven-col,
    .kpi-cards.three-col {
        grid-template-columns: 1fr;
    }
}

.kpi-cards.three-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.section-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.procedure-details {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--text-gray);
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
}

.detail-item.stacked {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 12px;
}

.detail-item.split {
    font-size: 12px;
    /* Smaller to fit side-by-side */
    justify-content: space-between;
}

.detail-item.split .sep {
    color: rgba(0, 0, 0, 0.2);
    margin: 0 4px;
}

.detail-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.detail-item.stacked>span:first-child {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--primary-color);
}

.detail-item>div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 8px;
    font-weight: 500;
}

.detail-change {
    font-size: 13px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.detail-change.positive {
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.detail-change.negative {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.detail-item-sub {
    font-size: 13px;
    color: var(--text-light);
    font-style: italic;
}



.detail-item span:first-child {
    font-weight: 500;
}

.detail-item-sub {
    font-size: 11px;
    color: var(--text-light);
    font-style: italic;
}

.new-tag {
    display: inline-block;
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
}

.kpi-value.dim {
    opacity: 0.4;
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 8px;
}

.kpi-values {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
}

.kpi-vs {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

.kpi-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
}

.kpi-change.positive {
    background: rgba(22, 163, 74, 0.1);
    color: var(--positive);
}

.kpi-change.negative {
    background: rgba(220, 38, 38, 0.1);
    color: var(--negative);
}

/* Charts Section */
.charts-section {
    margin-bottom: 32px;
}

.chart-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 24px;
}

.chart-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 28px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-row+.chart-row {
    margin-top: 24px;
}

.chart-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 20px;
}

/* Procedure Breakdown */
.procedures-section {
    margin-bottom: 32px;
}

.procedure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.procedure-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease;
}

.procedure-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.procedure-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.procedure-values {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.procedure-year {
    text-align: center;
}

.procedure-year-label {
    font-size: 11px;
    color: var(--text-light);
    font-weight: 500;
}

.procedure-year-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
}

.procedure-arrow {
    font-size: 18px;
    color: var(--text-light);
}

.procedure-change {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}

.procedure-change.positive {
    background: rgba(22, 163, 74, 0.1);
    color: var(--positive);
}

.procedure-change.negative {
    background: rgba(220, 38, 38, 0.1);
    color: var(--negative);
}

/* New in 2025 Section */
.new-procedures-section {
    margin-bottom: 32px;
}

.new-badge {
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.new-procedure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.new-procedure-card {
    background: linear-gradient(135deg, #FFF8E1, #FFECB3);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 2px solid #FFD54F;
    position: relative;
    overflow: hidden;
}

.new-procedure-card::before {
    content: 'NEW';
    position: absolute;
    top: 12px;
    right: -28px;
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 32px;
    transform: rotate(45deg);
}

.new-procedure-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.new-procedure-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-green-dark);
}

.new-procedure-label {
    font-size: 12px;
    color: var(--text-gray);
    font-weight: 500;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-gray);
    font-size: 13px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard {
        padding: 16px;
    }

    .header {
        padding: 24px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .logo h1 {
        font-size: 22px;
    }

    .period-selector {
        width: 100%;
        justify-content: space-between;
    }

    .chart-row {
        grid-template-columns: 1fr;
    }

    .kpi-cards {
        grid-template-columns: 1fr;
    }

    /* Sidebar Layout Styles */
    .app-container {
        display: flex;
        min-height: 100vh;
    }

    .sidebar {
        width: 280px;
        background: linear-gradient(180deg, #1B5E20 0%, #0d3810 100%);
        color: white;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        padding: 24px 0;
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
        box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
        z-index: 100;
    }

    .main-content {
        flex: 1;
        background: var(--bg-light);
        padding: 32px 40px;
        overflow-x: hidden;
    }

    /* Sidebar Branding */
    .sidebar-logo {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 0 24px 24px;
        margin-bottom: 24px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .sidebar-logo img {
        height: 40px;
        filter: brightness(0) invert(1);
    }

    .sidebar-logo div {
        font-weight: 700;
        font-size: 16px;
        line-height: 1.2;
    }

    /* Navigation */
    .nav-menu {
        list-style: none;
        padding: 0 16px;
        flex: 1;
    }

    .nav-item {
        margin-bottom: 6px;
    }

    .nav-link {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        color: rgba(255, 255, 255, 0.7);
        text-decoration: none;
        border-radius: 8px;
        transition: all 0.2s ease;
        font-weight: 500;
        font-size: 14px;
        cursor: pointer;
    }

    .nav-link:hover {
        background: rgba(255, 255, 255, 0.08);
        color: white;
        transform: translateX(4px);
    }

    .nav-link.active {
        background: rgba(255, 255, 255, 0.15);
        color: white;
        font-weight: 600;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    .nav-icon {
        font-size: 18px;
        width: 24px;
        text-align: center;
    }

    /* Footer in Sidebar */
    .sidebar-footer {
        padding: 24px;
        font-size: 11px;
        color: rgba(255, 255, 255, 0.4);
        text-align: center;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* View Toggling */
    .dashboard-view {
        display: none;
        animation: fadeIn 0.3s ease;
    }

    .dashboard-view.active {
        display: block;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Mobile Sidebar logic */
    @media (max-width: 1024px) {
        .app-container {
            flex-direction: column;
        }

        .sidebar {
            width: 100%;
            height: auto;
            position: relative;
            padding: 16px 0;
        }

        .sidebar-logo {
            justify-content: center;
        }

        .nav-menu {
            display: flex;
            overflow-x: auto;
            padding-bottom: 8px;
            -webkit-overflow-scrolling: touch;
        }

        .nav-item {
            margin: 0 4px;
            flex-shrink: 0;
        }

        .nav-link {
            flex-direction: column;
            gap: 6px;
            padding: 8px 16px;
            text-align: center;
            font-size: 12px;
        }

        .nav-link:hover {
            transform: none;
        }

        .main-content {
            padding: 16px;
        }
    }
}

/* ===== Calendar Picker ===== */
@keyframes calFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cal-month-btn {
    background: #f1f5f9;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 8px 4px;
    font-size: 12px;
    font-weight: 600;
    color: #1B5E20;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
    width: 100%;
}

.cal-month-btn:hover {
    background: #dcfce7;
    border-color: #4CAF50;
    transform: scale(1.04);
}

.cal-month-btn.active {
    background: #2E7D32;
    color: white;
    border-color: #2E7D32;
    box-shadow: 0 3px 8px rgba(46,125,50,0.35);
}

.cal-range-btn {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    padding: 7px 6px;
    font-size: 11px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
    width: 100%;
}

.cal-range-btn:hover {
    background: #dcfce7;
    border-color: #4CAF50;
    color: #1B5E20;
}

.cal-range-btn.active {
    background: #2E7D32;
    color: white;
    border-color: #2E7D32;
}
