/* ========================================
   CareFamily Web App Styles
   Color Palette: Neo Mint + Terracotta + Dusty Rose + Chocolate
   Inspired by DeliDev Team Design
   ======================================== */

/* === CSS VARIABLES === */
:root {
    /* Base colors - Warm chocolate/coffee tones */
    --bg-dark: #1a120d;
    --bg-card: #241a14;
    --bg-card-alt: #2e221a;
    
    /* Text colors */
    --text-primary: #f5f0eb;
    --text-secondary: #c4b5a8;
    --text-muted: #8a7968;
    
    /* Accent colors - Neo Mint / Synthesized Mint */
    --mint-deep: #4a9a7c;
    --mint-main: #6ec9a5;
    --mint-light: #8fd9ba;
    --mint-soft: #a8e6c9;
    --mint-pale: #c8f0dc;
    
    /* Accent colors - Terracotta */
    --terra-deep: #a84b35;
    --terra-main: #c66b4e;
    --terra-bright: #d97b5c;
    --terra-light: #e89778;
    
    /* Accent colors - Dusty Rose */
    --rose-deep: #a87878;
    --rose-main: #c9a5a5;
    --rose-light: #d4b8b8;
    --rose-soft: #e2cdcd;
    
    /* Accent colors - Chocolate */
    --choco-deep: #2e1e10;
    --choco-main: #3c2415;
    --choco-light: #5a3a24;
    --choco-warm: #7a5038;
    
    /* Gradients */
    --gradient-mint: linear-gradient(135deg, var(--mint-main), var(--mint-light));
    --gradient-terra: linear-gradient(135deg, var(--terra-main), var(--terra-bright));
    --gradient-rose: linear-gradient(135deg, var(--rose-deep), var(--rose-main));
    --gradient-hero: linear-gradient(135deg, var(--mint-main), var(--terra-bright));
    --gradient-warm: linear-gradient(135deg, var(--terra-main), var(--rose-main));
    
    /* Glows */
    --glow-mint: rgba(110, 201, 165, 0.4);
    --glow-terra: rgba(198, 107, 78, 0.4);
    --glow-rose: rgba(201, 165, 165, 0.35);
    
    /* Borders */
    --border: rgba(200, 181, 168, 0.12);
    --border-hover: rgba(110, 201, 165, 0.3);
    
    /* Telegram theme fallbacks */
    --tg-theme-bg-color: var(--bg-dark);
    --tg-theme-text-color: var(--text-primary);
    --tg-theme-hint-color: var(--text-muted);
    --tg-theme-button-color: var(--mint-main);
    --tg-theme-button-text-color: #1a1a1a;
    --tg-theme-secondary-bg-color: var(--bg-card);
}

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    padding-bottom: 100px;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Unbounded', sans-serif;
    font-weight: 600;
}

/* === MATERIAL ICONS === */
.material-icons-outlined {
    font-size: inherit;
    vertical-align: middle;
    line-height: 1;
}

/* === ANIMATED BACKGROUND === */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse 80% 60% at 10% 5%, rgba(110, 201, 165, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 50% at 90% 20%, rgba(198, 107, 78, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse 50% 40% at 50% 90%, rgba(201, 165, 165, 0.1) 0%, transparent 50%),
        var(--bg-dark);
    z-index: -1;
    pointer-events: none;
}

.floating-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.25;
    animation: float 25s ease-in-out infinite;
    z-index: -1;
    pointer-events: none;
}

.orb-1 {
    width: 300px;
    height: 300px;
    background: var(--mint-main);
    top: -100px;
    left: -80px;
    animation-delay: 0s;
}

.orb-2 {
    width: 250px;
    height: 250px;
    background: var(--terra-main);
    top: 40%;
    right: -80px;
    animation-delay: -8s;
}

.orb-3 {
    width: 200px;
    height: 200px;
    background: var(--rose-main);
    bottom: 10%;
    left: 20%;
    animation-delay: -16s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(30px, 30px) rotate(5deg); }
    50% { transform: translate(-20px, 50px) rotate(-5deg); }
    75% { transform: translate(40px, -20px) rotate(3deg); }
}

/* === MAIN CONTAINER === */
.main-container {
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 16px;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* === HEADER === */
.header {
    text-align: center;
    margin-bottom: 32px;
    padding-top: 8px;
}

.header-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: var(--gradient-mint);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px var(--glow-mint);
    animation: icon-pulse 3s ease-in-out infinite;
}

.header-icon .material-icons-outlined {
    font-size: 40px;
    color: #1a1a1a;
}

@keyframes icon-pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 10px 40px var(--glow-mint);
    }
    50% { 
        transform: scale(1.03);
        box-shadow: 0 15px 50px var(--glow-mint);
    }
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* === FORM SECTIONS === */
.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.form-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-hero);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.form-section:hover {
    border-color: var(--border-hover);
}

.form-section:hover::before {
    opacity: 1;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--mint-light);
    margin-bottom: 20px;
}

.section-title .icon {
    width: 28px;
    height: 28px;
    background: rgba(110, 201, 165, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-title .icon .material-icons-outlined {
    font-size: 16px;
    color: var(--mint-light);
}

/* === FORM GROUPS === */
.form-group {
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group label.required::after {
    content: ' *';
    color: var(--terra-bright);
}

/* === INPUTS === */
input[type="text"],
input[type="date"],
select,
textarea {
    width: 100%;
    max-width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-dark);
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-sizing: border-box;
}

input[type="text"]::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--mint-main);
    box-shadow: 0 0 0 3px var(--glow-mint);
}

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

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238a7968' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 20px;
    padding-right: 50px;
}

.hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hint .material-icons-outlined {
    font-size: 16px;
    color: var(--terra-bright);
}

.section-hint {
    margin-bottom: 16px;
    margin-top: -8px;
}

/* === RADIO GROUP === */
.radio-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.radio-option {
    position: relative;
}

.radio-option input {
    display: none;
}

.radio-option label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 12px;
    border: 2px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
    text-align: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.radio-option label .material-icons-outlined {
    font-size: 20px;
    color: var(--mint-main);
    transition: color 0.3s ease;
}

.radio-option label:hover {
    border-color: var(--border-hover);
    background: rgba(110, 201, 165, 0.05);
}

.radio-option input:checked + label {
    border-color: var(--mint-main);
    background: rgba(110, 201, 165, 0.12);
    color: var(--mint-light);
    box-shadow: 0 4px 15px rgba(110, 201, 165, 0.2);
}

/* === CHECKBOX GROUP (Love Languages) === */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-option {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
}

.checkbox-option:hover {
    border-color: var(--border-hover);
    background: rgba(110, 201, 165, 0.05);
}

.checkbox-option.selected {
    border-color: var(--terra-main);
    background: rgba(198, 107, 78, 0.12);
}

.checkbox-option input {
    display: none;
}

.checkbox-icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border: 2px solid var(--border);
    border-radius: 8px;
    margin-right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 14px;
}

.checkbox-option.selected .checkbox-icon {
    background: var(--gradient-terra);
    border-color: var(--terra-main);
}

.checkbox-icon::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

.checkbox-option.selected .checkbox-icon::after {
    opacity: 1;
    transform: scale(1);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.checkbox-label .label-icon {
    font-size: 22px;
    color: var(--terra-main);
    transition: color 0.3s ease;
}

.checkbox-option.selected .checkbox-label .label-icon {
    color: var(--terra-light);
}

/* === SUBMIT BUTTON === */
.submit-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(to top, var(--bg-dark) 80%, transparent);
    z-index: 100;
}

.submit-btn {
    display: block;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 16px 24px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 14px;
    background: var(--gradient-mint);
    color: #1a1a1a;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 25px var(--glow-mint);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 35px var(--glow-mint);
}

.submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.submit-btn .material-icons-outlined {
    font-size: 22px;
}

/* Loading state */
.submit-btn.loading {
    position: relative;
    color: transparent !important;
}

.submit-btn.loading::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(26, 26, 26, 0.3);
    border-radius: 50%;
    border-top-color: #1a1a1a;
    animation: spin 0.8s linear infinite;
}

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

/* === SUCCESS MESSAGE === */
.success-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.success-icon {
    width: 100px;
    height: 100px;
    background: var(--gradient-mint);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 15px 50px var(--glow-mint);
    animation: successPop 0.5s ease;
}

.success-icon .material-icons-outlined {
    font-size: 50px;
    color: #1a1a1a;
}

@keyframes successPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.success-container h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: slideUp 0.5s ease 0.2s both;
}

.success-container p {
    color: var(--text-secondary);
    text-align: center;
    max-width: 280px;
    animation: slideUp 0.5s ease 0.3s both;
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* === HELPER CLASSES === */
.hidden {
    display: none !important;
}

/* === FADE IN ANIMATIONS === */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

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

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }

/* === RELATIONSHIP TYPE SPECIAL GRID === */
.radio-group.relationships {
    grid-template-columns: repeat(2, 1fr);
}

.radio-group.relationships .radio-option:nth-child(5),
.radio-group.relationships .radio-option:nth-child(6) {
    /* Last two items take half width each */
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--choco-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--choco-warm);
}

/* === RESPONSIVE === */
@media (max-width: 480px) {
    .main-container {
        padding: 16px 12px;
    }
    
    .header-icon {
        width: 70px;
        height: 70px;
        font-size: 35px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .form-section {
        padding: 20px 16px;
        border-radius: 16px;
    }
    
    .radio-group {
        grid-template-columns: 1fr;
    }
    
    .radio-option label {
        justify-content: flex-start;
        padding: 14px 16px;
    }
}

/* === FORCE DARK THEME (override Telegram light theme) === */
/* Принудительно тёмная тема, игнорируем настройки Telegram */

html, body {
    background-color: #1a120d !important;
    color: #f5f0eb !important;
}

/* Переопределяем все Telegram CSS переменные */
:root,
html,
body {
    --tg-theme-bg-color: #1a120d !important;
    --tg-theme-text-color: #f5f0eb !important;
    --tg-theme-hint-color: #8a7968 !important;
    --tg-theme-link-color: #6ec9a5 !important;
    --tg-theme-button-color: #6ec9a5 !important;
    --tg-theme-button-text-color: #1a1a1a !important;
    --tg-theme-secondary-bg-color: #241a14 !important;
    --tg-viewport-height: 100vh;
    --tg-viewport-stable-height: 100vh;
    color-scheme: dark !important;
}

/* === DATE INPUT FIXES === */
input[type="date"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 50px;
    background-color: #1a120d !important;
    color: #f5f0eb !important;
    border: 1px solid rgba(200, 181, 168, 0.12);
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 16px; /* Prevent iOS zoom */
    box-sizing: border-box !important;
    overflow: hidden;
}

/* Date picker icon styling */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
    cursor: pointer;
    padding: 0;
    margin: 0;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* iOS/WebKit specific - date input wrapper */
input[type="date"]::-webkit-datetime-edit {
    color: #f5f0eb;
    padding: 0;
    flex: 1;
    min-width: 0;
}

input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    color: #f5f0eb;
    padding: 0;
    overflow: hidden;
}

input[type="date"]::-webkit-datetime-edit-text {
    color: #8a7968;
    padding: 0 2px;
}

input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field {
    color: #f5f0eb;
    padding: 0;
}

/* Placeholder for empty date */
input[type="date"]:invalid::-webkit-datetime-edit {
    color: #8a7968;
}

/* Inner date input container fix */
input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-clear-button {
    display: none;
}

/* Force dark backgrounds for all inputs */
input,
select,
textarea {
    background-color: #1a120d !important;
    color: #f5f0eb !important;
}

/* Form section background */
.form-section {
    background-color: #241a14 !important;
}

/* Background gradient force */
.bg-gradient {
    background: 
        radial-gradient(ellipse 80% 60% at 10% 5%, rgba(110, 201, 165, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 50% at 90% 20%, rgba(198, 107, 78, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse 50% 40% at 50% 90%, rgba(201, 165, 165, 0.1) 0%, transparent 50%),
        #1a120d !important;
}

/* Success container */
.success-container {
    background-color: #1a120d !important;
}

/* Submit container gradient */
.submit-container {
    background: linear-gradient(to top, #1a120d 80%, transparent) !important;
}

/* === ACCESSIBILITY === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .floating-orb {
        animation: none;
    }
}

/* === FOCUS STYLES === */
:focus-visible {
    outline: 2px solid var(--mint-main);
    outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: var(--mint-main);
    box-shadow: 0 0 0 3px var(--glow-mint);
}

