/**
 * SportMinute Contact - Frontend Styles
 */

/* Variables CSS */
:root {
    --smc-primary: var(--primary, #667eea);
    --smc-primary-dark: var(--primary-ink, #5a6fd8);
    --smc-secondary: var(--info, #764ba2);
    --smc-success: var(--success, #2ecc71);
    --smc-error: var(--danger, #e74c3c);
    --smc-warning: var(--warning, #f39c12);
    --smc-text: var(--ink, #2c3e50);
    --smc-text-light: var(--muted, #7f8c8d);
    --smc-border: var(--border, #e1e8ed);
    --smc-bg: var(--card, #ffffff);
    --smc-bg-light: var(--bg, #f8f9fa);
    --smc-shadow: var(--shadow, 0 2px 10px rgba(0, 0, 0, 0.1));
    --smc-shadow-hover: var(--shadow-2, 0 5px 20px rgba(0, 0, 0, 0.15));
    --smc-radius: 12px;
    --smc-transition: all 0.3s ease;
}

/* Reset et base */
.smc-contact-form * {
    box-sizing: border-box;
}

/* Conteneur principal */
.smc-contact-form {
    max-width: 600px;
    margin: 0 auto;
    padding: 30px;
    background: var(--smc-bg);
    border-radius: var(--smc-radius);
    box-shadow: var(--smc-shadow);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--smc-text);
}

.smc-contact-form.compact {
    padding: 20px;
    max-width: 500px;
}

/* Titre */
.smc-form-title {
    text-align: center;
    margin-bottom: 30px;
    color: var(--smc-text);
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(180deg, var(--info, #3b82f6) 0%, var(--primary, #2563eb) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.smc-form-subtitle {
    text-align: center;
    margin-bottom: 25px;
    color: var(--smc-text-light);
    font-size: 16px;
    font-weight: 400;
}

/* Groupes de champs */
.smc-form-group {
    margin-bottom: 25px;
    position: relative;
}

.smc-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

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

/* Labels */
.smc-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--smc-text);
    font-size: 14px;
    transition: var(--smc-transition);
}

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

/* Champs de saisie */
.smc-input,
.smc-textarea,
.smc-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--smc-border);
    border-radius: var(--smc-radius);
    font-size: 16px;
    font-family: inherit;
    background: var(--smc-bg);
    color: var(--smc-text);
    transition: var(--smc-transition);
    outline: none;
}

.smc-input:focus,
.smc-textarea:focus,
.smc-select:focus {
    border-color: var(--smc-primary);
    box-shadow: 0 0 0 4px var(--ring, rgba(37, 99, 235, 0.15));
    transform: translateY(-1px);
}

.smc-input:hover,
.smc-textarea:hover,
.smc-select:hover {
    border-color: var(--smc-primary-dark);
}

.smc-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

.smc-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 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
    line-height: 1.4;
    height: auto;
    min-height: 48px;
}

.smc-select option {
    padding: 8px 12px;
    line-height: 1.4;
    color: var(--smc-text);
    background: var(--smc-bg);
}

/* Checkbox */
.smc-checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 25px;
}

.smc-checkbox {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--smc-primary);
}

.smc-checkbox-label {
    flex: 1;
    font-size: 14px;
    color: var(--smc-text-light);
    cursor: pointer;
    line-height: 1.4;
}

.smc-checkbox-label a {
    color: var(--smc-primary);
    text-decoration: none;
}

.smc-checkbox-label a:hover {
    text-decoration: underline;
}

/* Bouton de soumission */
.smc-submit-group {
    text-align: center;
    margin-top: 30px;
}

.smc-submit-btn {
    background: linear-gradient(180deg, var(--info, #3b82f6) 0%, var(--primary, #2563eb) 100%);
    color: #fff;
    border: 1px solid var(--primary, #1d4ed8);
    padding: 14px 32px;
    border-radius: var(--smc-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--smc-transition);
    position: relative;
    overflow: hidden;
    min-width: 160px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.smc-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

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

.smc-btn-loading {
    display: none;
}

.smc-btn-loading .smc-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

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

/* Messages */
.smc-form-messages {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: var(--smc-radius);
    display: none;
    animation: slideDown 0.3s ease-out;
}

.smc-form-messages.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.smc-form-messages.error {
    background: #fee2e2;
    color: #7f1d1d;
    border: 1px solid #fecaca;
}

.smc-form-messages.warning {
    background: rgba(243, 156, 18, 0.1);
    border: 1px solid var(--smc-warning);
    color: var(--smc-warning);
}

.smc-form-messages p {
    margin: 0;
    font-weight: 500;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal */
.smc-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

.smc-modal-content {
    position: relative;
    background: var(--smc-bg);
    margin: 5% auto;
    padding: 0;
    border-radius: var(--smc-radius);
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

.smc-modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--smc-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.smc-modal-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--smc-text);
}

.smc-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--smc-text-light);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--smc-transition);
}

.smc-modal-close:hover {
    background: var(--smc-bg-light);
    color: var(--smc-text);
}

.smc-modal-body {
    padding: 30px;
}

.smc-modal .smc-contact-form {
    box-shadow: none;
    padding: 0;
    margin: 0;
}

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

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

/* Responsive */
@media (max-width: 768px) {
    .smc-contact-form {
        padding: 20px;
        margin: 10px;
    }
    
    .smc-form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .smc-form-row .smc-form-group {
        margin-bottom: 25px;
    }
    
    .smc-form-title {
        font-size: 24px;
    }
    
    .smc-modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .smc-modal-header,
    .smc-modal-body {
        padding: 20px;
    }
    
    .smc-checkbox-group {
        flex-direction: column;
        gap: 8px;
    }
    
    .smc-checkbox {
        align-self: flex-start;
    }
}

@media (max-width: 480px) {
    .smc-contact-form {
        padding: 15px;
    }
    
    .smc-input,
    .smc-textarea,
    .smc-select {
        font-size: 16px; /* Évite le zoom sur iOS */
    }
    
    .smc-submit-btn {
        width: 100%;
        padding: 16px;
    }
}

/* Animations d'entrée */
.smc-contact-form {
    animation: fadeInUp 0.6s ease-out;
}

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

/* États de focus améliorés */
.smc-form-group.focused .smc-label {
    color: var(--smc-primary);
    transform: translateY(-2px);
}

/* Indicateur de chargement global */
.smc-contact-form.loading {
    pointer-events: none;
    opacity: 0.7;
}

.smc-contact-form.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--smc-radius);
}

/* Styles pour le thème sombre (optionnel) */
@media (prefers-color-scheme: dark) {
    :root {
        --smc-text: #ffffff;
        --smc-text-light: #b0b0b0;
        --smc-border: #404040;
        --smc-bg: #1a1a1a;
        --smc-bg-light: #2a2a2a;
    }
    
    .smc-input,
    .smc-textarea,
    .smc-select {
        background: var(--smc-bg-light);
        color: var(--smc-text);
    }
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible pour l'accessibilité */
.smc-input:focus-visible,
.smc-textarea:focus-visible,
.smc-select:focus-visible,
.smc-submit-btn:focus-visible,
.smc-checkbox:focus-visible {
    outline: 2px solid var(--smc-primary);
    outline-offset: 2px;
}

/* Styles d'impression */
@media print {
    .smc-modal {
        display: none !important;
    }
    
    .smc-contact-form {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Erreurs de validation */
.smc-field-error {
    color: var(--smc-error);
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

.smc-input.error, 
.smc-textarea.error, 
.smc-select.error {
    border-color: var(--smc-error) !important;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1) !important;
}

.smc-form-group.focused .smc-label {
    color: var(--smc-primary);
}

.success-animation {
    animation: successPulse 0.6s ease-in-out;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.success-pulse {
    animation: successGlow 1s ease-in-out;
}

@keyframes successGlow {
    0% { box-shadow: 0 0 5px rgba(46, 204, 113, 0.3); }
    50% { box-shadow: 0 0 20px rgba(46, 204, 113, 0.6); }
    100% { box-shadow: 0 0 5px rgba(46, 204, 113, 0.3); }
}

body.smc-modal-open {
    overflow: hidden;
}

.smc-modal-trigger {
    background: linear-gradient(135deg, var(--smc-primary) 0%, var(--smc-secondary) 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--smc-transition);
}

.smc-modal-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}