/**
 * PURL Landing Page Styles
 *
 * Modern two-column layout with background image and card-based form.
 * Customizable via CSS custom properties set by PurlBranding.
 */

/* CSS Custom Properties (defaults) */
:root {
    --purl-primary: #3b82f6;
    --purl-secondary: #1e40af;
    --purl-accent: #10b981;
    --purl-text: #1f2937;
    --purl-bg: #ffffff;
    --purl-font: 'Inter', system-ui, -apple-system, sans-serif;
    --purl-radius: 8px;

    /* Derived colors */
    --purl-text-muted: #6b7280;
    --purl-border: #e5e7eb;
    --purl-input-bg: #f9fafb;
    --purl-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --purl-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base styles */
body.purl-page {
    font-family: var(--purl-font);
    background: var(--purl-bg);
    color: var(--purl-text);
    line-height: 1.6;
    min-height: 100vh;
    margin: 0;
}

/* Background image support */
body.purl-page.has-background {
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* Preview banner */
.preview-banner {
    background: #fbbf24;
    color: #78350f;
    text-align: center;
    padding: 8px;
    font-size: 14px;
    font-weight: 500;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
}

body.purl-page.has-preview .purl-navbar {
    top: 36px;
}

body.purl-page.has-preview .purl-content {
    padding-top: 116px;
}

/* Fixed Navbar */
.purl-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.purl-navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.purl-logo {
    max-height: 60px;
    max-width: 200px;
    height: auto;
    width: auto;
}

.purl-org-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--purl-primary);
}

/* Main content area */
.purl-content {
    padding: 60px 0;
    padding-top: 100px;
    min-height: 100vh;
}

.purl-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.purl-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
    align-items: flex-start;
}

.purl-col-welcome {
    flex: 0 0 58.333%;
    max-width: 58.333%;
    padding: 0 15px 0 30px;
}

.purl-col-form {
    flex: 0 0 41.667%;
    max-width: 41.667%;
    padding: 0 15px;
}

/* Welcome section - left side */
.purl-welcome-section {
    color: white;
    padding-top: 30px;
}

.purl-welcome-section h1 {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
}

.purl-welcome-section h1 + h1 {
    margin-top: -10px;
}

.purl-welcome-section p {
    font-size: 24px;
    margin-top: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Form wrapper - right side */
.purl-form-wrapper {
    background: white;
    border-radius: var(--purl-radius);
    overflow: hidden;
    box-shadow: var(--purl-shadow-lg);
}

.purl-form-head {
    background: var(--purl-secondary);
    color: white;
    padding: 20px;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
}

.purl-form-body {
    padding: 30px;
}

/* Alert */
.purl-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--purl-radius);
    margin-bottom: 20px;
    font-size: 14px;
}

.purl-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Form grid */
.purl-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.purl-form-group {
    margin-bottom: 0;
}

.purl-form-group-full {
    grid-column: 1 / -1;
}

/* Form controls */
.purl-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
    color: #212529;
}

.purl-required {
    color: #ef4444;
    margin-left: 2px;
}

.purl-input,
.purl-select,
.purl-textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 16px;
    font-family: inherit;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
    color: #212529;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.purl-input:focus,
.purl-select:focus,
.purl-textarea:focus {
    outline: none;
    border-color: var(--purl-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.purl-input::placeholder {
    color: #6c757d;
}

.purl-input[readonly] {
    background-color: #e9ecef;
    opacity: 1;
}

.purl-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px 12px;
    padding-right: 36px;
}

.purl-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Submit button */
.purl-submit {
    width: 100%;
    padding: 14px 24px;
    font-size: 18px;
    font-weight: 600;
    font-family: inherit;
    color: #ffffff;
    background: var(--purl-primary);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    margin-top: 15px;
}

.purl-submit:hover {
    background: var(--purl-secondary);
}

.purl-submit:active {
    transform: scale(0.98);
}

.purl-submit:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* reCAPTCHA wrapper */
.purl-recaptcha-wrapper {
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

.g-recaptcha {
    transform: scale(1);
    transform-origin: 0 0;
}

/* Consent text */
.purl-consent {
    margin: 20px 0 0;
}

.purl-consent-text {
    font-size: 12px;
    color: #6c757d;
    line-height: 1.5;
}

.purl-consent-text a {
    color: var(--purl-primary);
    text-decoration: none;
}

.purl-consent-text a:hover {
    text-decoration: underline;
}

.purl-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.purl-consent-checkbox {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--purl-primary);
    cursor: pointer;
}

/* Legal text */
.purl-legal {
    margin-top: 16px;
    font-size: 12px;
    color: var(--purl-text-muted);
    text-align: center;
}

.purl-legal a {
    color: var(--purl-primary);
    text-decoration: none;
}

.purl-legal a:hover {
    text-decoration: underline;
}

/* Contact section */
.purl-contact {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--purl-border);
}

.purl-contact p {
    color: var(--purl-text-muted);
    margin-bottom: 8px;
    font-size: 14px;
}

.purl-contact-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--purl-primary);
    text-decoration: none;
    margin: 0 8px;
    font-size: 14px;
}

.purl-contact-link:hover {
    text-decoration: underline;
}

/* Footer */
.purl-footer {
    background: white;
    padding: 40px 0 0;
    margin-top: 60px;
    text-align: center;
    color: #343a40;
}

.purl-footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 20px;
}

.purl-footer-info {
    margin-bottom: 15px;
}

.purl-footer-info strong {
    display: block;
    margin-bottom: 5px;
}

.purl-footer-links {
    margin-bottom: 15px;
}

.purl-footer-links a {
    color: var(--purl-primary);
    text-decoration: none;
    margin: 0 10px;
}

.purl-footer-links a:hover {
    text-decoration: underline;
}

.purl-footer-text {
    color: var(--purl-text-muted);
    font-size: 14px;
    margin-bottom: 16px;
}

.purl-powered-by {
    font-size: 12px;
    color: var(--purl-text-muted);
    margin-bottom: 8px;
}

.purl-powered-by a {
    color: var(--purl-primary);
    text-decoration: none;
    font-weight: 500;
}

.purl-copyright {
    font-size: 12px;
    color: var(--purl-text-muted);
}

.purl-disclaimer {
    background: #e9ecef;
    padding: 20px;
    margin-top: 20px;
    font-size: 13px;
    color: #6c757d;
    text-align: left;
}

.purl-disclaimer p {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Success page styles */
.purl-success-page .purl-form-body {
    text-align: center;
    padding: 50px 30px;
}

.purl-success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--purl-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.purl-success-icon svg {
    width: 40px;
    height: 40px;
}

.purl-success-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--purl-accent);
    margin-bottom: 15px;
}

.purl-success-message {
    font-size: 18px;
    color: #666;
    margin-bottom: 25px;
}

.purl-success-next-steps {
    background: var(--purl-input-bg);
    border-radius: var(--purl-radius);
    padding: 20px;
    text-align: left;
    margin-bottom: 25px;
}

.purl-success-next-steps h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

.purl-success-next-steps ol {
    padding-left: 20px;
    color: var(--purl-text-muted);
    margin: 0;
}

.purl-success-next-steps li {
    margin-bottom: 8px;
}

.purl-success-contact {
    margin-top: 25px;
}

.purl-success-contact p {
    color: var(--purl-text-muted);
    margin-bottom: 12px;
}

.purl-success-phone,
.purl-success-email {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    margin: 6px;
    background: var(--purl-primary);
    color: #ffffff;
    text-decoration: none;
    border-radius: var(--purl-radius);
    font-weight: 500;
    transition: background-color 0.2s;
}

.purl-success-phone:hover,
.purl-success-email:hover {
    background: var(--purl-secondary);
}

/* Prepopulated field styles */
.prepopulated {
    background-color: #fffbf0 !important;
    border-color: var(--purl-secondary) !important;
}

.prepopulated-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background-color: #fffbf0;
    border-left: 4px solid var(--purl-secondary);
    padding: 12px 15px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #856404;
    border-radius: 0 4px 4px 0;
}

/* Form field error state */
.purl-input.is-invalid,
.purl-select.is-invalid,
.purl-textarea.is-invalid {
    border-color: #dc3545 !important;
}

.invalid-feedback {
    display: block;
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
}

/* Two-step flow progress indicator */
.step-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--purl-border);
    transition: background-color 0.2s;
}

.step-dot.active {
    background: var(--purl-primary);
}

.step-dot.completed {
    background: var(--purl-accent);
}

/* Ref code input wrapper */
.ref-code-input-wrapper {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ref-code-input-wrapper:focus-within {
    border-color: var(--purl-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ref-code-prefix {
    background: var(--purl-primary);
    color: white;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 16px;
    user-select: none;
}

.ref-code-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 14px;
    font-size: 16px;
    font-family: inherit;
    color: #212529;
    outline: none;
}

.ref-code-input::placeholder {
    color: #6c757d;
}

/* Ref instructions box */
.ref-instructions {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #6c757d;
}

.ref-instructions p {
    margin: 0 0 8px;
}

.ref-instructions p:last-child {
    margin-bottom: 0;
}

.ref-instructions strong {
    color: #212529;
}

/* Skip link */
.skip-link {
    display: block;
    text-align: center;
    margin-top: 16px;
    color: var(--purl-text-muted);
    font-size: 14px;
    text-decoration: none;
    transition: color 0.2s;
}

.skip-link:hover {
    color: var(--purl-primary);
    text-decoration: underline;
}

/* Responsive styles */
@media (max-width: 992px) {
    .purl-col-welcome,
    .purl-col-form {
        flex: 0 0 100%;
        max-width: 100%;
        padding: 0 15px;
    }

    .purl-col-welcome {
        margin-bottom: 30px;
        text-align: center;
    }

    .purl-welcome-section {
        padding-top: 0;
    }

    .purl-welcome-section h1 {
        font-size: 36px;
    }

    .purl-welcome-section p {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .purl-content {
        padding: 30px 0;
        padding-top: 90px;
    }

    .purl-welcome-section h1 {
        font-size: 32px;
    }

    .purl-welcome-section p {
        font-size: 18px;
    }

    .purl-form-body {
        padding: 20px;
    }

    .purl-form-grid {
        grid-template-columns: 1fr;
    }

    .purl-submit {
        font-size: 16px;
        padding: 12px 20px;
    }

    .g-recaptcha {
        transform: scale(0.9);
        transform-origin: center center;
    }

    .purl-recaptcha-wrapper {
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .purl-navbar {
        padding: 10px 0;
    }

    .purl-logo {
        max-height: 45px;
    }

    .purl-welcome-section h1 {
        font-size: 28px;
    }

    .purl-welcome-section p {
        font-size: 16px;
    }

    .purl-form-head {
        font-size: 18px;
        padding: 15px;
    }

    .purl-form-body {
        padding: 15px;
    }
}

/* Dark theme adjustments */
.theme-dark {
    --purl-bg: #111827;
    --purl-text: #f9fafb;
    --purl-text-muted: #9ca3af;
    --purl-border: #374151;
    --purl-input-bg: #1f2937;
}

.theme-dark .purl-navbar {
    background: #1f2937;
}

.theme-dark .purl-form-wrapper {
    background: #1f2937;
}

.theme-dark .purl-form-body {
    background: #1f2937;
}

.theme-dark .purl-input,
.theme-dark .purl-select,
.theme-dark .purl-textarea {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

.theme-dark .purl-label {
    color: #f9fafb;
}

.theme-dark .purl-footer {
    background: #1f2937;
    color: #f9fafb;
}

.theme-dark .purl-disclaimer {
    background: #374151;
    color: #9ca3af;
}

.theme-dark .prepopulated {
    background-color: #3d3520 !important;
}

.theme-dark .prepopulated-notice {
    background-color: #3d3520;
    color: #fcd34d;
}

.theme-dark .purl-alert-error {
    background: #450a0a;
    color: #fecaca;
    border-color: #7f1d1d;
}
