/* ===================================
   CodeAIHub — Site Styles
   508 Compliant / WCAG 2.1 AA
   =================================== */

/* ---- Blazor Defaults ---- */

.valid.modified:not([type=checkbox]) {
    outline: 2px solid #1a7431;
}

.invalid {
    outline: 2px solid #b91c1c;
}

.validation-message {
    color: #b91c1c;
    font-size: 0.9rem;
    margin-top: 0.25rem;
    font-weight: 600;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* ---- Design Tokens ---- */
/* All color combinations verified for WCAG 2.1 AA (4.5:1 normal, 3:1 large) */

:root {
    --cah-primary: #0054b8;       /* 7.2:1 on white — passes AA & AAA */
    --cah-primary-dark: #003d87;  /* 10.5:1 on white */
    --cah-dark: #1a1d23;
    --cah-darker: #12141a;
    --cah-accent: #007a63;        /* 5.7:1 on white — passes AA */
    --cah-light: #f0f2f5;
    --cah-body: #1f2937;          /* 14.7:1 on white — high readability */
    --cah-muted: #4b5563;         /* 7.4:1 on white — passes AA & AAA */
    --cah-muted-light: #c9cdd4;   /* 9.3:1 on #1a1d23 dark bg */
    --cah-warning: #8a6d00;       /* 5.9:1 on white — passes AA */
    --cah-success: #1a7431;       /* 5.2:1 on white — passes AA */
    --cah-danger: #b91c1c;        /* 6.1:1 on white — passes AA */

    /* Portal design tokens */
    --cah-sidebar-bg: #171a24;
    --cah-sidebar-hover: rgba(255, 255, 255, 0.08);
    --cah-sidebar-active: rgba(0, 84, 184, 0.25);
    --cah-card-border: #e5e7eb;
    --cah-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --cah-card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.06);
    --cah-portal-bg: #f5f6fa;
    --cah-table-header-bg: #f8f9fb;
    --cah-table-header-color: #374151;
    --cah-table-row-hover: #f0f4ff;
}

/* ---- Global ---- */

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--cah-body);
    padding-top: 56px; /* offset for fixed navbar */
    font-size: 1.0625rem; /* 17px base — easier reading */
    line-height: 1.7;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--cah-dark);
    line-height: 1.3;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--cah-primary);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--cah-primary-dark);
}

/* ---- 508: Focus Indicators ---- */
/* Visible focus ring for keyboard navigation on interactive elements only */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:not(main):focus-visible {
    outline: 3px solid var(--cah-primary);
    outline-offset: 2px;
}

.btn:focus-visible {
    outline: 3px solid var(--cah-primary);
    outline-offset: 2px;
    box-shadow: none;
}

/* Round corners on heading/main focus outlines to match site design */
h1:focus, h2:focus, h3:focus, h4:focus, h5:focus, h6:focus,
main:focus {
    outline: 3px solid var(--cah-primary);
    outline-offset: 6px;
    border-radius: 12px;
}

/* ---- 508: Override Bootstrap text-muted ---- */
/* Bootstrap's #6c757d (4.6:1) is borderline — replace with higher contrast */

.text-muted {
    color: var(--cah-muted) !important; /* 7.4:1 on white */
}

.text-secondary {
    color: var(--cah-muted-light) !important; /* used only on dark bg */
}

/* ---- 508: Ensure check/icon colors pass contrast ---- */

.text-success,
.bi.text-success {
    color: var(--cah-success) !important; /* 5.2:1 on white */
}

.text-danger {
    color: var(--cah-danger) !important; /* 6.1:1 on white */
}

.text-warning {
    color: var(--cah-warning) !important; /* 5.9:1 on white */
}

.text-primary {
    color: var(--cah-primary) !important; /* 7.2:1 on white */
}

/* ---- Skip to Content (508 required) ---- */

.skip-to-content {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--cah-primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    z-index: 9999;
    font-weight: 600;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    transition: top 0.2s;
}

.skip-to-content:focus {
    top: 0;
    color: #fff;
}

/* ---- Hero Section ---- */

.hero-section {
    background: linear-gradient(135deg, var(--cah-dark) 0%, #1e3a5f 50%, var(--cah-dark) 100%);
    color: #fff;
    padding: 6rem 0 5rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 50%, rgba(0, 212, 170, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 50%, rgba(13, 110, 253, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.2;
    color: #fff;
}

.hero-section .lead {
    font-size: 1.3rem;
    color: #e2e8f0; /* high contrast on dark bg */
}

.hero-section .text-accent {
    color: #5eead4; /* bright teal — 9.1:1 on #1a1d23 dark bg */
}

.hero-section a.btn-outline-light:focus-visible {
    outline-color: #fff;
}

@media (max-width: 768px) {
    .hero-section {
        padding: 4rem 0 3rem;
    }

    .hero-section h1 {
        font-size: 2rem;
    }
}

/* ---- Free Offer Banner ---- */

.free-banner {
    background: linear-gradient(90deg, #065f46 0%, #047857 50%, #065f46 100%);
    padding: 1rem 0;
    text-align: center;
}

.free-banner-badge {
    display: inline-block;
    background: #fff;
    color: #065f46;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

.free-banner-text {
    color: #fff;
    font-weight: 600;
    font-size: 1.05rem;
}

.free-banner-link {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05rem;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.free-banner-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.free-banner-divider {
    color: rgba(255, 255, 255, 0.4);
}

/* ---- Prove It Section ---- */

.prove-it-section {
    background: linear-gradient(135deg, var(--cah-dark) 0%, #0f2540 50%, var(--cah-dark) 100%);
    position: relative;
}

.prove-it-section .package-card {
    border-color: rgba(255, 255, 255, 0.15);
}

.prove-it-section .package-card:hover {
    border-color: #10b981;
    box-shadow: 0 4px 24px rgba(16, 185, 129, 0.2);
}

.prove-it-section .card-header .badge {
    font-size: 0.85rem;
}

.badge-prove {
    background: #10b981;
    color: #fff;
}

/* ---- Pillar Cards ---- */

.pillar-card {
    border: 1px solid #d1d5db;
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
    background: #fff;
}

.pillar-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.pillar-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.pillar-icon.build {
    background: rgba(0, 84, 184, 0.1);
    color: var(--cah-primary); /* 7.2:1 on the light bg */
}

.pillar-icon.improve {
    background: rgba(0, 122, 99, 0.1);
    color: var(--cah-accent); /* 5.7:1 on the light bg */
}

.pillar-icon.maintain {
    background: rgba(138, 109, 0, 0.1);
    color: var(--cah-warning); /* 5.9:1 on the light bg */
}

/* ---- Package Cards ---- */

.package-card {
    border: 2px solid #d1d5db;
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
    background: #fff;
}

.package-card:hover {
    border-color: var(--cah-primary);
    box-shadow: 0 4px 20px rgba(0, 84, 184, 0.1);
}

.package-card .card-header {
    background: transparent;
    border-bottom: 1px solid #d1d5db;
    padding: 1.25rem 1.5rem;
}

/* ---- Process Steps ---- */

.process-step {
    position: relative;
    padding-left: 4rem;
    padding-bottom: 2rem;
}

.process-step::before {
    content: '';
    position: absolute;
    left: 22px;
    top: 48px;
    bottom: 0;
    width: 2px;
    background: #d1d5db;
}

.process-step:last-child::before {
    display: none;
}

.step-number {
    position: absolute;
    left: 0;
    top: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--cah-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

/* ---- Section Spacing ---- */

.section-padding {
    padding: 5rem 0;
}

.section-padding-sm {
    padding: 3rem 0;
}

.bg-light-subtle {
    background-color: var(--cah-light);
}

/* ---- CTA Section ---- */

.cta-section {
    background: linear-gradient(135deg, var(--cah-primary) 0%, var(--cah-primary-dark) 100%);
    color: #fff;
}

.cta-section h2 {
    color: #fff;
}

.cta-section p {
    color: #e2e8f0;
}

.cta-section .btn-primary {
    background: #fff;
    color: var(--cah-primary);
    border: none;
    font-weight: 600;
}

.cta-section .btn-primary:hover {
    background: #e2e8f0;
    color: var(--cah-primary-dark);
}

/* ---- Privacy Tiers ---- */

.tier-card {
    border-radius: 12px;
    border: 2px solid #d1d5db;
    height: 100%;
    transition: border-color 0.2s ease;
    background: #fff;
}

.tier-card:hover {
    border-color: var(--cah-primary);
}

.tier-card .badge {
    font-size: 0.8rem;
}

/* ---- Contact Form ---- */

.contact-form .form-control,
.contact-form .form-select {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    border: 1px solid #9ca3af; /* stronger border for visibility */
    font-size: 1rem;
    color: var(--cah-body);
}

.contact-form .form-control:focus,
.contact-form .form-select:focus {
    border-color: var(--cah-primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 84, 184, 0.2);
}

.contact-form .form-label {
    font-weight: 600;
    color: var(--cah-body);
}

.contact-form .form-control::placeholder {
    color: #6b7280; /* 5.0:1 on white — passes AA */
}

.contact-form-card {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.contact-form-card .section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ---- Footer (dark bg — verify contrast against #1a1d23) ---- */

footer {
    color: #e2e8f0; /* 13.5:1 on #212529 */
}

footer h5,
footer h6 {
    color: #fff;
}

footer a.text-secondary {
    color: var(--cah-muted-light) !important;
}

footer a.text-secondary:hover {
    color: #fff !important;
}

footer .text-secondary {
    color: var(--cah-muted-light) !important; /* 9.3:1 on dark bg */
}

footer p.small {
    color: var(--cah-muted-light);
}

/* ---- Language Switcher ---- */

.lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50px;
    padding: 0.3rem 0.5rem;
}

.lang-option {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: background 0.2s ease, color 0.2s ease;
}

.lang-option:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.lang-option.active {
    background: var(--cah-primary);
    color: #fff;
}

.lang-flag {
    font-size: 1.1rem;
    line-height: 1;
}

.lang-label {
    line-height: 1;
}

.lang-divider {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.8rem;
    user-select: none;
}

@media (max-width: 991.98px) {
    .lang-switcher {
        margin-top: 0.75rem;
        margin-bottom: 0.5rem;
    }
}

/* ---- Misc ---- */

/* ---- Logo ---- */

.site-logo {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-right: 0.5rem;
    background: var(--cah-dark);
    border: 2.5px solid #f59e0b;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 800;
    color: #34d399;
    font-family: 'Courier New', monospace;
    line-height: 1;
}

.logo-code {
    color: #34d399;
}

.logo-ai {
    color: #f59e0b;
}

.logo-hub {
    color: #34d399;
}

.navbar-brand.site-logo:hover .logo-icon {
    border-color: #fbbf24;
    color: #6ee7b7;
}

.navbar-brand.site-logo:hover .logo-code {
    color: #6ee7b7;
}

.navbar-brand.site-logo:hover .logo-ai {
    color: #fbbf24;
}

.navbar-brand.site-logo:hover .logo-hub {
    color: #6ee7b7;
}

.text-accent {
    color: var(--cah-accent); /* 5.7:1 on white */
}

.fw-semibold {
    font-weight: 600;
}

.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.icon-box-primary {
    background: rgba(0, 84, 184, 0.1);
    color: var(--cah-primary);
}

.icon-box-accent {
    background: rgba(0, 122, 99, 0.1);
    color: var(--cah-accent);
}

.icon-box-warning {
    background: rgba(138, 109, 0, 0.1);
    color: var(--cah-warning);
}

/* Page header used on inner pages */
.page-header {
    background: linear-gradient(135deg, var(--cah-dark) 0%, #1e3a5f 100%);
    color: #fff;
    padding: 4rem 0 3rem;
    text-align: center;
}

.page-header h1 {
    color: #fff;
}

.page-header .lead {
    color: #e2e8f0;
}

/* ---- Accordion (Privacy FAQ) ---- */

.accordion-button {
    font-weight: 600;
    color: var(--cah-body);
    font-size: 1.0625rem;
}

.accordion-button:not(.collapsed) {
    color: var(--cah-primary);
    background-color: rgba(0, 84, 184, 0.05);
}

.accordion-body {
    color: var(--cah-body);
    line-height: 1.7;
}

/* ---- Buttons ---- */

.btn-primary {
    background-color: var(--cah-primary);
    border-color: var(--cah-primary);
}

.btn-primary:hover {
    background-color: var(--cah-primary-dark);
    border-color: var(--cah-primary-dark);
}

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

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

/* ---- Responsive ---- */

@media (max-width: 768px) {
    .page-header {
        padding: 3rem 0 2rem;
    }

    .section-padding {
        padding: 3rem 0;
    }

    body {
        font-size: 1rem;
    }
}

/* ---- Reduced Motion (508 / WCAG) ---- */

@media (prefers-reduced-motion: reduce) {
    .pillar-card,
    .package-card,
    .tier-card,
    .skip-to-content {
        transition: none;
    }

    .pillar-card:hover {
        transform: none;
    }
}

/* ===================================
   Blog Content Styles
   =================================== */

.blog-content h2 {
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--cah-heading);
}

.blog-content h3 {
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--cah-heading);
}

.blog-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.blog-content ul,
.blog-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.blog-content li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

.blog-content strong {
    color: var(--cah-heading);
}

.blog-content code {
    background: var(--cah-bg-subtle);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.blog-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.blog-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.blog-content blockquote {
    border-left: 4px solid var(--cah-primary);
    padding: 0.75rem 1.25rem;
    margin: 1.5rem 0;
    background: var(--cah-bg-subtle);
    border-radius: 0 8px 8px 0;
}

.blog-content blockquote p:last-child {
    margin-bottom: 0;
}

.blog-content em {
    color: var(--cah-body);
}

/* ===================================
   Portal Layout Styles
   =================================== */

/* ---- Shell ---- */

.portal-wrapper {
    min-height: 100vh;
}

/* ---- Sidebar ---- */

.portal-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    background: linear-gradient(180deg, var(--cah-sidebar-bg) 0%, #141720 100%) !important;
}

.portal-sidebar .nav-link {
    padding: 0.55rem 1rem;
    border-radius: 8px;
    font-size: 0.93rem;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    border-left: 3px solid transparent;
    margin-bottom: 2px;
}

.portal-sidebar .nav-link i {
    opacity: 0.7;
    transition: opacity 0.2s;
}

.portal-sidebar .nav-link:hover {
    background: var(--cah-sidebar-hover);
    color: #fff;
}

.portal-sidebar .nav-link:hover i {
    opacity: 1;
}

.portal-sidebar .nav-link.active {
    background: var(--cah-sidebar-active);
    border-left-color: var(--cah-primary);
}

.portal-sidebar .nav-link.active i {
    opacity: 1;
}

/* Section labels */
.portal-sidebar .nav-link.text-secondary.small {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    padding-left: 1rem;
    margin-top: 0.5rem;
}

/* Brand area */
.portal-sidebar .border-bottom {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Back-to-site footer */
.portal-sidebar .border-top {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* ---- Top bar ---- */

.portal-topbar {
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.portal-topbar .btn-outline-secondary {
    border-radius: 8px;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

/* ---- Main content area ---- */

.portal-main {
    margin-left: 250px;
    background: var(--cah-portal-bg);
}

.portal-content {
    padding: 1.5rem;
}

/* Override body padding-top for portal pages (no public navbar) */
.portal-wrapper body,
.portal-auth-wrapper body {
    padding-top: 0;
}

/* ---- Page headings ---- */

.portal-content h1,
.portal-content h2,
.portal-content h3 {
    font-weight: 800;
    color: var(--cah-dark);
    letter-spacing: -0.01em;
}

/* ---- Cards ---- */

.portal-wrapper .card {
    border: 1px solid var(--cah-card-border);
    border-radius: 12px;
    box-shadow: var(--cah-card-shadow);
    transition: box-shadow 0.2s, transform 0.2s;
}

.portal-wrapper .card-header {
    background: #f9fafb;
    border-bottom: 1px solid var(--cah-card-border);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* ---- Stat cards (admin dashboard) ---- */

.portal-wrapper .row.g-4.mb-4 > [class*="col-"] > .card:first-child .card-body {
    position: relative;
}

/* Colored left-border per stat type */
.portal-wrapper .row.g-4.mb-4 > [class*="col-"]:nth-child(1) > .card {
    border-left: 4px solid var(--cah-primary);
}

.portal-wrapper .row.g-4.mb-4 > [class*="col-"]:nth-child(2) > .card {
    border-left: 4px solid var(--cah-success);
}

.portal-wrapper .row.g-4.mb-4 > [class*="col-"]:nth-child(3) > .card {
    border-left: 4px solid #0891b2;
}

.portal-wrapper .row.g-4.mb-4 > [class*="col-"]:nth-child(4) > .card {
    border-left: 4px solid var(--cah-warning);
}

/* Icon containers */
.portal-wrapper .row.g-4.mb-4 > [class*="col-"] .card-body > i.fs-2 {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    font-size: 1.35rem !important;
}

.portal-wrapper .row.g-4.mb-4 > [class*="col-"]:nth-child(1) .card-body > i.fs-2 {
    background: rgba(0, 84, 184, 0.1);
}

.portal-wrapper .row.g-4.mb-4 > [class*="col-"]:nth-child(2) .card-body > i.fs-2 {
    background: rgba(26, 116, 49, 0.1);
}

.portal-wrapper .row.g-4.mb-4 > [class*="col-"]:nth-child(3) .card-body > i.fs-2 {
    background: rgba(8, 145, 178, 0.1);
}

.portal-wrapper .row.g-4.mb-4 > [class*="col-"]:nth-child(4) .card-body > i.fs-2 {
    background: rgba(138, 109, 0, 0.1);
}

/* Bolder stat numbers */
.portal-wrapper .row.g-4.mb-4 > [class*="col-"] .fs-3.fw-bold {
    font-weight: 800 !important;
    letter-spacing: -0.02em;
}

/* ---- Tables ---- */

.portal-wrapper .table thead.table-dark {
    --bs-table-bg: var(--cah-table-header-bg);
    --bs-table-color: var(--cah-table-header-color);
    --bs-table-border-color: #e5e7eb;
}

.portal-wrapper .table thead th {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.portal-wrapper .table-hover > tbody > tr:hover {
    --bs-table-hover-bg: var(--cah-table-row-hover);
}

.portal-wrapper .table > tbody > tr:last-child > td {
    border-bottom: 0;
}

/* ---- Progress bars ---- */

.portal-wrapper .progress {
    height: 8px;
    border-radius: 4px;
    background: #e9ecef;
}

.portal-wrapper .progress-bar {
    background: linear-gradient(90deg, var(--cah-primary), #2b7de9);
    border-radius: 4px;
}

/* ---- Badges ---- */

.portal-wrapper .badge {
    border-radius: 50px;
    font-weight: 600;
    padding: 0.35em 0.75em;
    letter-spacing: 0.01em;
}

.portal-wrapper .badge.bg-primary {
    background: rgba(0, 84, 184, 0.12) !important;
    color: var(--cah-primary) !important;
}

.portal-wrapper .badge.bg-success {
    background: rgba(26, 116, 49, 0.12) !important;
    color: var(--cah-success) !important;
}

.portal-wrapper .badge.bg-info {
    background: rgba(8, 145, 178, 0.12) !important;
    color: #0e7490 !important;
}

.portal-wrapper .badge.bg-warning {
    background: rgba(138, 109, 0, 0.12) !important;
    color: var(--cah-warning) !important;
}

.portal-wrapper .badge.bg-danger {
    background: rgba(185, 28, 28, 0.12) !important;
    color: var(--cah-danger) !important;
}

.portal-wrapper .badge.bg-secondary {
    background: rgba(75, 85, 99, 0.12) !important;
    color: var(--cah-muted) !important;
}

/* ---- Form inputs ---- */

.portal-wrapper .form-control,
.portal-wrapper .form-select {
    border-radius: 8px;
    border-color: #d1d5db;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.portal-wrapper .form-control:focus,
.portal-wrapper .form-select:focus {
    border-color: var(--cah-primary);
    box-shadow: 0 0 0 3px rgba(0, 84, 184, 0.12);
}

.portal-wrapper .form-label {
    font-weight: 600;
}

/* ---- Tabs ---- */

.portal-wrapper .nav-tabs {
    border-bottom: 2px solid #e5e7eb;
}

.portal-wrapper .nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    margin-bottom: -2px;
    color: var(--cah-muted);
    font-weight: 600;
    padding: 0.6rem 1rem;
    transition: color 0.2s, border-color 0.2s;
}

.portal-wrapper .nav-tabs .nav-link:hover {
    color: var(--cah-primary);
    border-bottom-color: rgba(0, 84, 184, 0.3);
    background: transparent;
}

.portal-wrapper .nav-tabs .nav-link.active {
    color: var(--cah-primary);
    border-bottom-color: var(--cah-primary);
    background: transparent;
}

/* ---- Messages ---- */

.portal-messages .rounded {
    word-wrap: break-word;
    border-radius: 12px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.portal-messages .bg-primary.rounded {
    background: linear-gradient(135deg, var(--cah-primary), #2b7de9) !important;
}

.portal-messages + .input-group .form-control {
    border-radius: 8px 0 0 8px;
}

.portal-messages + .input-group .btn {
    border-radius: 0 8px 8px 0;
}

/* ---- Buttons ---- */

.portal-wrapper .btn {
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.portal-wrapper .btn-primary {
    box-shadow: 0 1px 3px rgba(0, 84, 184, 0.2);
}

.portal-wrapper .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 84, 184, 0.25);
}

/* ---- Auth pages ---- */

.portal-auth-wrapper {
    background:
        radial-gradient(ellipse at 20% 50%, rgba(0, 84, 184, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(43, 125, 233, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, #0f1219 0%, #171a24 50%, #1a1d28 100%);
}

.portal-auth-card {
    border-radius: 16px !important;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 8px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.portal-auth-card .form-control {
    padding: 0.65rem 0.85rem;
}

.portal-auth-card .btn-primary {
    padding: 0.6rem;
    font-weight: 700;
    font-size: 1rem;
}

/* ---- Alerts ---- */

.portal-wrapper .alert {
    border-radius: 10px;
    border: none;
    border-left: 4px solid transparent;
}

.portal-wrapper .alert-success {
    background: rgba(26, 116, 49, 0.08);
    color: var(--cah-success);
    border-left-color: var(--cah-success);
}

.portal-wrapper .alert-danger {
    background: rgba(185, 28, 28, 0.08);
    color: var(--cah-danger);
    border-left-color: var(--cah-danger);
}

.portal-wrapper .alert-warning {
    background: rgba(138, 109, 0, 0.08);
    color: var(--cah-warning);
    border-left-color: var(--cah-warning);
}

.portal-wrapper .alert-info {
    background: rgba(8, 145, 178, 0.08);
    color: #0e7490;
    border-left-color: #0891b2;
}

/* ---- Client project cards — hover lift ---- */

.portal-wrapper .card.h-100.shadow-sm {
    transition: box-shadow 0.2s, transform 0.2s;
}

.portal-wrapper .card.h-100.shadow-sm:hover {
    transform: translateY(-2px);
    box-shadow: var(--cah-card-shadow-hover);
}

/* ---- Accessibility: reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
    .portal-wrapper .card,
    .portal-wrapper .btn,
    .portal-wrapper .nav-link,
    .portal-wrapper .card.h-100.shadow-sm,
    .portal-sidebar .nav-link,
    .portal-sidebar .nav-link i,
    .portal-topbar .btn-outline-secondary,
    .portal-wrapper .form-control,
    .portal-wrapper .form-select,
    .portal-wrapper .nav-tabs .nav-link,
    .portal-messages .bg-primary.rounded {
        transition: none !important;
        transform: none !important;
    }
}

/* ---- Responsive portal ---- */

@media (max-width: 768px) {
    .portal-sidebar {
        position: relative;
        width: 100%;
        height: auto;
        min-height: auto;
    }

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

    .portal-wrapper {
        flex-direction: column;
    }

    .portal-content {
        padding: 1rem;
    }

    .portal-auth-card .card-body {
        padding: 1.5rem !important;
    }
}
