:root {
    --bg-primary: #f5ebe0;
    --bg-secondary: #e3d5ca;
    --accent-warm: #d4a574;
    --accent-soft: #c9ada7;
    --accent-nature: #9caf88;
    --text-primary: #4a4238;
    --text-secondary: #6b5d54;
    --shadow: rgba(212, 165, 116, 0.3);
    --cream: #faf8f5;
    --warm-white: #fff8f0;
}

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

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(160deg, #faf8f5 0%, #f5ebe0 40%, #e8d5c4 100%);
    color: var(--text-primary);
    min-height: 100vh;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow: hidden;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 30%, rgba(201, 173, 167, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 70%, rgba(156, 175, 136, 0.12) 0%, transparent 50%),
                radial-gradient(circle at 50% 50%, rgba(212, 165, 116, 0.08) 0%, transparent 60%);
    animation: bgShift 25s ease-in-out infinite;
    pointer-events: none;
}

@keyframes bgShift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(5%, 5%) rotate(5deg); }
}

.container {
    width: 100%;
    max-width: 480px;
    background: linear-gradient(145deg, var(--warm-white) 0%, var(--cream) 100%);
    backdrop-filter: blur(10px);
    border-radius: 32px;
    padding: 2.5rem 2rem;
    box-shadow: 0 8px 32px rgba(74, 66, 56, 0.12),
                0 2px 8px rgba(201, 173, 167, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 2px solid rgba(212, 165, 116, 0.2);
    position: relative;
    animation: fadeInScale 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

.title {
    font-family: 'Lora', serif;
    font-size: 2.2rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-warm) 0%, var(--accent-nature) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    animation: titleGlow 4s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(212, 165, 116, 0.2));
}

@keyframes titleGlow {
    0%, 100% { filter: drop-shadow(0 2px 4px rgba(212, 165, 116, 0.2)); }
    50% { filter: drop-shadow(0 2px 8px rgba(156, 175, 136, 0.3)); }
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 0.5px;
}

.number-display {
    text-align: center;
    font-size: 5rem;
    font-weight: 700;
    background: linear-gradient(160deg, var(--accent-warm) 0%, var(--accent-nature) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 12px var(--shadow);
    margin: 1.5rem 0;
    animation: pulse 3s ease-in-out infinite;
    font-family: 'Montserrat', sans-serif;
    filter: drop-shadow(0 2px 8px rgba(212, 165, 116, 0.3));
}

@keyframes pulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 2px 8px rgba(212, 165, 116, 0.3)); }
    50% { transform: scale(1.02); filter: drop-shadow(0 4px 12px rgba(156, 175, 136, 0.4)); }
}

.form-group {
    margin-bottom: 1.3rem;
    animation: slideIn 0.6s ease-out backwards;
    width: 100%;
    box-sizing: border-box;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }
.form-group:nth-child(5) { animation-delay: 0.5s; }

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-warm);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

input[type="text"],
input[type="date"],
input[type="time"] {
    width: 100%;
    max-width: 100%;
    padding: 0.9rem 1rem;
    background: var(--warm-white);
    border: 2px solid var(--accent-soft);
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(201, 173, 167, 0.15);
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    height: auto;
}

/* Forcer la hauteur et le style sur iOS Safari */
input[type="date"],
input[type="time"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    display: block;
    line-height: normal;
}

/* Désactiver le style natif du calendrier iOS */
input[type="date"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value {
    text-align: left;
    min-height: auto;
}

/* Contrôler les inner elements iOS */
input[type="date"]::-webkit-datetime-edit,
input[type="time"]::-webkit-datetime-edit {
    padding: 0;
    display: inline-block;
}

input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input[type="time"]::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
}

input[type="date"]::-webkit-datetime-edit-text,
input[type="time"]::-webkit-datetime-edit-text {
    padding: 0;
}

input:focus {
    outline: none;
    border-color: var(--accent-warm);
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.15),
                inset 0 2px 4px rgba(201, 173, 167, 0.15);
    background: #ffffff;
}

input::placeholder {
    color: rgba(107, 93, 84, 0.4);
}

.optional-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 300;
    margin-left: 0.5rem;
    text-transform: none;
}

.datetime-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
}

.datetime-group .form-group {
    min-width: 0;
}

button {
    width: 100%;
    padding: 1.1rem;
    background: linear-gradient(135deg, var(--accent-warm) 0%, var(--accent-nature) 100%);
    border: none;
    border-radius: 18px;
    color: var(--warm-white);
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(212, 165, 116, 0.3),
                0 2px 4px rgba(156, 175, 136, 0.2);
    margin-top: 1rem;
    animation: slideIn 0.6s ease-out 0.6s backwards;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 165, 116, 0.4),
                0 3px 8px rgba(156, 175, 136, 0.3);
    filter: brightness(1.05);
}

button:active {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.success-message {
    display: none;
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(156, 175, 136, 0.15) 0%, rgba(156, 175, 136, 0.25) 100%);
    border: 2px solid var(--accent-nature);
    border-radius: 20px;
    color: #5a7a4d;
    margin-top: 1.5rem;
    animation: fadeInScale 0.5s ease;
    box-shadow: 0 4px 12px rgba(156, 175, 136, 0.2);
}

.success-message.show {
    display: block;
}

.error-message {
    display: none;
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(211, 136, 125, 0.15) 0%, rgba(211, 136, 125, 0.25) 100%);
    border: 2px solid #d3887d;
    border-radius: 20px;
    color: #a65d52;
    margin-top: 1.5rem;
    animation: fadeInScale 0.5s ease;
    box-shadow: 0 4px 12px rgba(211, 136, 125, 0.2);
}

.error-message.show {
    display: block;
}

.decorative-corner {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 2px solid var(--accent-warm);
    opacity: 0.25;
    border-radius: 8px;
}

.decorative-corner.top-left {
    top: 15px;
    left: 15px;
    border-right: none;
    border-bottom: none;
}

.decorative-corner.bottom-right {
    bottom: 15px;
    right: 15px;
    border-left: none;
    border-top: none;
}

@media (max-width: 768px) {
    body {
        padding: 0.75rem !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: hidden !important;
        height: 100vh !important;
    }

    .container {
        padding: 1.25rem 0.875rem !important;
        border-radius: 20px;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        margin: 0 auto;
    }

    .header {
        margin-bottom: 0.875rem;
    }

    .title {
        font-size: 1.5rem !important;
        margin-bottom: 0.25rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .number-display {
        font-size: 3rem !important;
        margin: 0.75rem 0 !important;
    }

    .form-group {
        margin-bottom: 0.875rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    label {
        font-size: 0.7rem !important;
        margin-bottom: 0.35rem;
    }

    input[type="text"],
    input[type="date"],
    input[type="time"] {
        padding: 0.625rem 0.5rem !important;
        font-size: 0.875rem !important;
        border-radius: 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        max-width: 100% !important;
        border-width: 1.5px !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
        height: auto !important;
        min-height: 2.5rem !important;
        line-height: 1.2 !important;
    }

    /* Forcer le style compact sur iOS */
    input[type="date"],
    input[type="time"] {
        padding: 0.5rem 0.4rem !important;
        min-height: 2.5rem !important;
        height: 2.5rem !important;
    }

    input[type="date"]::-webkit-date-and-time-value,
    input[type="time"]::-webkit-date-and-time-value {
        text-align: left;
        min-height: auto !important;
        height: auto !important;
    }

    input[type="date"]::-webkit-datetime-edit,
    input[type="time"]::-webkit-datetime-edit {
        padding: 0 !important;
        margin: 0 !important;
        display: inline-block;
        min-height: auto !important;
    }

    input[type="date"]::-webkit-datetime-edit-fields-wrapper,
    input[type="time"]::-webkit-datetime-edit-fields-wrapper {
        padding: 0 !important;
        margin: 0 !important;
    }

    input[type="date"]::-webkit-datetime-edit-text,
    input[type="time"]::-webkit-datetime-edit-text {
        padding: 0 2px !important;
    }

    input[type="date"]::-webkit-datetime-edit-year-field,
    input[type="date"]::-webkit-datetime-edit-month-field,
    input[type="date"]::-webkit-datetime-edit-day-field,
    input[type="time"]::-webkit-datetime-edit-hour-field,
    input[type="time"]::-webkit-datetime-edit-minute-field {
        padding: 0 !important;
    }

    .datetime-group {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.875rem !important;
        width: 100% !important;
        grid-template-columns: none !important;
    }

    .datetime-group .form-group {
        width: 100% !important;
        margin-bottom: 0 !important;
    }

    button {
        padding: 0.875rem !important;
        font-size: 0.95rem !important;
        letter-spacing: 0.75px;
        border-radius: 12px;
        margin-top: 0.5rem;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .success-message,
    .error-message {
        padding: 0.875rem !important;
        font-size: 0.85rem;
        margin-top: 0.875rem;
    }

    .decorative-corner {
        width: 35px;
        height: 35px;
    }

    .decorative-corner.top-left {
        top: 8px;
        left: 8px;
    }

    .decorative-corner.bottom-right {
        bottom: 8px;
        right: 8px;
    }
}

@media (max-width: 400px) {
    body {
        padding: 0.5rem !important;
        overflow: hidden !important;
    }

    .container {
        padding: 1rem 0.75rem !important;
    }

    .title {
        font-size: 1.35rem !important;
    }

    .number-display {
        font-size: 2.75rem !important;
    }

    input[type="text"],
    input[type="date"],
    input[type="time"] {
        padding: 0.45rem 0.35rem !important;
        font-size: 0.8rem !important;
        min-height: 2.25rem !important;
    }

    input[type="date"],
    input[type="time"] {
        height: 2.25rem !important;
    }

    button {
        padding: 0.75rem !important;
        font-size: 0.9rem !important;
    }
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: opacity(0.6) sepia(0.3);
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
    filter: opacity(0.8) sepia(0.5);
}
