/* =============================================================================
   Public Form Gateway - Styles
   Cloudflare Pages Static Site
   ============================================================================= */

/* CSS Variables (set dynamically by JavaScript) */
:root {
    --primary-color: #0d6efd;
    --background-color: #f5f7fa;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, var(--background-color) 0%, #e4e9f2 100%);
    min-height: 100vh;
    padding: 2rem 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
}

/* Layout */
.form-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

/* Header */
.form-header {
    text-align: center;
    margin-bottom: 2rem;
}

/* Co-branding logo container */
.logo-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    min-height: 60px;
}

.logo-left, .logo-right {
    flex: 0 0 auto;
    max-width: 45%;
}

.logo-left img, .logo-right img {
    max-height: 60px;
    max-width: 200px;
    object-fit: contain;
}

/* Single logo centered fallback */
.logo-container.single-logo {
    justify-content: center;
}

.logo-container.single-logo .logo-left,
.logo-container.single-logo .logo-right {
    max-width: 100%;
}

.logo-container.single-logo img {
    max-height: 80px;
    max-width: 300px;
}

.form-header h2 {
    color: #1f2937;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-header p {
    color: #6b7280;
    margin: 0;
}

/* Main Container */
.form-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    min-height: 300px;
}

/* Loading State */
#loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    color: var(--primary-color);
}

/* Error State */
.error-container {
    text-align: center;
    padding: 3rem;
}

.error-container i {
    font-size: 4rem;
    color: #ef4444;
    margin-bottom: 1.5rem;
}

.error-container h3 {
    color: #1f2937;
    margin-bottom: 0.5rem;
}

/* Success State */
.success-container {
    text-align: center;
    padding: 3rem;
}

.success-container i {
    font-size: 5rem;
    color: #10b981;
    margin-bottom: 1.5rem;
}

.success-container h3 {
    color: #1f2937;
    margin-bottom: 0.5rem;
}

/* Footer */
.powered-by {
    text-align: center;
    margin-top: 2rem;
    color: #9ca3af;
    font-size: 0.85rem;
}

/* SurveyJS Theme Overrides */
.sd-root-modern {
    --sjs-primary-backcolor: var(--primary-color);
}

/* Ensure survey takes full width */
#survey-container {
    width: 100%;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    body {
        padding: 1rem 0.5rem;
    }
    
    .form-container {
        padding: 1.5rem 1rem;
        border-radius: 12px;
    }
    
    .form-header h2 {
        font-size: 1.5rem;
    }
    
    .form-header img {
        max-height: 60px;
        max-width: 200px;
    }
    
    .success-container i,
    .error-container i {
        font-size: 3rem;
    }
}

/* Toast Notifications */
.toast-notification {
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
    animation: toast-slide-in 0.3s ease-out;
}

.toast-notification.toast-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.toast-notification.toast-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.toast-content {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    gap: 0.75rem;
}

.toast-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
}

.toast-error .toast-icon {
    color: #dc2626;
}

.toast-info .toast-icon {
    color: #2563eb;
}

.toast-text {
    flex: 1;
}

.toast-text strong {
    display: block;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.toast-text p {
    margin: 0;
    color: #6b7280;
    font-size: 0.9rem;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: #9ca3af;
    font-size: 1.25rem;
    line-height: 1;
}

.toast-close:hover {
    color: #6b7280;
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast-fade-out {
    animation: toast-fade-out 0.3s ease-out forwards;
}

@keyframes toast-fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .form-container {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
    
    .powered-by {
        display: none;
    }
    
    .toast-notification {
        display: none;
    }
}
