/* =========================================
   1. RESET & VARIABLES
   ========================================= */
:root {
    /* Primary Blues */
    --primary-900: #1e3a8a;
    --primary-800: #1e40af;
    --primary-700: #1d4ed8;
    --primary-600: #2563eb;
    --primary-500: #3b82f6;
    --primary-400: #60a5fa;
    --primary-100: #dbeafe;
    --primary-50: #eff6ff;

    /* Secondary / Status */
    --success-600: #059669;
    --success-500: #10b981;
    --success-100: #d1fae5;
    --error-600: #dc2626;
    --error-100: #fee2e2;

    /* Neutrals */
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --white: #ffffff;

    /* Typography */
    /* System Font Stack for offline reliability */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    /* Spacing & Sizes */
    --container-xl: 1200px;
    --header-height: 70px;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    background-color: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img,
svg {
    display: block;
    max-width: 100%;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--gray-900);
    line-height: 1.2;
}

a {
    text-decoration: none;
    color: inherit;
}

/* =========================================
   2. UTILITIES (Replaces Tailwind)
   ========================================= */
.container {
    max-width: var(--container-xl);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-8 {
    gap: 2rem;
}

.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .md-grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .md-grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .md-col-span-2 {
        grid-column: span 2;
    }
}

@media (min-width: 1024px) {
    .lg-grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .lg-col-span-2 {
        grid-column: span 2;
    }

    .lg-col-span-1 {
        grid-column: span 1;
    }

    .lg-flex-row {
        flex-direction: row;
    }
}

.text-center {
    text-align: center;
}

.hidden {
    display: none;
}

.block {
    display: block;
}

.w-full {
    width: 100%;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-8 {
    margin-top: 2rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

/* Icons */
.icon-sm {
    width: 1.25rem;
    height: 1.25rem;
}

.icon-md {
    width: 1.5rem;
    height: 1.5rem;
}

.icon-lg {
    width: 4rem;
    height: 4rem;
}

.icon-primary {
    color: var(--primary-600);
}

.icon-success {
    color: var(--success-600);
}

/* =========================================
   3. COMPONENTS
   ========================================= */

/* Header */
.header {
    background: var(--primary-900);
    color: var(--white);
    height: var(--header-height);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.05em;
}

.logo span {
    color: var(--primary-400);
}

.badge {
    background-color: var(--primary-800);
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-weight: 500;
    opacity: 0.9;
}

/* Hero */
.hero {
    background: linear-gradient(180deg, var(--primary-50) 0%, var(--white) 100%);
    padding: 4rem 0 3rem;
    text-align: center;
    border-bottom: 1px solid var(--gray-100);
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-900), var(--primary-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p.lead {
    font-size: 1.1rem;
    color: var(--gray-600);
    max-width: 600px;
    margin: 0 auto 2.5rem;
}

/* Benefits Grid */
.benefits {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    max-width: 900px;
    margin: 0 auto;
}

.benefit-item {
    background: var(--white);
    padding: 1rem;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
    border: 1px solid var(--gray-100);
}

/* Main Layout */
.main-content {
    padding: 3rem 0;
}

.layout-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: flex-start;
}

@media (min-width: 1024px) {
    .layout-grid {
        grid-template-columns: 2fr 1fr;
    }
}

/* Form Card */
.form-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    border: 1px solid var(--gray-200);
}

fieldset {
    border: none;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-left: 4px solid var(--primary-600);
}

legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-900);
    padding: 0 0.5rem;
    margin-bottom: 1rem;
}

/* Form Inputs */
.form-group {
    margin-bottom: 0;
    /* Handled by grid gap */
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.4rem;
}

label .required {
    color: var(--error-600);
}

.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--gray-900);
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--primary-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--primary-100);
    margin-bottom: 1.5rem;
}

input[type="checkbox"] {
    margin-top: 0.25rem;
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-weight: 600;
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-800) 0%, var(--primary-600) 100%);
    color: var(--white);
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.btn-primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--gray-400);
    box-shadow: none;
}

.btn-white {
    background: var(--white);
    color: var(--primary-900);
    font-weight: 600;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--white);
    transition: transform 0.2s;
}

.btn-white:hover {
    transform: scale(1.02);
    background: var(--primary-50);
}

/* Sticky Sidebar */
.sticky-card {
    background: linear-gradient(135deg, var(--primary-900) 0%, var(--primary-800) 100%);
    color: var(--white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    position: sticky;
    top: calc(var(--header-height) + 2rem);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.sticky-card h3 {
    color: var(--white);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.feature-list {
    list-style: none;
    margin: 1.5rem 0;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--primary-100);
    font-size: 0.95rem;
}

/* =========================================
   4. PRINT STYLES
   ========================================= */
#printableArea {
    display: none;
    font-family: 'Noto Serif', serif;
    line-height: 1.6;
    color: #000;
    font-size: 11pt;
}

@media print {

    /* 1. Hide web-only elements completely to remove their layout space */
    .header,
    .hero,
    .main-content,
    .btn,
    .checkbox-wrapper,
    footer {
        display: none !important;
    }

    /* 2. Reset Body */
    body {
        margin: 0;
        padding: 0;
        background: white;
        visibility: visible;
    }

    /* 3. Prepare Printable Area */
    #printableArea {
        display: block !important;
        visibility: visible;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    #printableArea * {
        visibility: visible;
    }

    /* 4. Formatting */
    .page-break {
        page-break-before: always;
    }

    h1 {
        font-size: 16pt;
        text-align: center;
        margin-bottom: 1cm;
        text-decoration: underline;
        font-weight: bold;
    }

    h2 {
        font-size: 12pt;
        margin-top: 0.8cm;
        margin-bottom: 0.3cm;
        background-color: #f0f0f0;
        padding: 5px;
        border-bottom: 1px solid #000;
        font-weight: bold;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .info-row {
        margin-bottom: 6px;
        padding-bottom: 2px;
        border-bottom: 1px dotted #ccc;
        display: flex;
        justify-content: space-between;
    }

    .info-label {
        font-weight: bold;
    }

    .signatures {
        display: flex;
        justify-content: space-between;
        margin-top: 2cm;
        page-break-inside: avoid;
    }

    .sign-box {
        width: 40%;
        text-align: center;
        border-top: 1px solid #000;
        padding-top: 10px;
    }

    /* Hide URLs on print */
    a[href]:after {
        content: none !important;
    }
}