/* ===========================
   Parent Portal Specific Styles
   =========================== */

/* --- Navigation Fixes --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.logo {
    font-size: 1.5rem;
    font-weight: 900;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.03em;
    color: #000;
    line-height: 1;
}

.logo .accent {
    color: #2563eb;
    /* Brand Blue */
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
}

.nav-links a,
.nav-links span {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #111;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: #2563eb;
}

/* Fix oversized cart icon */
.cart-icon {
    width: 24px;
    height: 24px;
}

.nav-item-disabled {
    color: #9ca3af;
    /* Gray-400 */
    cursor: not-allowed !important;
    position: relative;
    display: inline-flex;
    align-items: center;
}

.coming-soon-badge {
    font-size: 0.6rem;
    background: #f3f4f6;
    color: #6b7280;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    border: 1px solid #e5e7eb;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0;
}

.btn-primary {
    background-color: #2563eb;
    color: white !important;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 700;
    transition: background-color 0.2s ease, transform 0.1s ease;
    border: none;
    /* Fix: Remove default button border */
}

.btn-primary:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }
}


/* --- Portal Login View --- */
.portal-container {
    min-height: calc(100vh - 80px);
    /* Subtract nav height */
    background-color: #f3f4f6;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.portal-login-view {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: 1.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.login-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: #111;
}

.login-header p {
    color: #6b7280;
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.form-group {
    text-align: left;
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    font-size: 1rem;
    background-color: #f9fafb;
    transition: all 0.2s;
}

.form-group input:focus {
    background-color: white;
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
}

.forgot-link {
    display: block;
    text-align: right;
    font-size: 0.85rem;
    color: #2563eb;
    margin-top: 0.5rem;
}

.full-width {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #9ca3af;
    margin: 1.5rem 0;
    font-size: 0.85rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e5e7eb;
}

.divider span {
    padding: 0 1rem;
}

.google-btn {
    background: white;
    color: #374151 !important;
    border: 1px solid #e5e7eb;
    font-weight: 600;
}

.google-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #111 !important;
}

.login-footer {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: #6b7280;
}

.login-footer a {
    color: #2563eb;
    font-weight: 600;
}


/* --- Portal Dashboard Layout (The V3 System) --- */
.portal-dashboard-v3 {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: fixed;
    /* Take over the screen */
    top: 0;
    left: 0;
    z-index: 2000;
    /* Above regular nav */
    background: #f3f4f6;
}

/* Sidebar */
.portal-sidebar-v3 {
    width: 280px;
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
}

.sidebar-header {
    margin-bottom: 2rem;
    padding-left: 0.75rem;
}

.logo-text {
    font-weight: 900;
    font-size: 1.25rem;
    letter-spacing: -0.05em;
}

.sidebar-nav-v3 {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    color: #4b5563;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}

.nav-item:hover {
    background-color: #f3f4f6;
    color: #111;
}

.nav-item.active {
    background-color: #eff6ff;
    color: #2563eb;
}

/* Icon Sizing Fixes - CRITICAL */
.icon,
.card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon svg {
    width: 20px;
    height: 20px;
}

.card-icon svg {
    width: 24px;
    /* Slightly larger for cards */
    height: 24px;
}

/* User Profile Section in Sidebar */
.sidebar-user {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0.75rem;
    border-top: 1px solid #f3f4f6;
    margin-bottom: 1rem;
}

.user-avatar-small {
    width: 40px;
    height: 40px;
    background: #2563eb;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #111;
    line-height: 1.2;
}

.user-role {
    font-size: 0.75rem;
    color: #6b7280;
}

.logout-btn-v3 {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 0.5rem;
    color: #374151;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn-v3:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

/* Main Content Area */
.portal-main-v3 {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background-color: #f9fafb;
}

.mobile-header {
    display: none;
    /* Hidden on desktop */
}

/* Documents Grid */
.documents-grid-v3 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.doc-card-v3 {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.doc-card-v3:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: #d1d5db;
}

.card-status {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
}

.card-status.pending {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.card-status.complete {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.doc-card-v3 h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111;
    margin: 0;
}

.doc-card-v3 p {
    font-size: 0.9rem;
    color: #6b7280;
    line-height: 1.4;
    margin: 0;
    flex: 1;
}

.btn-card {
    width: 100%;
    padding: 0.75rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    color: #111;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-card:hover {
    background: #111;
    color: white;
    border-color: #111;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .portal-dashboard-v3 {
        flex-direction: column;
    }

    .portal-sidebar-v3 {
        position: fixed;
        left: -100%;
        /* Hide off-screen */
        height: 100vh;
        z-index: 3000;
        transition: left 0.3s ease;
        box-shadow: 10px 0 25px rgba(0, 0, 0, 0.1);
    }

    .portal-sidebar-v3.open {
        left: 0;
    }

    .portal-main-v3 {
        width: 100%;
        padding: 1rem;
        padding-top: 80px;
        /* Space for mobile header */
    }

    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: white;
        padding: 1rem 1.5rem;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 2100;
        border-bottom: 1px solid #e5e7eb;
    }

    .logo-text-mobile {
        font-weight: 900;
        font-size: 1.25rem;
    }

    .menu-toggle {
        font-size: 1.5rem;
        background: none;
        border: none;
        cursor: pointer;
    }
}


/* --- Document Modal (Fixed & Top Tier UI) --- */
.doc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    /* Darker dim */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    /* Top layer */
    display: none;
    /* Hidden by default */
    justify-content: center;
    align-items: center;
    opacity: 0;
    animation: fadeInModal 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.doc-modal {
    background: white;
    width: 100%;
    max-width: 550px;
    /* Optimal reading width */
    max-height: 85vh;
    border-radius: 24px;
    /* iOS-like large radius */
    box-shadow: 0 40px 60px -15px rgba(0, 0, 0, 0.3);
    /* Deep shadow for elevation */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    animation: popInModal 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    /* Spring-like pop */
}

@keyframes popInModal {
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.doc-modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.doc-modal-header h3 {
    font-size: 1.35rem;
    font-weight: 800;
    color: #111;
    margin: 0;
    letter-spacing: -0.02em;
}

.modal-close {
    background: #f3f4f6;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.1rem;
    color: #6b7280;
}

.modal-close:hover {
    background: #e5e7eb;
    color: #000;
    transform: rotate(90deg);
}

.doc-modal-body {
    padding: 2rem;
    overflow-y: auto;
    background: #fff;
}

/* Beautiful Legal Text Box */
.legal-scroll-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #374151;
    margin-bottom: 1.5rem;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* Form Styling */
.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #6b7280;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
    display: block;
}

.modal-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    background: #fff;
    transition: all 0.2s;
    -webkit-appearance: none;
}

.modal-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
}

/* Signature Pad Polish */
.signature-pad-wrapper {
    background: #fff;
    border: 2px dashed #d1d5db;
    border-radius: 16px;
    position: relative;
    margin: 0.5rem 0 1rem 0;
    overflow: hidden;
    transition: border-color 0.2s;
}

.signature-pad-wrapper:hover {
    border-color: #2563eb;
}

.signature-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #d1d5db;
    font-weight: 700;
    pointer-events: none;
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Button & Checkbox Area */
.agreement-checkbox {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #f3f4f6;
}

.agreement-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #2563eb;
    cursor: pointer;
}

.agreement-checkbox label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
}

#submit-waiver:disabled {
    background: #e5e7eb;
    border-color: transparent;
    color: #9ca3af !important;
    cursor: not-allowed;
    transform: none;
}

#submit-waiver {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    letter-spacing: 0.02em;
}