/* AvisLab - Styles Liquid Glass */

:root {
    /* Couleurs principales */
    --primary: #7C3AED;
    --primary-light: #A855F7;
    --primary-dark: #6B21A8;
    --secondary: #10B981;
    --secondary-light: #34D399;
    --accent: #F59E0B;

    /* Couleurs de fond */
    --dark: #000000;
    --dark-light: #0A0A0F;
    --dark-medium: #1C1C1E;

    /* Glass effects */
    --glass: rgba(124, 58, 237, 0.08);
    --glass-border: rgba(124, 58, 237, 0.12);
    --glass-strong: rgba(124, 58, 237, 0.15);

    /* Texte */
    --text: #FFFFFF;
    --text-muted: #8E8E93;
    --text-light: #F2F2F7;

    /* États */
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--dark);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background animé */
.bg-container {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse 90% 60% at 20% -10%, rgba(124, 58, 237, 0.25), transparent 50%),
        radial-gradient(ellipse 70% 90% at 80% 110%, rgba(16, 185, 129, 0.2), transparent 60%),
        radial-gradient(ellipse 60% 80% at 50% 50%, rgba(245, 158, 11, 0.12), transparent 70%),
        linear-gradient(135deg, var(--dark), var(--dark-light) 30%, var(--dark-medium) 70%, var(--dark-light));
}

.bg-container::before,
.bg-container::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.2;
    animation: float 30s ease-in-out infinite;
}

.bg-container::before {
    background: radial-gradient(circle, var(--primary), transparent);
    top: -200px;
    left: -200px;
}

.bg-container::after {
    background: radial-gradient(circle, var(--secondary), transparent);
    bottom: -200px;
    right: -200px;
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(30px, 30px);
    }
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 32px;
    animation: slideDown 0.6s ease-out;
}

.header-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    box-shadow: 0 10px 40px rgba(124, 58, 237, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

/* Form */
#vouchForm {
    animation: slideUp 0.6s ease-out 0.2s both;
}

/* Grid 2 colonnes pour le formulaire (desktop) */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 20px;
}

.form-column {
    display: flex;
    flex-direction: column;
}

/* Responsive : passer à 1 colonne sur mobile/tablette */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
}

.form-group label i {
    color: var(--primary-light);
}

/* Inputs */
input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 14px 16px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: var(--text);
    font-size: 15px;
    transition: none; /* Désactivé pour éviter conflits Telegram WebApp */
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    touch-action: manipulation; /* Force interaction native */
}

input[type="text"]:focus,
input[type="number"]:focus {
    background: var(--glass-strong);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* Focus select sans transition pour éviter conflits mobile */
select:focus {
    background: var(--glass-strong);
    border-color: var(--primary);
    /* Pas de transition ni box-shadow pour éviter les bugs mobile */
}

input::placeholder {
    color: var(--text-muted);
}

select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238E8E93' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

select option {
    background: var(--dark-medium);
    color: var(--text);
}

/* Textarea */
textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: all 0.3s ease;
    outline: none;
}

textarea:focus {
    background: var(--glass-strong);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

textarea::placeholder {
    color: var(--text-muted);
}

/* Label facultatif */
.optional {
    font-size: 0.85em;
    color: var(--secondary);
    font-weight: normal;
}

/* Badge requis pour champs conditionnels */
.required-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 4px 10px;
    background: linear-gradient(135deg, var(--warning), #F97316);
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    color: #000;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    animation: pulse-badge 2s ease-in-out infinite;
}

.required-badge i {
    margin-right: 4px;
    font-size: 0.9em;
}

@keyframes pulse-badge {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    }
    50% {
        box-shadow: 0 2px 12px rgba(245, 158, 11, 0.5);
    }
}

/* Compteur de caractères */
.char-counter {
    display: block;
    text-align: right;
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 6px;
    transition: color 0.3s ease;
}

/* Hint pour champs conditionnels */
.field-hint {
    display: block;
    font-size: 0.85em;
    color: var(--secondary);
    margin-top: 6px;
    font-style: italic;
}

/* Animation d'apparition pour le champ Boxer */
#boxerGroup {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-bottom: 0;
}

#boxerGroup.visible {
    max-height: 200px;
    opacity: 1;
    margin-bottom: 20px;
}

/* Input with suffix */
.input-with-suffix {
    position: relative;
}

.input-with-suffix input {
    padding-right: 40px;
}

.suffix {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-weight: 600;
}

/* Dual input (nombre + select côte à côte) */
.dual-input {
    display: flex;
    gap: 12px;
}

.dual-input input[type="number"] {
    flex: 1;
    min-width: 0;
}

.dual-input select {
    flex: 1.5;
    min-width: 0;
}

/* Responsive pour mobile */
@media (max-width: 480px) {
    .dual-input {
        flex-direction: column;
        gap: 8px;
    }

    .dual-input input[type="number"],
    .dual-input select {
        width: 100%;
    }
}

/* Toggle buttons */
.toggle-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.toggle-btn {
    padding: 14px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.toggle-btn:hover {
    background: var(--glass-strong);
    transform: translateY(-2px);
}

.toggle-btn.active {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
    border-color: var(--secondary);
    color: #000;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

/* Upload area */
.upload-area {
    position: relative;
    min-height: 200px;
    background: var(--glass);
    border: 2px dashed var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--glass-strong);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 200px;
}

.upload-placeholder i {
    font-size: 48px;
    color: var(--primary-light);
    margin-bottom: 16px;
}

.upload-placeholder p {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 13px;
    color: var(--text-muted);
}

.upload-preview {
    position: relative;
    width: 100%;
    min-height: 200px;
}

.upload-preview img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 18px;
}

.remove-image {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.remove-image:hover {
    background: var(--error);
    transform: scale(1.1);
}

/* Info box */
.info-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 13px;
    color: var(--accent);
}

.info-box i {
    font-size: 16px;
}

/* Submit button */
.submit-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: none;
    border-radius: 16px;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(124, 58, 237, 0.5);
}

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

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

/* Loader */
.loader {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--glass);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader p {
    margin-top: 20px;
    font-size: 16px;
    color: var(--text);
}

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

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Responsive */
@media (max-width: 400px) {
    .container {
        padding: 16px;
    }

    .header h1 {
        font-size: 24px;
    }

    .header-icon {
        width: 64px;
        height: 64px;
        font-size: 28px;
    }

    input[type="text"],
    input[type="number"],
    select,
    .toggle-btn {
        padding: 12px;
        font-size: 14px;
    }

    /* Augmenter zone de tap pour select sur petits écrans */
    select {
        min-height: 52px;
        padding: 16px 40px 16px 12px;
    }

    .submit-btn {
        padding: 14px;
        font-size: 15px;
    }
}

