/* ============================================
   forms.css
   FORMULAIRES & INPUTS - DESIGN MODERNISÉ
   ============================================ */

/* --- FORM STRUCTURE --- */
.form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* --- FORM GROUPS --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group--inline {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
}

/* --- LABELS --- */
.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    user-select: none;
    letter-spacing: 0.01em;
    transition: color 0.2s;
}

.form-group:focus-within .form-label {
    color: var(--accent-light);
}

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

/* --- INPUTS --- */
.input {
    width: 100%;
    padding: 0.9rem 1rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.input::placeholder {
    color: var(--text-tertiary);
    opacity: 0.7;
}

.input:hover {
    border-color: rgba(148, 163, 184, 0.25);
    background: rgba(30, 41, 59, 0.7);
}

.input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 
        0 0 0 3px rgba(59, 130, 246, 0.1),
        0 0 20px -5px rgba(59, 130, 246, 0.2);
}

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

/* Input avec erreur */
.input--error {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.05);
}

.input--error:focus {
    box-shadow: 
        0 0 0 3px rgba(239, 68, 68, 0.1),
        0 0 20px -5px rgba(239, 68, 68, 0.2);
}

/* --- PASSWORD WRAPPER --- */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .input {
    padding-right: 3.25rem;
}

.input-action {
    position: absolute;
    right: 0.5rem;
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 6px;
}

.input-action:hover {
    color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.1);
}

.input-action:active {
    transform: scale(0.95);
}

.input-action svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* --- CHECKBOX --- */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: rgba(30, 41, 59, 0.5);
    border: 1.5px solid rgba(148, 163, 184, 0.2);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
}

.checkbox:hover {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.1);
}

.checkbox:checked {
    background: linear-gradient(135deg, var(--accent-primary), #6366f1);
    border-color: transparent;
    animation: checkboxPop 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes checkboxPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.checkbox:checked::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    animation: checkmark 0.2s ease-out;
}

@keyframes checkmark {
    from {
        opacity: 0;
        transform: rotate(45deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(45deg) scale(1);
    }
}

.checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.checkbox-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    user-select: none;
    cursor: pointer;
    transition: color 0.2s;
}

.checkbox-wrapper:hover .checkbox-label {
    color: var(--text-primary);
}

/* --- ERROR MESSAGES --- */
.form-error {
    display: none;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-left: 3px solid var(--error);
    border-radius: var(--radius-sm);
    color: #fca5a5;
    font-size: 0.875rem;
    font-weight: 500;
    animation: errorAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.form-error:not(:empty) {
    display: block;
}

@keyframes errorAppear {
    0% { 
        opacity: 0;
        transform: translateY(-10px);
    }
    100% { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- SUCCESS MESSAGES --- */
.form-success {
    display: none;
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-left: 3px solid var(--success);
    border-radius: var(--radius-sm);
    color: #6ee7b7;
    font-size: 0.875rem;
    font-weight: 500;
    animation: errorAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.form-success:not(:empty) {
    display: block;
}

/* --- LINKS --- */
.form-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.form-link:hover {
    color: var(--accent-light);
}

/* --- SEPARATOR --- */
.form-separator {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-tertiary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-separator::before,
.form-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

/* --- TEXTAREA --- */
.textarea {
    width: 100%;
    min-height: 120px;
    padding: 0.9rem 1rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 
        0 0 0 3px rgba(59, 130, 246, 0.1),
        0 0 20px -5px rgba(59, 130, 246, 0.2);
}

/* --- SELECT (natif stylisé) --- */
.select {
    width: 100%;
    padding: 0.9rem 2.5rem 0.9rem 1rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.select:hover {
    border-color: rgba(148, 163, 184, 0.25);
    background-color: rgba(30, 41, 59, 0.7);
}

.select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 
        0 0 0 3px rgba(59, 130, 246, 0.1),
        0 0 20px -5px rgba(59, 130, 246, 0.2);
}

/* Animation réduite si préférence utilisateur */
@media (prefers-reduced-motion: reduce) {
    .form-error,
    .form-success,
    .checkbox:checked,
    .checkbox:checked::after {
        animation: none;
    }
}