/* ============================================================
   LeverBC Portal - Executive Theme
   Primary Color: Indigo (#6366F1)
   ============================================================ */

/* CSS Variables - Theme Colors */
:root {
    /* Primary Brand Colors - Indigo */
    --lbc-primary: #6366F1;
    --lbc-primary-hover: #4F46E5;
    --lbc-primary-light: #EEF2FF;
    --lbc-primary-subtle: #E0E7FF;
    --lbc-primary-dark: #4338CA;

    /* Background Colors */
    --lbc-bg-main: #F8FAFC;
    --lbc-bg-card: #FFFFFF;
    --lbc-bg-sidebar: #FAFAFA;
    --lbc-bg-header: #F1F5F9;

    /* Text Colors */
    --lbc-text-primary: #1E293B;
    --lbc-text-secondary: #475569;
    --lbc-text-muted: #64748B;
    --lbc-text-on-primary: #FFFFFF;

    /* Financial Colors */
    --lbc-positive: #059669;
    --lbc-positive-bg: #D1FAE5;
    --lbc-negative: #DC2626;
    --lbc-negative-bg: #FEE2E2;
    --lbc-neutral: #6B7280;

    /* Status Colors */
    --lbc-success: #10B981;
    --lbc-warning: #F59E0B;
    --lbc-error: #EF4444;
    --lbc-info: #3B82F6;

    /* Report Styles */
    --lbc-section-header: #E0E7FF;
    --lbc-section-total: #4F46E5;
    --lbc-row-alternate: #F8FAFC;
    --lbc-row-hover: #EEF2FF;
    --lbc-row-selected: #DBEAFE;

    /* Borders & Shadows */
    --lbc-border: #E2E8F0;
    --lbc-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --lbc-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --lbc-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   Base Styles
   ============================================================ */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--lbc-bg-main);
    color: var(--lbc-text-primary);
    line-height: 1.6;
}

/* ============================================================
   Navigation
   ============================================================ */

.navbar {
    background: linear-gradient(135deg, var(--lbc-primary) 0%, var(--lbc-primary-dark) 100%) !important;
    box-shadow: var(--lbc-shadow-md);
    padding: 0.75rem 1rem;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.025em;
}

.navbar .nav-link {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85) !important;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: #FFFFFF !important;
    background: rgba(255, 255, 255, 0.15);
}

.navbar .dropdown-menu {
    border: none;
    border-radius: 0.75rem;
    box-shadow: var(--lbc-shadow-lg);
    margin-top: 0.5rem;
}

/* ============================================================
   Layout
   ============================================================ */

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    margin-top: 64px;
    padding: 1.5rem;
}

@media (min-width: 768px) {
    .main-content {
        padding: 2rem 2.5rem;
    }
}

/* ============================================================
   Cards - Executive Style
   ============================================================ */

.card {
    background: var(--lbc-bg-card);
    border: 1px solid var(--lbc-border);
    border-radius: 1rem;
    box-shadow: var(--lbc-shadow-sm);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--lbc-shadow-md);
}

.card-header {
    background: var(--lbc-bg-header);
    border-bottom: 1px solid var(--lbc-border);
    padding: 1rem 1.25rem;
    border-radius: 1rem 1rem 0 0 !important;
    font-weight: 600;
}

.card-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--lbc-text-primary);
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: var(--lbc-bg-header);
    border-top: 1px solid var(--lbc-border);
    padding: 1rem 1.25rem;
    border-radius: 0 0 1rem 1rem !important;
}

/* ============================================================
   Report Page Headers
   ============================================================ */

.report-page h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--lbc-text-primary);
    letter-spacing: -0.025em;
}

.report-page h1 i {
    color: var(--lbc-primary);
}

.report-page .text-muted {
    color: var(--lbc-text-muted) !important;
    font-size: 0.9rem;
}

/* ============================================================
   Report Options Panel - Executive Style
   ============================================================ */

.report-options-panel {
    background: linear-gradient(135deg, var(--lbc-primary-light) 0%, var(--lbc-bg-card) 100%);
    border: 1px solid var(--lbc-primary-subtle);
    border-left: 4px solid var(--lbc-primary);
}

.report-options-panel .card-header {
    background: transparent;
    border-bottom-color: var(--lbc-primary-subtle);
}

.report-options-panel .card-header h5 i {
    color: var(--lbc-primary);
}

/* ============================================================
   Tables - Professional Financial Look
   ============================================================ */

.table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.table thead th {
    background: var(--lbc-bg-header);
    border-bottom: 2px solid var(--lbc-primary-subtle);
    font-weight: 600;
    color: var(--lbc-text-primary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.875rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--lbc-border);
    vertical-align: middle;
}

.table tbody tr:hover td {
    background-color: var(--lbc-row-hover) !important;
}

/* Financial Amount Cells */
.table .text-end {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Total Rows - Executive Highlight */
.table .row-total,
.table tr.table-warning {
    background: linear-gradient(90deg, var(--lbc-primary-light) 0%, var(--lbc-primary-subtle) 100%) !important;
    font-weight: 600;
}

.table .row-total td,
.table tr.table-warning td {
    border-bottom: 2px solid var(--lbc-primary);
}

/* Section Header Rows */
.table .row-header {
    background: var(--lbc-section-header) !important;
    font-weight: 700;
}

/* Grand Total Row */
.table .row-grand-total {
    background: linear-gradient(90deg, var(--lbc-primary) 0%, var(--lbc-primary-dark) 100%) !important;
    color: var(--lbc-text-on-primary);
}

.table .row-grand-total td {
    border: none;
    padding: 1rem;
}

/* ============================================================
   Financial Amount Coloring
   ============================================================ */

.text-success,
.amount-positive {
    color: var(--lbc-positive) !important;
    font-weight: 600;
}

.text-danger,
.amount-negative {
    color: var(--lbc-negative) !important;
    font-weight: 600;
}

/* ============================================================
   KPI Cards - Executive Dashboard Style
   ============================================================ */

.kpi-card {
    border-radius: 1rem;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--lbc-primary);
}

.kpi-card.success::before { background: var(--lbc-success); }
.kpi-card.warning::before { background: var(--lbc-warning); }
.kpi-card.danger::before { background: var(--lbc-negative); }

.kpi-card .kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--lbc-text-primary);
    line-height: 1.2;
}

.kpi-card .kpi-label {
    font-size: 0.875rem;
    color: var(--lbc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* ============================================================
   Chart Container
   ============================================================ */

.chart-container {
    background: var(--lbc-bg-card);
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--lbc-border);
}

.chart-container h5 {
    color: var(--lbc-text-primary);
    font-weight: 600;
    margin-bottom: 1rem;
}

/* ============================================================
   Buttons - Executive Style
   ============================================================ */

.btn {
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--lbc-primary) 0%, var(--lbc-primary-dark) 100%);
    border: none;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--lbc-primary-hover) 0%, var(--lbc-primary-dark) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.4);
}

.btn-outline-primary {
    color: var(--lbc-primary);
    border-color: var(--lbc-primary);
}

.btn-outline-primary:hover {
    background: var(--lbc-primary);
    border-color: var(--lbc-primary);
}

.btn-success {
    background: linear-gradient(135deg, var(--lbc-success) 0%, #059669 100%);
    border: none;
}

/* ============================================================
   Form Controls
   ============================================================ */

.form-control,
.form-select {
    border-radius: 0.5rem;
    border-color: var(--lbc-border);
    padding: 0.625rem 0.875rem;
    font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--lbc-primary);
    box-shadow: 0 0 0 3px var(--lbc-primary-light);
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--lbc-text-secondary);
    margin-bottom: 0.375rem;
}

/* ============================================================
   Badges
   ============================================================ */

.badge {
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
}

.badge.bg-primary {
    background: var(--lbc-primary) !important;
}

.badge.bg-secondary {
    background: var(--lbc-text-muted) !important;
}

/* ============================================================
   Modal Styles
   ============================================================ */

.modal-content {
    border: none;
    border-radius: 1rem;
    box-shadow: var(--lbc-shadow-lg);
}

.modal-header {
    background: var(--lbc-bg-header);
    border-bottom: 1px solid var(--lbc-border);
    border-radius: 1rem 1rem 0 0;
    padding: 1.25rem 1.5rem;
}

.modal-title {
    font-weight: 600;
    color: var(--lbc-text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    background: var(--lbc-bg-header);
    border-top: 1px solid var(--lbc-border);
    border-radius: 0 0 1rem 1rem;
    padding: 1rem 1.5rem;
}

/* ============================================================
   Alerts
   ============================================================ */

.alert {
    border: none;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    font-weight: 500;
}

.alert-success {
    background: var(--lbc-positive-bg);
    color: var(--lbc-positive);
}

.alert-danger {
    background: var(--lbc-negative-bg);
    color: var(--lbc-negative);
}

.alert-info {
    background: #DBEAFE;
    color: #1D4ED8;
}

/* ============================================================
   Empty State
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--lbc-bg-header);
    border-radius: 1rem;
    border: 2px dashed var(--lbc-border);
}

.empty-state i {
    font-size: 3rem;
    color: var(--lbc-primary);
    opacity: 0.5;
}

.empty-state h5 {
    color: var(--lbc-text-primary);
    margin-top: 1rem;
}

.empty-state p {
    color: var(--lbc-text-muted);
    margin-bottom: 0;
}

/* ============================================================
   Loading Spinner
   ============================================================ */

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.spinner-border {
    color: var(--lbc-primary) !important;
    width: 3rem;
    height: 3rem;
}

.loading-spinner p {
    color: var(--lbc-text-muted);
    margin-top: 1rem;
    font-weight: 500;
}

/* ============================================================
   Drill-down Interactive Cells
   ============================================================ */

.cursor-pointer {
    cursor: pointer;
    transition: all 0.2s ease;
}

.cursor-pointer:hover {
    color: var(--lbc-primary) !important;
    text-decoration: underline;
}

.cursor-pointer .bi-search {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.cursor-pointer:hover .bi-search {
    opacity: 1;
}

/* ============================================================
   Balance Report - Executive Two-Column Layout
   ============================================================ */

.balance-report .card-header.bg-primary {
    background: linear-gradient(135deg, var(--lbc-primary) 0%, var(--lbc-primary-dark) 100%) !important;
}

.balance-report .card-header.bg-success {
    background: linear-gradient(135deg, var(--lbc-success) 0%, #047857 100%) !important;
}

/* ============================================================
   PyG Report Specific Styles
   ============================================================ */

.pyg-report .row-section-total {
    background: var(--lbc-section-header) !important;
}

.pyg-report .row-result {
    background: var(--lbc-primary-light) !important;
    border-left: 4px solid var(--lbc-primary);
}

/* ============================================================
   Login Page
   ============================================================ */

.login-page {
    background: linear-gradient(135deg, var(--lbc-primary) 0%, var(--lbc-primary-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-page .card {
    border: none;
    border-radius: 1.5rem;
    box-shadow: var(--lbc-shadow-lg);
    max-width: 420px;
    width: 100%;
}

.login-page .card-header {
    background: transparent;
    border: none;
    text-align: center;
    padding: 2rem 2rem 1rem;
}

.login-page .card-body {
    padding: 1.5rem 2rem 2rem;
}

/* ============================================================
   Responsive Adjustments
   ============================================================ */

@media (max-width: 768px) {
    .main-content {
        margin-top: 56px;
        padding: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .table {
        font-size: 0.8rem;
    }

    .table thead th,
    .table tbody td {
        padding: 0.5rem 0.75rem;
    }

    .kpi-card .kpi-value {
        font-size: 1.5rem;
    }

    h1 {
        font-size: 1.5rem;
    }
}

/* ============================================================
   Print Styles
   ============================================================ */

@media print {
    .navbar,
    .footer,
    .btn,
    .report-options-panel,
    .chart-container {
        display: none !important;
    }

    .main-content {
        margin-top: 0;
        padding: 0;
    }

    .card {
        border: none;
        box-shadow: none;
    }

    .table thead th {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ============================================================
   Blazor Framework Styles
   ============================================================ */

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--lbc-success);
}

.invalid {
    outline: 1px solid var(--lbc-error);
}

.validation-message {
    color: var(--lbc-error);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

#blazor-error-ui {
    background: var(--lbc-negative-bg);
    border-top: 2px solid var(--lbc-negative);
    bottom: 0;
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: var(--lbc-negative);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: var(--lbc-negative);
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: 0.5rem;
}

.blazor-error-boundary::after {
    content: "Ha ocurrido un error.";
}

/* Loading Progress */
.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--lbc-border);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--lbc-primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 600;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
    color: var(--lbc-text-primary);
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Cargando");
}

/* ============================================================
   Animation Utilities
   ============================================================ */

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

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}
