/* SayGames Event - Style */
:root {
    --primary: #1DB954;
    --primary-dark: #1A472A;
    --primary-light: #2ECC71;
    --accent: #FFD93D;
    --bg: #1DB954;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --red-500: #ef4444;
    --red-100: #fee2e2;
    --orange-500: #f97316;
    --orange-100: #ffedd5;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 20px 50px rgba(0,0,0,0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--gray-900);
    line-height: 1.5;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    -webkit-overflow-scrolling: touch;
}

[x-cloak] { display: none !important; }

/* Gradient Background */
.gradient-bg {
    background: radial-gradient(circle at 50% 30%, #25D366 0%, #1DB954 50%, #15803D 100%);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
}

/* Container */
.container { max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* Typography */
h1 { font-size: 2.5rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
.text-white { color: var(--white); }
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }

/* Spacing */
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.ml-4 { margin-left: 1rem; }
.p-6 { padding: 1.5rem; }
.py-8 {
    padding-top: calc(2rem + env(safe-area-inset-top, 0px));
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
}
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

/* Flex & Grid */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

/* Progress Bar */
.progress-container {
    background: rgba(255,255,255,0.15);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 20px 24px;
}

@supports not (backdrop-filter: blur(10px)) {
    .progress-container {
        background: rgba(255,255,255,0.25);
    }
}

.progress-bar {
    height: 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-fill {
    height: 100%;
    background: var(--white);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.progress-steps {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: flex-start;
    gap: 8px;
}

.progress-step {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 8px;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.3s;
    flex: 1;
    min-width: 0;
}

.progress-step.active,
.progress-step.completed {
    opacity: 1;
}

.step-dot {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700;
    color: var(--white);
    font-size: 0.875rem;
    transition: all 0.3s;
}

.progress-step.active .step-dot {
    background: var(--white);
    color: var(--primary);
    transform: scale(1.1);
}

.progress-step.completed .step-dot {
    background: var(--accent);
    color: var(--primary-dark);
}

.step-label {
    font-size: 0.75rem;
    color: var(--white);
    font-weight: 500;
    text-align: center;
}

@media (max-width: 480px) {
    .step-label { display: none; }
}

/* Navigation Buttons */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
}

.nav-buttons .btn {
    flex: 1;
    max-width: 200px;
}

@media (max-width: 480px) {
    .nav-buttons { flex-direction: column; }
    .nav-buttons .btn { max-width: 100%; }
}

/* Error Message */
.error-message {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    margin-top: 20px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    animation: shake 0.5s ease, fadeIn 0.3s ease;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 32px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: var(--primary-dark);
    color: var(--white);
    box-shadow: 0 8px 30px rgba(26,71,42,0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(26,71,42,0.5);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255,255,255,0.15);
    color: var(--white);
    border: 2px solid rgba(255,255,255,0.3);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.5);
}

.btn-outline {
    background: transparent;
    border: 2px dashed var(--gray-300);
    color: var(--gray-500);
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    width: 100%;
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--red-500);
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    -webkit-appearance: none;
}

.btn-icon:hover {
    background: rgba(239,68,68,0.1);
}

.btn-block { width: 100%; }

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--gray-100);
}

.card-header h2 { margin: 0; }

.card-header::before {
    content: '';
    width: 4px;
    height: 28px;
    background: var(--primary);
    border-radius: 2px;
}

/* Form Elements */
.form-group { margin-bottom: 20px; }

.label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.875rem;
}

.required {
    color: #dc2626;
    font-weight: 700;
    margin-left: 3px;
}

.input, .textarea, .select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: all 0.2s;
    background: var(--white);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.input:focus, .textarea:focus, .select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(29,185,84,0.1);
}

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

/* Telegram input */
.telegram-input {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.telegram-prefix {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    font-weight: 600;
    color: var(--gray-500);
    font-size: 1rem;
    min-height: 50px;
}

.telegram-field {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
    flex: 1;
}

/* Date input */
input[type="date"] {
    position: relative;
    -webkit-appearance: none;
}

input[type="date"]::-webkit-date-and-time-value {
    text-align: left;
}

/* Document expiry states */
.input-expired {
    border-color: #dc2626 !important;
    background-color: #fef2f2 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2) !important;
}

.input-expired:focus {
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.3) !important;
}

.input-warning {
    border-color: #ea580c !important;
    background-color: #fff7ed !important;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.2) !important;
}

.input-warning:focus {
    box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.3) !important;
}

/* Expiry warnings */
.expiry-warning {
    display: block !important;
    margin-top: 8px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    color: #c2410c;
    border: 2px solid #fb923c;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    animation: pulseWarning 2s ease-in-out infinite;
}

.expiry-error {
    display: block !important;
    margin-top: 8px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #b91c1c;
    border: 2px solid #f87171;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    animation: pulseError 1.5s ease-in-out infinite;
}

@keyframes pulseWarning {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(251, 146, 60, 0.4);
    }
    50% {
        transform: scale(1.01);
        box-shadow: 0 0 0 6px rgba(251, 146, 60, 0);
    }
}

@keyframes pulseError {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.4);
    }
    50% {
        transform: scale(1.01);
        box-shadow: 0 0 0 6px rgba(248, 113, 113, 0);
    }
}

/* Fieldset */
.fieldset {
    border: 2px solid var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin: 20px 0;
    background: var(--gray-50);
}

.fieldset legend {
    font-weight: 700;
    color: var(--gray-700);
    padding: 0 10px;
    font-size: 0.9rem;
}

/* Radio & Checkbox */
.option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--white);
    -webkit-tap-highlight-color: transparent;
}

.option:hover {
    border-color: var(--primary);
}

.option input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    -webkit-appearance: none;
    appearance: none;
    border: 2px solid var(--gray-300);
    border-radius: 4px;
    background: var(--white);
    cursor: pointer;
    position: relative;
}

.option input[type="radio"] {
    border-radius: 50%;
}

.option input:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.option input:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.option input[type="radio"]:checked::after {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.option.selected {
    border-color: var(--primary);
    background: rgba(29,185,84,0.08);
}

.option.selected span {
    color: var(--primary);
    font-weight: 600;
}

/* Consent checkbox */
.consent-group {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid var(--gray-100);
}

.consent-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    padding: 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.consent-label:hover {
    border-color: var(--primary);
}

.consent-label.error {
    border-color: var(--red-500);
    background: var(--red-100);
    animation: shake 0.5s ease;
}

.consent-label input[type="checkbox"] {
    width: 22px;
    height: 22px;
    min-width: 22px;
    margin-top: 2px;
    accent-color: var(--primary);
    -webkit-appearance: none;
    appearance: none;
    border: 2px solid var(--gray-300);
    border-radius: 6px;
    background: var(--white);
    cursor: pointer;
    position: relative;
}

.consent-label input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.consent-label input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.consent-label span {
    font-weight: 500;
    color: var(--gray-700);
    line-height: 1.4;
}

.consent-text {
    margin-top: 12px;
    padding-left: 34px;
    font-size: 0.813rem;
    color: var(--gray-500);
    line-height: 1.5;
}

/* File Upload */
.file-upload {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.file-upload:hover {
    border-color: var(--primary);
    background: rgba(29,185,84,0.02);
}

.file-upload input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    -webkit-appearance: none;
}

.file-upload .icon { color: var(--gray-400); }
.file-upload .text { color: var(--gray-500); word-break: break-all; }

.file-upload.has-file {
    border-color: var(--primary);
    background: rgba(29,185,84,0.08);
    border-style: solid;
}

.file-upload.has-file .icon,
.file-upload.has-file .text {
    color: var(--primary);
}

/* Person Card (children) */
.person-card {
    background: var(--gray-50);
    border: 2px solid var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 24px;
    margin-bottom: 16px;
}

.person-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--gray-200);
}

/* Conditional Fields */
.conditional {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed var(--gray-200);
    animation: fadeIn 0.3s ease;
    overflow: hidden;
}

/* Alpine collapse transition */
[x-collapse] {
    overflow: hidden;
}

[x-collapse].x-collapse-enter-active,
[x-collapse].x-collapse-leave-active {
    transition: height 0.3s ease, opacity 0.3s ease;
}

/* User Badge */
.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,0.15);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 50px;
}

.user-badge img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
}

.user-badge span {
    color: var(--white);
    font-weight: 500;
}

/* Landing */
.landing {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    padding-top: calc(40px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
}

.logo {
    margin-bottom: 24px;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.logo svg {
    width: 180px;
    height: auto;
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.2));
}

.brand {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--white);
    letter-spacing: 3px;
    margin-bottom: 48px;
    text-shadow: 0 4px 20px rgba(0,0,0,0.2);
    -webkit-font-smoothing: antialiased;
}

.brand span { color: var(--accent); }

/* Animation */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
    -webkit-transform: translateZ(0);
    will-change: transform;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

.spinner.small {
    width: 14px;
    height: 14px;
    border-width: 2px;
}

/* Success */
.success-icon {
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.2);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    margin-bottom: 32px;
}

/* Transitions */
[x-transition] {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Safari-specific */
@supports (-webkit-touch-callout: none) {
    body {
        -webkit-overflow-scrolling: touch;
    }

    .input, .textarea, .select {
        font-size: 16px;
    }

    input[type="date"] {
        min-height: 48px;
    }
}

/* Responsive */
@media (max-width: 640px) {
    .card { padding: 24px 20px; }
    .brand { font-size: 2.5rem; }
    h1 { font-size: 1.75rem; }
    .option-group { flex-direction: column; }
    .option { width: 100%; }
    .logo svg { width: 140px; }

    .input, .textarea, .select {
        font-size: 16px;
    }
}

/* Print styles */
@media print {
    .gradient-bg {
        background: white;
    }
    .btn, .nav-buttons {
        display: none;
    }
}

/* Language Switcher */
.lang-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 100;
}

.lang-btn {
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255,255,255,0.15);
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.lang-btn:hover {
    background: rgba(255,255,255,0.25);
}

.lang-btn.active {
    background: white;
    color: var(--primary);
}

@media (max-width: 640px) {
    .lang-switcher { top: 10px; right: 10px; }
    .lang-btn { padding: 6px 12px; font-size: 0.75rem; }
}