/* Aspire ArogyaPlus CRM – shared UI foundation */

:root {
    --aa-primary: #405189;
    --aa-primary-subtle: rgba(64, 81, 137, 0.1);
    --aa-success: #0ab39c;
    --aa-success-subtle: rgba(10, 179, 156, 0.1);
    --aa-warning: #f7b84b;
    --aa-warning-subtle: rgba(247, 184, 75, 0.12);
    --aa-danger: #f06548;
    --aa-danger-subtle: rgba(240, 101, 72, 0.1);
    --aa-info: #299cdb;
    --aa-info-subtle: rgba(41, 156, 219, 0.1);
    --aa-neutral: #878a99;
    --aa-neutral-subtle: rgba(135, 138, 153, 0.12);
    --aa-surface: var(--vz-card-bg, #fff);
    --aa-border: var(--vz-border-color, #e9ebec);
    --aa-text: var(--vz-body-color, #212529);
    --aa-text-muted: var(--vz-secondary-color, #878a99);
    --aa-radius: 0.5rem;
    --aa-radius-lg: 0.75rem;
    --aa-shadow-sm: 0 1px 2px rgba(56, 65, 74, 0.08);
    --aa-shadow: 0 2px 6px rgba(56, 65, 74, 0.1);
    --aa-transition: 150ms ease;
    --aa-header-height: 70px;
}

[data-bs-theme="dark"] {
    --aa-surface: var(--vz-card-bg, #1a1d21);
    --aa-border: var(--vz-border-color, #32383e);
}

/* Page header */
.aa-page-header {
    margin-bottom: 1.25rem;
}

.aa-page-header .aa-page-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--aa-text);
}

.aa-page-header .aa-page-description {
    font-size: 0.875rem;
    color: var(--aa-text-muted);
    margin-bottom: 0;
}

/* Partner context banner */
.aa-partner-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    margin-bottom: 1rem;
    background: var(--aa-primary-subtle);
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius);
    font-size: 0.875rem;
}

.aa-partner-banner__label {
    color: var(--aa-text-muted);
    font-weight: 500;
}

.aa-partner-banner__value {
    font-weight: 600;
    color: var(--aa-primary);
}

/* KPI cards */
.aa-kpi-card {
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius-lg);
    box-shadow: var(--aa-shadow-sm);
    transition: box-shadow var(--aa-transition);
    height: 100%;
}

.aa-kpi-card:hover {
    box-shadow: var(--aa-shadow);
}

.aa-kpi-card .aa-kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--aa-text-muted);
    margin-bottom: 0.5rem;
}

.aa-kpi-card .aa-kpi-value {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0;
    font-variant-numeric: tabular-nums;
}

.aa-kpi-card .aa-kpi-meta {
    font-size: 0.8125rem;
    color: var(--aa-text-muted);
    margin-top: 0.375rem;
}

/* Status badges */
.aa-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.aa-status-badge--success {
    background: var(--aa-success-subtle);
    color: var(--aa-success);
}

.aa-status-badge--danger {
    background: var(--aa-danger-subtle);
    color: var(--aa-danger);
}

.aa-status-badge--warning {
    background: var(--aa-warning-subtle);
    color: #b8860b;
}

.aa-status-badge--info {
    background: var(--aa-info-subtle);
    color: var(--aa-info);
}

.aa-status-badge--neutral {
    background: var(--aa-neutral-subtle);
    color: var(--aa-neutral);
}

/* Panel / card polish */
.aa-panel {
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius-lg);
    background: var(--aa-surface);
    box-shadow: var(--aa-shadow-sm);
}

.aa-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--aa-border);
}

.aa-panel-title {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
}

.aa-panel-body {
    padding: 1.25rem;
}

/* Filter bar */
.aa-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.aa-filter-bar .form-label {
    font-size: 0.8125rem;
    margin-bottom: 0.25rem;
}

/* Tables */
.aa-table-wrap {
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius);
    overflow: hidden;
}

.aa-table-wrap .table {
    margin-bottom: 0;
}

.aa-table-wrap .table > :not(caption) > * > * {
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
}

.aa-table-wrap .table thead th {
    background: var(--vz-light, #f3f6f9);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--aa-text-muted);
    white-space: nowrap;
}

.aa-table-numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Compact row actions */
.aa-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.aa-row-actions .btn {
    padding: 0.2rem 0.55rem;
    font-size: 0.8125rem;
}

/* Empty / loading / error states */
.aa-empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--aa-text-muted);
}

.aa-empty-state__icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.aa-empty-state__title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--aa-text);
    margin-bottom: 0.25rem;
}

.aa-empty-state__text {
    font-size: 0.875rem;
    margin-bottom: 0;
}

.aa-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(2px);
}

[data-bs-theme="dark"] .aa-loading-overlay {
    background: rgba(26, 29, 33, 0.8);
}

.aa-loading-overlay[hidden] {
    display: none !important;
}

.aa-alert-inline {
    border-radius: var(--aa-radius);
    font-size: 0.875rem;
}

/* Modal sections */
.aa-form-section {
    margin-bottom: 1.25rem;
}

.aa-form-section:last-child {
    margin-bottom: 0;
}

.aa-form-section__title {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--aa-text-muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--aa-border);
}

/* Chart panels */
.aa-chart-panel {
    border: 1px solid var(--aa-border);
    border-radius: var(--aa-radius-lg);
    padding: 1rem;
    height: 100%;
}

.aa-chart-panel__title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.aa-chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--aa-text-muted);
    font-size: 0.875rem;
}

/* Focus rings */
.aa-focus-ring:focus,
.aa-focus-ring:focus-visible {
    outline: 2px solid var(--aa-primary);
    outline-offset: 2px;
}

/* Horizontal nav polish */
.navbar-menu .navbar-nav .nav-link.menu-link {
    font-size: 0.875rem;
    font-weight: 500;
}

.navbar-menu .navbar-nav .nav-link.active,
.navbar-menu .navbar-nav .nav-link[aria-expanded="true"] {
    color: var(--aa-primary);
}

/* Topbar cleanup */
#page-topbar .logo-lg img {
    max-height: 48px;
    width: auto;
    object-fit: contain;
}

#page-topbar .user-name-text {
    font-size: 0.875rem;
}

/* Auth page polish */
.aa-auth-card .form-label {
    font-size: 0.875rem;
    font-weight: 500;
}

.aa-auth-card .btn-primary {
    min-height: 2.5rem;
}

/* Responsive helpers */
@media (max-width: 767.98px) {
    .aa-page-header .aa-page-title {
        font-size: 1.25rem;
    }

    .aa-kpi-card .aa-kpi-value {
        font-size: 1.5rem;
    }

    .aa-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .aa-panel-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 390px) {
    .aa-row-actions {
        flex-direction: column;
    }

    .aa-row-actions .btn {
        width: 100%;
    }
}

#ottPlanMapping .form-select-sm {
    min-height: 2rem;
}

@media (max-width: 767.98px) {
    #tblOttMaps thead {
        display: none;
    }

    #tblOttMaps tbody tr {
        display: block;
        padding: 0.75rem;
        border-bottom: 1px solid var(--aa-border);
    }

    #tblOttMaps tbody td {
        display: block;
        padding: 0.25rem 0;
        border: 0;
    }

    #tblOttMaps tbody td:last-child .btn {
        width: 100%;
    }
}
