/* ==========================================================================
   FORMULAIRES - MEDAL OF HONOR V2
   ========================================================================== */

/* Styles de base pour les formulaires */
form {
    margin-bottom: var(--moh-space-lg);
}

fieldset {
    border: 1px solid var(--moh-glass-border);
    border-radius: var(--moh-radius-md);
    padding: var(--moh-space-lg);
    margin-bottom: var(--moh-space-lg);
    background: var(--moh-glass-bg);
    backdrop-filter: var(--moh-glass-backdrop);
}

legend {
    font-weight: 600;
    color: var(--moh-text-secondary);
    font-family: var(--moh-font-heading);
    padding: 0 var(--moh-space-md);
    font-size: var(--moh-text-lg);
}

/* Labels */
label {
    display: block;
    margin-bottom: var(--moh-space-xs);
    font-weight: 500;
    color: var(--moh-text-secondary);
    font-size: var(--moh-text-sm);
}

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

/* Groupes de champs */
.form-group {
    margin-bottom: var(--moh-space-lg);
}

.form-row {
    display: flex;
    gap: var(--moh-space-md);
    margin-bottom: var(--moh-space-lg);
    /* Mobile-first: colonnes empilées */
    flex-direction: column;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-row-half {
    flex: 0 0 48%;
}

.form-row-third {
    flex: 0 0 31%;
}

.form-row-quarter {
    flex: 0 0 23%;
}

/* Champs de saisie */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: var(--moh-space-md);
    border: 2px solid var(--moh-glass-border);
    border-radius: var(--moh-radius-md);
    font-size: var(--moh-text-base);
    font-family: inherit;
    background: var(--moh-bg-primary);
    color: var(--moh-text-primary);
    transition: all var(--moh-transition-fast);
    backdrop-filter: blur(5px);
    min-height: 44px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--moh-accent-primary);
    box-shadow: 0 0 0 3px rgba(243, 185, 190, 0.2);
    background: white;
}

/* Textarea spécifique */
textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

/* ----------------------------------------------------------
   Compatibilité des classes "mof-" (auth) avec site global
   ---------------------------------------------------------- */
.mof-form-row {
    display: flex;
    flex-direction: column;
    gap: var(--moh-space-md);
    margin-bottom: var(--moh-space-lg);
}

.mof-form-group { margin-bottom: var(--moh-space-lg); }

.mof-form-label {
    display: block;
    margin-bottom: var(--moh-space-xs);
    font-weight: 500;
    color: var(--moh-text-secondary);
    font-size: var(--moh-text-sm);
}

.mof-form-input {
    width: 100%;
    padding: var(--moh-space-md);
    border: 2px solid var(--moh-glass-border);
    border-radius: var(--moh-radius-md);
    font-size: var(--moh-text-base);
    font-family: inherit;
    background: var(--moh-bg-primary);
    color: var(--moh-text-primary);
    transition: all var(--moh-transition-fast);
    backdrop-filter: blur(5px);
    min-height: 44px;
}

.mof-form-input:focus {
    outline: none;
    border-color: var(--moh-accent-primary);
    box-shadow: 0 0 0 3px rgba(243, 185, 190, 0.2);
    background: white;
}

.mof-password-input {
    position: relative;
    display: flex;
    align-items: center;
}

.mof-password-input .mof-form-input { padding-right: calc(var(--moh-space-xl) + 8px); }

.mof-password-toggle {
    position: absolute;
    right: var(--moh-space-sm);
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: var(--moh-text-secondary);
    cursor: pointer;
    padding: var(--moh-space-xs);
    border-radius: var(--moh-radius-sm);
}

.mof-password-strength { margin-top: var(--moh-space-xs); font-size: var(--moh-text-sm); opacity: .85; }
.mof-form-help { font-size: var(--moh-text-sm); opacity: .75; display: block; margin-top: var(--moh-space-xs); }

.mof-form-check .mof-checkbox-label { display: inline-flex; align-items: center; gap: var(--moh-space-sm); cursor: pointer; }
.mof-checkbox { width: 18px; height: 18px; accent-color: var(--moh-accent-primary); }

.mof-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--moh-space-sm);
    padding: clamp(0.75rem, 1.2vw, 1rem) clamp(1rem, 2vw, 1.25rem);
    border-radius: var(--moh-radius-md);
    border: 2px solid transparent;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    min-height: 44px;
    transition: all var(--moh-transition-normal);
}

.mof-btn-primary {
    background: linear-gradient(135deg, var(--moh-accent-primary), #e6c878);
    color: #3b2e12;
    border-color: var(--moh-accent-primary);
}

.mof-btn-primary:hover { transform: translateY(-1px); box-shadow: var(--moh-shadow-md); color: #fff; }
.mof-btn-block { width: 100%; }
.mof-link { color: var(--moh-accent-primary); text-decoration: underline; text-underline-offset: 3px; }

/* Deux états uniques: <=1024 (mobile), >=1025 (desktop) */
@media (min-width: 1025px) {
    .form-row { flex-direction: row; }
    .form-row .form-group { flex: 1; }
    .mof-form-row { flex-direction: row; }
    .mof-form-row .mof-form-group { flex: 1; }
}

/* Select */
select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right var(--moh-space-sm) center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: var(--moh-space-xl);
    appearance: none;
}

/* Checkboxes et radios personnalisées */
.checkbox-group,
.radio-group {
    display: flex;
    flex-direction: column;
    gap: var(--moh-space-sm);
}

.checkbox-item,
.radio-item {
    display: flex;
    align-items: center;
    gap: var(--moh-space-sm);
    cursor: pointer;
    padding: var(--moh-space-sm);
    border-radius: var(--moh-radius-sm);
    transition: background-color var(--moh-transition-fast);
}

.checkbox-item:hover,
.radio-item:hover {
    background: var(--moh-glass-bg);
}

/* Checkbox personnalisée */
.custom-checkbox {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.custom-checkbox input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.custom-checkbox .checkmark {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--moh-bg-primary);
    border: 2px solid var(--moh-glass-border);
    border-radius: var(--moh-radius-sm);
    transition: all var(--moh-transition-fast);
}

.custom-checkbox input[type="checkbox"]:checked + .checkmark {
    background: var(--moh-accent-primary);
    border-color: var(--moh-accent-primary);
}

.custom-checkbox .checkmark::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 6px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity var(--moh-transition-fast);
}

.custom-checkbox input[type="checkbox"]:checked + .checkmark::after {
    opacity: 1;
}

/* Radio personnalisé */
.custom-radio {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.custom-radio input[type="radio"] {
    opacity: 0;
    position: absolute;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.custom-radio .radiomark {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--moh-bg-primary);
    border: 2px solid var(--moh-glass-border);
    border-radius: 50%;
    transition: all var(--moh-transition-fast);
}

.custom-radio input[type="radio"]:checked + .radiomark {
    background: var(--moh-accent-primary);
    border-color: var(--moh-accent-primary);
}

.custom-radio .radiomark::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: white;
    transform: translate(-50%, -50%) scale(0);
    transition: transform var(--moh-transition-fast);
}

.custom-radio input[type="radio"]:checked + .radiomark::after {
    transform: translate(-50%, -50%) scale(1);
}

/* États de validation */
.form-group.has-error input,
.form-group.has-error textarea,
.form-group.has-error select {
    border-color: var(--moh-error);
    background-color: rgba(216, 140, 154, 0.05);
}

.form-group.has-error input:focus,
.form-group.has-error textarea:focus,
.form-group.has-error select:focus {
    box-shadow: 0 0 0 3px rgba(216, 140, 154, 0.2);
}

.form-group.has-success input,
.form-group.has-success textarea,
.form-group.has-success select {
    border-color: var(--moh-success);
    background-color: rgba(127, 176, 105, 0.05);
}

.form-group.has-success input:focus,
.form-group.has-success textarea:focus,
.form-group.has-success select:focus {
    box-shadow: 0 0 0 3px rgba(127, 176, 105, 0.2);
}

/* Messages d'aide et d'erreur */
.help-text,
.error-message,
.success-message {
    font-size: var(--moh-text-sm);
    margin-top: var(--moh-space-xs);
    display: block;
}

.help-text {
    color: var(--moh-text-primary);
    opacity: 0.7;
}

.error-message {
    color: var(--moh-error);
    font-weight: 500;
}

.success-message {
    color: var(--moh-success);
    font-weight: 500;
}

/* Upload de fichiers */
.file-upload-area {
    border: 2px dashed var(--moh-glass-border);
    border-radius: var(--moh-radius-md);
    padding: var(--moh-space-xl);
    text-align: center;
    background: var(--moh-glass-bg);
    transition: all var(--moh-transition-normal);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: var(--moh-accent-primary);
    background: rgba(243, 185, 190, 0.1);
}

.file-upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-upload-content {
    pointer-events: none;
}

.file-upload-icon {
    font-size: var(--moh-text-4xl);
    color: var(--moh-accent-primary);
    margin-bottom: var(--moh-space-md);
}

.file-upload-text {
    color: var(--moh-text-primary);
    margin-bottom: var(--moh-space-sm);
}

.file-upload-hint {
    color: var(--moh-text-primary);
    opacity: 0.6;
    font-size: var(--moh-text-sm);
}

/* Aperçu des fichiers uploadés */
.uploaded-files {
    margin-top: var(--moh-space-md);
    display: grid;
    gap: var(--moh-space-sm);
}

.uploaded-file {
    display: flex;
    align-items: center;
    gap: var(--moh-space-sm);
    padding: var(--moh-space-sm);
    background: var(--moh-glass-bg);
    border-radius: var(--moh-radius-sm);
    border: 1px solid var(--moh-glass-border);
}

.uploaded-file-icon {
    color: var(--moh-success);
}

.uploaded-file-name {
    flex: 1;
    font-size: var(--moh-text-sm);
    color: var(--moh-text-primary);
}

.uploaded-file-size {
    font-size: var(--moh-text-xs);
    color: var(--moh-text-primary);
    opacity: 0.6;
}

.uploaded-file-remove {
    background: none;
    border: none;
    color: var(--moh-error);
    cursor: pointer;
    padding: var(--moh-space-xs);
    border-radius: var(--moh-radius-sm);
    transition: background-color var(--moh-transition-fast);
}

.uploaded-file-remove:hover {
    background: rgba(216, 140, 154, 0.1);
}

/* Recherche avec suggestions */
.search-container {
    position: relative;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--moh-bg-primary);
    border: 1px solid var(--moh-glass-border);
    border-top: none;
    border-radius: 0 0 var(--moh-radius-sm) var(--moh-radius-sm);
    box-shadow: var(--moh-shadow-md);
    max-height: 200px;
    overflow-y: auto;
}

.search-suggestion {
    padding: var(--moh-space-sm) var(--moh-space-md);
    cursor: pointer;
    transition: background-color var(--moh-transition-fast);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.search-suggestion:hover,
.search-suggestion.highlighted {
    background: var(--moh-glass-bg);
}

.search-suggestion:last-child {
    border-bottom: none;
}

/* Formulaires inline */
.form-inline {
    display: flex;
    gap: var(--moh-space-sm);
    align-items: end;
    flex-wrap: wrap;
}

.form-inline .form-group {
    margin-bottom: 0;
}

.form-inline .btn {
    white-space: nowrap;
}

/* Loading state sur les boutons */
.btn.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Barre de progression */
.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin: var(--moh-space-sm) 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--moh-accent-primary), #ff8fa3);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
    
    .form-row-half,
    .form-row-third,
    .form-row-quarter {
        flex: none;
    }
    
    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-inline .form-group {
        margin-bottom: var(--moh-space-md);
    }
    
    .form-inline .btn {
        width: 100%;
    }
}

/* Formulaires de commentaires/témoignages */
.testimony-form {
    background: var(--moh-glass-bg);
    padding: var(--moh-space-xl);
    border-radius: var(--moh-radius-lg);
    backdrop-filter: var(--moh-glass-backdrop);
    border: 1px solid var(--moh-glass-border);
    margin: var(--moh-space-xl) 0;
}

.testimony-form h3 {
    color: var(--moh-text-secondary);
    font-family: var(--moh-font-heading);
    margin-bottom: var(--moh-space-lg);
    text-align: center;
}

.testimony-form .form-row {
    margin-bottom: var(--moh-space-lg);
}

.testimony-form textarea {
    min-height: 150px;
}

.testimony-form .form-actions {
    display: flex;
    justify-content: center;
    gap: var(--moh-space-md);
    margin-top: var(--moh-space-xl);
}

/* Ratings/Étoiles */
.rating-group {
    display: flex;
    align-items: center;
    gap: var(--moh-space-sm);
}

.rating-stars {
    display: flex;
    gap: var(--moh-space-xs);
}

.rating-star {
    font-size: var(--moh-text-xl);
    color: #ddd;
    cursor: pointer;
    transition: color var(--moh-transition-fast);
}

.rating-star.active,
.rating-star:hover {
    color: #ffc107;
}

/* Switch/Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.switch input:checked + .slider {
    background-color: var(--moh-accent-primary);
}

.switch input:checked + .slider:before {
    transform: translateX(26px);
}

