/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1e3a8a;
    --secondary-color: #dc2626;
    --accent-color: #f59e0b;
    --light-gray: #f3f4f6;
    --dark-gray: #374151;
    --white: #ffffff;
    --border-radius: 8px;
    --transition: 0.3s ease-in-out;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-gray);
    background-color: var(--white);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Utility Helpers */
.pt-20 { padding-top: 20px; }
.hidden { display: none !important; }
.mt-20 { margin-top: 20px; }
.mt-25 { margin-top: 25px; }
.mt-50 { margin-top: 50px; }
.mt-60 { margin-top: 60px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.mb-25 { margin-bottom: 25px; }
.mb-30 { margin-bottom: 30px; }
.mb-40 { margin-bottom: 40px; }
.my-15 { margin: 15px 0; }
.m-0 { margin: 0; }
.text-center { text-align: center; }
.text-small { font-size: 0.9rem; }
.text-muted { color: #666; }
.text-secondary { color: var(--secondary-color); }
.text-secondary-strong { color: var(--secondary-color); font-weight: 600; }
.link-secondary { color: var(--secondary-color); text-decoration: none; font-weight: 600; }
.link-secondary:hover { text-decoration: underline; }
.lead-text { font-size: 1.1rem; color: var(--secondary-color); }
.max-w-800 { max-width: 800px; }
.grid-gap-30 { display: grid; gap: 30px; margin-top: 25px; }
.grid-gap-20 { display: grid; gap: 20px; margin-top: 25px; }
.grid-fit-280 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; margin-bottom: 50px; }
.grid-fit-280-mt25 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 25px; margin-top: 25px; }
.grid-fit-250 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 25px; margin-top: 25px; }
.flex-between-start { display: flex; justify-content: space-between; align-items: start; margin-bottom: 15px; }
.flex-wrap-gap-15 { display: flex; gap: 15px; flex-wrap: wrap; }
.card-spotlight { text-align: center; padding: 30px; background-color: var(--light-gray); border-radius: var(--border-radius); }
.stat-number { font-size: 2rem; color: var(--secondary-color); }
.faq-item { margin-bottom: 20px; }
.faq-question { background-color: var(--light-gray); padding: 15px; border-radius: var(--border-radius); cursor: pointer; font-weight: 600; }
.faq-answer { padding: 15px; background-color: #f9fafb; }
.form-control { width: 100%; padding: 12px; border: 1px solid #e5e7eb; border-radius: var(--border-radius); font-size: 1rem; }
.btn-full { width: 100%; }
.checkbox-label { display: flex; align-items: center; font-weight: normal; gap: 0.5rem; }
.checkbox-input { width: auto; margin-right: 8px; }
.bg-surface { background-color: var(--light-gray); }

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.55);
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.2);
}

.modal-header,
.modal-footer {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header {
    border-bottom: 1px solid #e5e7eb;
    gap: 16px;
}

.modal-body {
    padding: 20px;
}

.modal-close-button {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--dark-gray);
}

.contract-template-panel {
    margin-bottom: 20px;
}

.contract-template-preview {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.contract-field {
    margin-top: 20px;
}

.contract-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.contract-cost-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    background-color: var(--light-gray);
    padding: 16px;
    border-radius: var(--border-radius);
    margin-top: 20px;
}

.contract-cost-summary span {
    font-size: 0.95rem;
    opacity: 0.85;
}

.contract-cost-summary strong {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.contract-sign-area canvas {
    width: 100%;
    max-width: 100%;
    min-height: 160px;
    border-radius: var(--border-radius);
    border: 1px solid #cbd5e1;
}

.contract-content-preview {
    padding: 16px;
    border-radius: var(--border-radius);
    background-color: var(--white);
    border: 1px solid #e5e7eb;
    white-space: pre-wrap;
    line-height: 1.6;
    font-size: 0.95rem;
}

.border-left-secondary { border-left: 4px solid var(--secondary-color); }
.line-height-150 { line-height: 1.5; }
.text-note { font-style: italic; color: var(--dark-gray); margin-bottom: 15px; }
.my-0 { margin: 0; }
.flex-wrap-gap-8 { display: flex; gap: 8px; flex-wrap: wrap; }
.flex-wrap-gap-10 { display: flex; gap: 10px; flex-wrap: wrap; }
/* Small utilities */
.clickable-card { cursor: pointer; transition: var(--transition); }
.scroll-offset { scroll-margin-top: 100px; }
.card-body { padding: 24px; }
.p-25 { padding: 25px; }
.max-w-400 { max-width: 400px; }
.hidden { display: none !important; }
.grid-gap-20-no-mt { display: grid; gap: 20px; }
.status-scheduled { background-color: #fef3c7; color: #78350f; }

/* Card border utilities for Services page */
.card-border-secondary { border-top: 4px solid var(--secondary-color); }
.card-border-accent { border-top: 4px solid var(--accent-color); }
.card-border-success { border-top: 4px solid #10b981; }
.ml-15 { margin-left: 15px; }
.ml-20 { margin-left: 20px; }
.status-under-review { background-color: #dbeafe; color: #1e3a8a; }
.checkbox-label { display: flex; align-items: center; font-weight: normal; gap: 0.5rem; }
.checkbox-input { width: auto; margin-right: 8px; }
.bg-surface { background-color: var(--light-gray); }
.pl-20 { padding-left: 20px; }
.mt-15 { margin-top: 15px; }
.mt-12 { margin-top: 12px; }
.mt-5 { margin-top: 5px; }
.mb-50 { margin-bottom: 50px; }
.mb-30 { margin-bottom: 30px; }
.mb-25 { margin-bottom: 25px; }
.mb-20 { margin-bottom: 20px; }
.mb-15 { margin-bottom: 15px; }
.my-10 { margin: 10px 0; }
.line-height-180 { line-height: 1.8; }
.text-large { font-size: 1.2rem; }
.text-2xl { font-size: 2rem; }
.max-w-600 { max-width: 600px; }
.input-disabled { background-color: #f3f4f6; }
.card-body { padding: 24px; }
.p-25 { padding: 25px; }
.input-disabled { background-color: #f3f4f6; }

/* Navigation */
.navbar {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.98), rgba(15, 23, 42, 0.98));
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 0.9rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

/* Alert components */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 0.95rem;
    box-shadow: 0 6px 18px rgba(16,24,40,0.06);
}
.alert-success {
    background: linear-gradient(180deg, #ecfdf5, #f0fdf4);
    color: #065f46;
    border: 1px solid rgba(16,185,129,0.12);
}
.alert-warning {
    background: linear-gradient(180deg, #fff7ed, #fff4e6);
    color: #92400e;
    border: 1px solid rgba(245,158,11,0.12);
}
.reset-alert {
    box-shadow: none;
    border-left: 4px solid var(--secondary-color);
}

/* Large-screen navbar adjustments to prevent header wrapping */
@media (min-width: 1200px) {
    .container { max-width: 1400px; }
    .navbar .container { gap: 20px; }
    .logo { flex: 0 0 auto; }
    .logo img { max-height: 48px; }
    .nav-links { flex: 1 1 auto; justify-content: flex-end; gap: 1rem; }
    .nav-links li { white-space: nowrap; }
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--white);
}

.logo img {
    max-height: 40px;
    width: auto;
    display: block;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.25rem;
    align-items: center;
}

.nav-links a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    padding: 0.45rem 0.65rem;
    border-radius: 999px;
    transition: background-color var(--transition), color var(--transition), transform var(--transition);
}

.nav-links a:hover,
.nav-links a:focus-visible {
    color: var(--accent-color);
    background-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.btn-portal {
    background-color: var(--secondary-color);
    padding: 0.6rem 1rem;
    border-radius: 999px;
    transition: background-color var(--transition), transform var(--transition);
}

.btn-portal:hover,
.btn-portal:focus-visible {
    background-color: #b91c1c;
    transform: translateY(-1px);
}

.admin-nav-link {
    border: 1px solid rgba(255, 255, 255, 0.24);
    background-color: rgba(255, 255, 255, 0.12);
}

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    padding: 0;
}

.hamburger span {
    width: 20px;
    height: 2px;
    background-color: var(--white);
    margin: 2.5px 0;
    transition: transform var(--transition), opacity var(--transition);
}

.hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
    .navbar {
        padding: 0.8rem 0;
    }

    .navbar .container {
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 0.75rem;
    }

    .logo {
        flex: 1 1 auto;
        min-width: 0;
    }

    .logo img {
        max-height: 32px;
        width: auto;
    }

    .hamburger {
        display: inline-flex;
        flex-shrink: 0;
    }

    .nav-links {
        position: absolute;
        top: calc(100% + 0.6rem);
        right: 0;
        left: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        padding: 0.75rem;
        background: rgba(15, 23, 42, 0.98);
        border-radius: 16px;
        box-shadow: 0 20px 45px rgba(15, 23, 42, 0.24);
        opacity: 0;
        visibility: hidden;
        max-height: 0;
        overflow: hidden;
        pointer-events: none;
        transform: translateY(-6px);
        transition: all 0.2s ease;
    }

    .nav-links.active {
        opacity: 1;
        visibility: visible;
        max-height: 500px;
        pointer-events: auto;
        transform: translateY(0);
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links a {
        display: block;
        width: 100%;
        padding: 0.8rem 0.9rem;
        border-radius: 10px;
    }

    .btn-portal {
        text-align: center;
        margin-top: 0.2rem;
    }

    .admin-nav-link {
        margin-top: 0.25rem;
    }

    .hero {
        padding: 72px 16px 56px;
        min-height: 0;
    }

    .hero-content {
        max-width: 100%;
    }

    .hero h1 {
        font-size: 2.4rem;
    }

    .hero .subtitle {
        font-size: 1.1rem;
    }

    .hero .tagline {
        font-size: 1rem;
        margin-bottom: 24px;
    }

    .hero-actions {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }

    .hero .btn {
        width: 100%;
        text-align: center;
    }
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e3a8a 100%);
    color: var(--white);
    padding: 120px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 600"><defs><pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse"><path d="M 40 0 L 0 0 0 40" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="1200" height="600" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero .subtitle {
    font-size: 1.5rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.hero .tagline {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.85;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: #b91c1c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #1f2937;
}

.status-success {
    background-color: #d1fae5;
    color: #065f46;
}

.status-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.status-processing {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.btn-secondary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: #1e40af;
    transform: translateY(-2px);
}

.btn-outline-secondary {
    display: inline-block;
    padding: 12px 30px;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    color: var(--primary-color);
    background-color: transparent;
    text-decoration: none;
    transition: var(--transition);
}

.btn-outline-secondary:hover {
    background-color: rgba(30, 64, 175, 0.08);
    color: var(--primary-color);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
}

.public-history-callout {
    padding: 60px 0;
    background-color: #f8fafc;
}

.callout-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.05);
}

.callout-card h2 {
    margin: 0 0 10px;
}

.callout-card p {
    margin: 0;
    color: var(--dark-gray);
}

[id^="contract-sign-canvas-"] {
    cursor: crosshair;
}

/* Overview Section */
.overview {
    padding: 80px 20px;
    background-color: var(--light-gray);
}

.overview h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 50px;
    color: var(--primary-color);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.card {
    background-color: var(--white);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.card h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

/* Services Overview */
.services-overview {
    padding: 80px 20px;
}

.services-overview h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 50px;
    color: var(--primary-color);
}

.service-card {
    background-color: var(--white);
    padding: 35px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    border-top: 4px solid var(--secondary-color);
    text-align: center;
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.service-card .icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.service-card h3 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.center-button {
    text-align: center;
    margin-top: 40px;
}

/* Stats Section */
.stats {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
    color: var(--white);
    padding: 60px 20px;
}

.stats .container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    text-align: center;
}

.stat h3 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* CTA Section */
.cta-section {
    background-color: var(--accent-color);
    color: var(--white);
    padding: 60px 20px;
    text-align: center;
}

.cta-section h2 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.cta-section p {
    font-size: 1.1rem;
    margin-bottom: 25px;
    opacity: 0.95;
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 50px 20px 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-column h4 {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.footer-column ul {
    list-style: none;
}

.footer-column ul li {
    margin-bottom: 8px;
}

.footer-column a {
    color: #dbeafe;
    text-decoration: none;
    transition: color var(--transition);
}

.footer-column a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 20px;
    text-align: center;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .hero {
        padding: 72px 16px 56px;
        min-height: 0;
    }

    .hero-content {
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hero h1 {
        font-size: 2.4rem;
        line-height: 1.15;
    }

    .hero .subtitle {
        font-size: 1.1rem;
    }

    .hero-actions {
        width: 100%;
        flex-direction: column;
    }

    .hero-actions .btn {
        width: 100%;
        min-width: 0;
    }

    .overview h2,
    .services-overview h2 {
        font-size: 2rem;
    }

    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .stats .container {
        grid-template-columns: repeat(2, 1fr);
    }

    .cta-section h2 {
        font-size: 1.5rem;
    }

    .page-section {
        padding: 48px 16px;
    }

    .card-body {
        padding: 20px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    /* Medium screens: place logo on its own row and center nav links beneath it */
    .navbar .container {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .logo {
        flex: 0 0 100%;
        text-align: center;
    }

    .logo img {
        margin: 0 auto;
        max-height: 36px;
        width: auto;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
        flex: 0 0 100%;
        margin-top: 0.5rem;
        position: static;
        background-color: transparent;
    }

    .nav-links li {
        width: auto;
    }

    .nav-links a {
        display: inline-block;
        padding: 0.5rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .navbar .container {
        gap: 0.6rem;
    }

    .logo {
        font-size: 1.15rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero .subtitle {
        font-size: 1rem;
    }

    .stats .container {
        grid-template-columns: 1fr;
    }

    .page-section {
        padding: 40px 14px;
    }
}

/* Page Sections */
.page-section {
    padding: 60px 20px;
    min-height: calc(100vh - 200px);
}

.page-section h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 30px;
}

.page-section h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    margin-top: 30px;
}

.page-section p {
    line-height: 1.8;
    margin-bottom: 15px;
    color: var(--dark-gray);
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin: 30px 0;
}

.info-box {
    background-color: var(--light-gray);
    padding: 25px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--secondary-color);
}

.info-box h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--primary-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.form-container {
    max-width: 600px;
    margin: 30px auto;
    background-color: var(--light-gray);
    padding: 30px;
    border-radius: var(--border-radius);
}

/* Login Form */
.login-form {
    max-width: 400px;
    width: 100%;
    margin: 30px auto;
    background-color: var(--light-gray);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-width: 0;
}

.login-form h2 {
    text-align: center;
    margin-bottom: 30px;
}

.login-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
}

.login-form .form-group input,
.login-form .form-group textarea,
.login-form .form-group select {
    width: 100%;
    box-sizing: border-box;
}

/* Portal Tab Styling */
.portal-tab-container {
    display: flex;
    gap: 0;
    margin-bottom: 30px;
    border-bottom: 2px solid #e5e7eb;
}

.portal-tab {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 1rem;
    color: var(--dark-gray);
    cursor: pointer;
    transition: all var(--transition);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-weight: 500;
}

.portal-tab:hover {
    color: var(--primary-color);
    background-color: rgba(30, 58, 138, 0.05);
}

.portal-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--secondary-color);
}

.portal-tab-content {
    display: none;
}

.portal-tab-content.active {
    display: block;
}

/* Portal Dashboard */
.portal-dashboard {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 30px;
    padding: 30px 0;
    min-width: 0;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
}

.dashboard-header h1 {
    font-size: clamp(1.5rem, 2.5vw, 2.25rem);
    margin: 0;
}

.user-email-display {
    display: inline-block;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .portal-dashboard {
        grid-template-columns: 1fr;
    }

    .portal-sidebar,
    .portal-content {
        padding: 20px;
    }
}

@media (max-width: 600px) {
    .portal-tab-container {
        flex-direction: column;
        gap: 10px;
    }

    .portal-tab {
        width: 100%;
        text-align: center;
    }

    .login-form {
        padding: 20px;
    }

    .login-form h2 {
        font-size: 1.25rem;
    }

    .portal-content {
        padding: 20px;
    }

    .portal-sidebar {
        padding: 15px;
    }

    .portal-sidebar a {
        padding: 12px 10px;
    }

    .navbar .container {
        gap: 0.5rem;
    }
}

.portal-sidebar ul {
    list-style: none;
}

.portal-sidebar ul li {
    margin-bottom: 10px;
}

.portal-sidebar a {
    display: block;
    padding: 10px 15px;
    background-color: var(--white);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

.portal-sidebar a:hover,
.portal-sidebar a.active {
    background-color: var(--primary-color);
    color: var(--white);
}

.portal-content {
    background-color: var(--white);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-width: 0;
}

.user-email-display {
    display: inline-block;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.portal-section.active {
    display: block;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin: 20px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--white);
}

table thead {
    background-color: var(--light-gray);
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

table th {
    color: var(--primary-color);
    font-weight: 600;
}

table tbody tr:hover {
    background-color: #f9fafb;
}

/* Alert Styles */
.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background-color: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.alert-error {
    background-color: #fee2e2;
    border-color: #ef4444;
    color: #7f1d1d;
}

.alert-info {
    background-color: #dbeafe;
    border-color: #3b82f6;
    color: #1e3a8a;
}

.chat-box {
    background-color: var(--light-gray);
    padding: 20px;
    border-radius: var(--border-radius);
}

.chat-history {
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 5px;
    background-color: #f2f7ef;
    border-radius: var(--border-radius);
    padding: 18px;
}

.chat-message {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 78%;
    padding: 12px 14px;
    border-radius: 20px;
    line-height: 1.5;
    position: relative;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.chat-message.user {
    background-color: #dcf8c6;
    color: #0f172a;
    align-self: flex-end;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 4px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.chat-message.admin {
    background-color: #ffffff;
    color: #0f172a;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 20px;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.chat-message strong {
    font-size: 0.9rem;
    color: #475569;
}

.chat-file {
    margin-top: 8px;
    padding: 10px 12px;
    background: rgba(247, 250, 253, 0.95);
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    display: inline-flex;
    flex-direction: column;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
}

.chat-file img,
.chat-file video {
    max-width: 260px;
    max-height: 220px;
    border-radius: 12px;
    object-fit: cover;
}

.chat-file video {
    width: 100%;
}

.chat-file a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.chat-file small {
    color: #64748b;
    font-size: 0.8rem;
}

.chat-message small {
    display: block;
    font-size: 0.78rem;
    color: #475569;
}

.chat-meta {
    margin-bottom: 15px;
    font-size: 0.95rem;
    color: var(--dark-gray);
}

.chat-form {
    display: grid;
    gap: 15px;
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: var(--border-radius);
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.chat-composer-header {
    display: grid;
    gap: 4px;
    padding-bottom: 4px;
}

.chat-form-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.file-upload {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.8rem 1rem;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    cursor: pointer;
    color: var(--dark-gray);
    font-size: 0.95rem;
    transition: background-color var(--transition), transform var(--transition);
}

.file-upload input {
    display: none;
}

.file-upload:hover {
    background-color: #f8fafc;
    transform: translateY(-1px);
}

.upload-card {
    background-color: var(--light-gray);
    border-radius: var(--border-radius);
    border: 1px solid #e5e7eb;
}

.upload-doc-form {
    display: grid;
    gap: 15px;
}

.document-grid {
    display: grid;
    gap: 15px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.document-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border-radius: var(--border-radius);
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
}

.document-card strong {
    display: block;
    margin-bottom: 6px;
    color: #111827;
}

.chat-box {
    background-color: var(--light-gray);
    padding: 24px;
    border-radius: var(--border-radius);
}

.chat-history {
    max-height: 480px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    background-color: #f8fafc;
    border-radius: var(--border-radius);
    border: 1px solid #e2e8f0;
}

.client-list {
    display: grid;
    gap: 10px;
    margin-top: 15px;
}

.client-item {
    cursor: pointer;
    background-color: var(--white);
    border: 1px solid #e5e7eb;
    border-radius: var(--border-radius);
    padding: 14px 16px;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.client-item.active,
.client-item:hover {
    border-color: var(--secondary-color);
    background-color: #f8fafc;
}

.client-item.has-unread {
    border-left: 3px solid var(--secondary-color);
    background-color: #fff8e8;
    animation: adminUnreadPulse 1.2s ease-in-out infinite;
}

.client-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 999px;
    background-color: var(--secondary-color);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Loading Spinner */
.spinner {
    border: 4px solid var(--light-gray);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes adminUnreadPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.24);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(255, 107, 53, 0);
    }
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition);
}

.breadcrumb a:hover {
    color: var(--secondary-color);
}

.breadcrumb span {
    color: var(--dark-gray);
    margin: 0 8px;
}

/* Alert Styles */
.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-weight: 500;
    border-left: 4px solid;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-left-color: #10b981;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-left-color: #dc2626;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border-left-color: #f59e0b;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border-left-color: #3b82f6;
}

/* Password Reset Form Styles */
.max-w-420 {
    max-width: 420px;
}

.login-form {
    background-color: var(--white);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
