@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* =========================================================================
   LBPANEL DESIGN TOKENS
   Hybrid theme: light content area + dark sidebar. Tokens in :root describe
   the LIGHT context (default). The .sidebar selector re-declares the same
   variable names to give its descendants a DARK context via natural CSS
   variable cascade — no per-component overrides needed.
   ========================================================================= */

:root {
    /* ---- Brand (constant — same in both contexts) ---- */
    --brand-blue:        #1F4E8C; /* logo blue */
    --brand-blue-deep:   #143055;
    --brand-blue-bright: #2E6FBE;
    --brand-blue-glow:   #5B9DF9; /* lifted, ideal on dark */
    --brand-blue-soft:   #93BFFA;

    /* ---- Surfaces (light defaults) ---- */
    --bg-base:        #F4F6FB;                       /* page background */
    --bg-elevated:    #FFFFFF;                       /* modal */
    --bg-surface:     #FFFFFF;                       /* card */
    --bg-surface-2:   #F1F5F9;                       /* hover */
    --bg-card:        rgba(255, 255, 255, 0.82);     /* glass on light */

    /* ---- Borders ---- */
    --border-subtle:  rgba(15, 23, 42, 0.07);
    --border-strong:  rgba(15, 23, 42, 0.14);
    --border-color:   var(--border-subtle); /* legacy alias */

    /* ---- Text ---- */
    --text-primary:   #0F172A;
    --text-secondary: #475569;
    --text-muted:     #94A3B8;

    /* ---- Accents (use brand BLUE on light for contrast) ---- */
    --accent-primary:    var(--brand-blue);
    --accent-secondary:  var(--brand-blue-bright);
    --accent-on:         #FFFFFF;                    /* text sitting on accent */

    /* ---- Semantic / status ---- */
    --status-success: #2A8F70;
    --status-warning: #B27F25;
    --status-danger:  #B14444;
    --status-info:    var(--brand-blue-bright);
    --accent-success: var(--status-success);
    --accent-warning: var(--status-warning);

    /* ---- Gradients ---- */
    --gradient-brand:    linear-gradient(135deg, var(--brand-blue), var(--brand-blue-bright));
    --gradient-progress: linear-gradient(90deg, var(--brand-blue-bright), var(--brand-blue));
    --gradient-complete: linear-gradient(90deg, #2A8F70, var(--status-success));
    --gradient-warning:  linear-gradient(90deg, #B27F25, var(--status-warning));
    --gradient-danger:   linear-gradient(90deg, #A24747, var(--status-danger));

    /* ---- Bootstrap overrides ---- */
    --bs-primary: var(--brand-blue);
    --bs-info:    var(--brand-blue-bright);
    --bs-success: var(--status-success);
    --bs-warning: var(--status-warning);
    --bs-danger:  var(--status-danger);
    --bs-body-bg: transparent;
    --bs-body-color: var(--text-primary);
}

/* =========================================================================
   BASE
   ========================================================================= */

body {
    background-color: var(--bg-base) !important;
    color: var(--text-primary) !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
    margin: 0;
    overflow-x: hidden;
}

/* Bootstrap text utility classes — normalize against our token system so
   pages that say class="text-white" still read correctly when the active
   context happens to be light. */
.text-white     { color: var(--text-primary)   !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted     { color: var(--text-muted)     !important; }

/* =========================================================================
   AMBIENT BACKGROUND (light context — brand-blue blobs at low opacity)
   ========================================================================= */

.lbpanel-ambient {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
    background: radial-gradient(ellipse at top, #E6ECF5 0%, var(--bg-base) 60%);
}

.lbpanel-ambient .blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(110px);
    will-change: transform;
}

.lbpanel-ambient .blob-1 {
    width: 620px; height: 620px;
    top: -180px; left: -160px;
    background: radial-gradient(circle, var(--brand-blue) 0%, transparent 70%);
    opacity: 0.18;
    animation: lbpanel-drift-1 70s ease-in-out infinite;
}
.lbpanel-ambient .blob-2 {
    width: 540px; height: 540px;
    bottom: -160px; right: -120px;
    background: radial-gradient(circle, var(--brand-blue-bright) 0%, transparent 70%);
    opacity: 0.14;
    animation: lbpanel-drift-2 90s ease-in-out infinite;
}
.lbpanel-ambient .blob-3 {
    width: 480px; height: 480px;
    top: 35%; left: 45%;
    background: radial-gradient(circle, #CBD5E1 0%, transparent 70%);
    opacity: 0.55;
    animation: lbpanel-drift-3 80s ease-in-out infinite;
}

.lbpanel-particles {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.85;
}

@keyframes lbpanel-drift-1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(80px, 60px) scale(1.08); }
}
@keyframes lbpanel-drift-2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(-90px, -50px) scale(1.05); }
}
@keyframes lbpanel-drift-3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(-60px, 70px) scale(0.95); }
}

@media (prefers-reduced-motion: reduce) {
    .lbpanel-ambient .blob { animation: none !important; }
    .lbpanel-particles { display: none !important; }
}

/* =========================================================================
   GLASS CARD — primary surface (light glass on light bg)
   ========================================================================= */

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 24px;
    color: var(--text-primary);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.6) inset,
        0 8px 24px rgba(15, 23, 42, 0.06),
        0 1px 2px rgba(15, 23, 42, 0.04);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.25s ease,
                border-color 0.25s ease;
}

.glass-card:hover {
    transform: translateY(-3px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.8) inset,
        0 14px 32px rgba(15, 23, 42, 0.10),
        0 0 0 1px rgba(31, 78, 140, 0.10);
    border-color: rgba(31, 78, 140, 0.18);
}

/* =========================================================================
   TYPOGRAPHY
   ========================================================================= */

.gradient-text {
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6 { color: var(--text-primary); }

/* =========================================================================
   SIDEBAR — re-scope the same variable names to give descendants a DARK
   context. Anything inside .sidebar that reads var(--text-primary) etc.
   resolves to the dark-context value via CSS custom property cascade.
   ========================================================================= */

.sidebar {
    /* Re-declared dark tokens */
    --bg-surface:     #131822;
    --bg-card:        rgba(26, 32, 48, 0.6);
    --border-subtle:  rgba(255, 255, 255, 0.06);
    --border-strong:  rgba(255, 255, 255, 0.10);
    --text-primary:   #E8ECF1;
    --text-secondary: #9BA5B5;
    --text-muted:     #6B7384;
    --accent-primary: var(--brand-blue-glow);
    --accent-secondary: var(--brand-blue-soft);
    --accent-on:      #0A0E14;

    background-color: #0D1117 !important;
    background-image: none !important;
    border-right: 1px solid var(--border-subtle) !important;
    width: 250px !important;
    height: 100vh !important;
    position: fixed !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 10;
    color: var(--text-primary);
}

.sidebar .top-row {
    background-color: rgba(0, 0, 0, 0.35) !important;
    border-bottom: 1px solid var(--border-subtle) !important;
}

.sidebar-brand {
    padding: 20px 22px 18px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.30);
}
.sidebar-brand-title {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.sidebar-brand-subtitle {
    color: var(--brand-blue-glow);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    margin-top: 4px;
}

.nav-section-label {
    color: var(--text-muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    padding: 18px 24px 8px;
    font-weight: 600;
}

.sidebar .nav-scrollable {
    flex: 1 1 auto;
    overflow-y: auto;
    padding-top: 4px;
    padding-bottom: 8px;
}

.sidebar-footer-user {
    padding: 14px 16px 12px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sidebar-user-meta { min-width: 0; }
.sidebar-user-name {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
}
.btn-logout {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-logout:hover {
    background: rgba(217, 99, 99, 0.10);
    color: #ff8a8a !important;
    border-color: rgba(217, 99, 99, 0.30);
}

.sidebar-brand-badge {
    padding: 14px 16px 18px;
    text-align: center;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.20);
}
.brand-badge-caption {
    color: var(--text-muted);
    font-size: 0.66rem;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    margin: 0 0 8px;
}
.brand-badge-card {
    background: #FFFFFF;
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow:
        0 0 0 1px rgba(91, 157, 249, 0.10),
        0 6px 20px rgba(0, 0, 0, 0.45);
    display: inline-block;
    max-width: 150px;
}
.brand-badge-card img { width: 100%; height: auto; display: block; }

.sidebar .nav-link {
    color: var(--text-secondary);
    border-radius: 0 8px 8px 0;
    margin: 6px 16px 6px 0;
    padding: 12px 16px 12px 24px;
    border-left: 3px solid transparent;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.sidebar .nav-link:hover {
    background: rgba(91, 157, 249, 0.06) !important;
    color: var(--text-primary) !important;
}
.sidebar .nav-link.active {
    background: linear-gradient(90deg,
        rgba(91, 157, 249, 0.14),
        rgba(91, 157, 249, 0.02)) !important;
    color: var(--brand-blue-glow) !important;
    border-left: 3px solid var(--brand-blue-glow) !important;
    font-weight: 500;
    box-shadow: inset 0 0 20px rgba(91, 157, 249, 0.05);
}
.sidebar .nav-link span { margin-right: 12px; }

/* =========================================================================
   MAIN CONTENT AREA
   ========================================================================= */

.main-content {
    margin-left: 250px;
    padding: 40px;
    min-height: 100vh;
    width: calc(100% - 250px);
    position: relative;
    z-index: 1;
    color: var(--text-primary);
}

.page { display: flex; flex-direction: row; }

/* =========================================================================
   PROGRESS BARS — solid, no shimmer
   ========================================================================= */

.animated-progress {
    height: 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    overflow: hidden;
    position: relative;
}

.animated-progress-bar {
    height: 100%;
    background: var(--gradient-progress);
    border-radius: 999px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.animated-progress-bar--complete { background: var(--gradient-complete); }
.animated-progress-bar--warning  { background: var(--gradient-warning); }
.animated-progress-bar--danger   { background: var(--gradient-danger); }

/* =========================================================================
   TABLES (light)
   ========================================================================= */

.premium-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px;
    color: var(--text-primary);
}

.premium-table th {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.74rem;
    letter-spacing: 0.5px;
    padding: 0 16px 8px;
    text-align: left;
}

.premium-table td {
    background: #FFFFFF;
    padding: 14px 16px;
    border: none;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.premium-table tr td:first-child {
    border-radius: 8px 0 0 8px;
    border-left: 1px solid var(--border-subtle);
}
.premium-table tr td:last-child {
    border-radius: 0 8px 8px 0;
    border-right: 1px solid var(--border-subtle);
}

.premium-table tr:hover td {
    background: #F8FAFC;
    border-color: rgba(31, 78, 140, 0.20);
}

/* =========================================================================
   STATUS BADGES
   ========================================================================= */

.status-badge {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    display: inline-block;
}
.status-paid    { background: rgba(42, 143, 112, 0.14);  color: var(--status-success); }
.status-pending { background: rgba(178, 127, 37, 0.14);  color: var(--status-warning); }
.status-neutral { background: rgba(15, 23, 42, 0.06);    color: var(--text-secondary); }
.status-danger  { background: rgba(177, 68, 68, 0.14);   color: var(--status-danger); }
.status-info    { background: rgba(46, 111, 190, 0.14);  color: var(--brand-blue); }

.activity-badge,
.list-activity-card .activity-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

/* =========================================================================
   BUTTONS
   ========================================================================= */

.btn-brand {
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-bright));
    color: #FFFFFF !important;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    padding: 9px 18px;
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn-brand:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow: 0 10px 22px rgba(31, 78, 140, 0.30);
    color: #FFFFFF !important;
}
.btn-brand:active { transform: translateY(0); }

/* WhatsApp share button — subtle WhatsApp green on hover */
.btn-whatsapp {
    background-color: #FFFFFF !important;
    border: 1px solid #25D366 !important;
    color: #128C7E !important;
    font-weight: 500;
    border-radius: 8px;
    padding: 9px 16px;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn-whatsapp:hover {
    background: #25D366 !important;
    color: #FFFFFF !important;
    border-color: #25D366 !important;
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.30);
}

/* btn-outline-light kept for naming compat — now means "subtle on light bg" */
.btn-outline-light,
.btn-outline-info,
.btn-outline-secondary {
    background-color: #FFFFFF !important;
    border: 1px solid var(--border-strong) !important;
    color: var(--text-primary) !important;
    font-weight: 500;
    border-radius: 8px;
}
.btn-outline-light:hover,
.btn-outline-info:hover,
.btn-outline-secondary:hover {
    background: rgba(46, 111, 190, 0.08) !important;
    border-color: var(--brand-blue) !important;
    color: var(--brand-blue) !important;
}

/* =========================================================================
   FORMS (light)
   ========================================================================= */

.form-control,
.form-select {
    background-color: #FFFFFF !important;
    border: 1px solid var(--border-strong) !important;
    color: var(--text-primary) !important;
    border-radius: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--brand-blue-bright) !important;
    box-shadow: 0 0 0 3px rgba(46, 111, 190, 0.16) !important;
    background-color: #FFFFFF !important;
    color: var(--text-primary) !important;
}
.form-control::placeholder { color: var(--text-muted) !important; }

/* Legacy `bg-black bg-opacity-*` patterns (Activities / Email pages) — flip to light */
.bg-black.bg-opacity-10,
.bg-black.bg-opacity-15,
.bg-black.bg-opacity-20,
.bg-black.bg-opacity-25,
.bg-black.bg-opacity-30,
.form-control.bg-black,
.form-select.bg-black {
    background-color: #FFFFFF !important;
    color: var(--text-primary) !important;
}

/* Bootstrap input-group prefix used as a search/calendar icon container */
.input-group-text.bg-black {
    background-color: var(--bg-surface-2) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-strong) !important;
}

/* Solid-color badges (bg-primary / bg-info / bg-success / bg-warning / bg-danger
   / bg-secondary) ALWAYS sit on a saturated color — force white text so the
   global `.text-white → var(--text-primary)` remap doesn't make them unreadable. */
.badge.bg-primary,
.badge.bg-info,
.badge.bg-success,
.badge.bg-warning,
.badge.bg-danger,
.badge.bg-secondary { color: #FFFFFF !important; }

/* =========================================================================
   MODAL OVERLAY
   ========================================================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    padding: 20px;
    animation: lbpanel-fade-in 0.18s ease-out;
}

.modal-content-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    padding: 28px;
    width: 100%;
    max-width: 560px;
    color: var(--text-primary);
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.20);
}

@keyframes lbpanel-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   STAT TILES + LIST ROWS
   ========================================================================= */

.stat-tile {
    transition: transform 0.2s ease, box-shadow 0.25s ease;
    cursor: pointer;
}
.stat-tile .stat-icon {
    color: var(--brand-blue);
    margin-bottom: 8px;
    opacity: 0.85;
}

/* In-table project name link — the row's primary cell becomes the click target */
.project-link {
    display: block;
    color: var(--text-primary) !important;
    transition: color 0.15s ease;
}
.project-link:hover { color: var(--brand-blue) !important; }
.project-link:hover .fw-semibold { color: var(--brand-blue); }

.project-row, .service-row {
    display: block;
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 12px 14px;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.project-row:hover {
    background: #F8FAFC;
    border-color: rgba(31, 78, 140, 0.22);
    transform: translateX(2px);
}
.min-w-0 { min-width: 0; }

/* =========================================================================
   AUTH PAGES
   ========================================================================= */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-shell { width: 100%; max-width: 420px; }

.login-card { padding: 36px 32px; }

/* On the auth page the brand badge sits on a light card — flatten the heavy
   dark shadow used in the sidebar variant. */
.auth-page .brand-badge-card {
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

/* =========================================================================
   SCROLLBAR
   ========================================================================= */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(31, 78, 140, 0.20);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(31, 78, 140, 0.40); }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */

@media (max-width: 640.98px) {
    .sidebar {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }
}
