/* UTILITIES CSS */

/* === CSS VARIABLES / COULEURS === */
:root {
    /* Couleurs principales */
    --primary-green: #059669;
    --primary-green-light: #10b981;
    --primary-green-dark: #047857;
    
    /* Couleurs neutres */
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Couleurs texte */
    --text-primary: #1a202c;
    --text-secondary: #374151;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    /* Couleurs bordures */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-dark: #94a3b8;
    
    /* Couleurs de status */
    --success-bg: linear-gradient(135deg, #d1fae5, #a7f3d0);
    --success-text: #065f46;
    --success-border: #059669;
    
    --danger-bg: linear-gradient(135deg, #fee2e2, #fecaca);
    --danger-text: #dc2626;
    --danger-border: #dc2626;
    
    --info-bg: linear-gradient(135deg, #dbeafe, #bfdbfe);
    --info-text: #1d4ed8;
    --info-border: #059669;
    
    --warning-bg: linear-gradient(135deg, #fef3c7, #fde68a);
    --warning-text: #92400e;
    --warning-border: #d97706;
    
    /* Shadows */
    --shadow-sm: 0 4px 15px rgba(37, 99, 235, 0.1);
    --shadow-md: 0 4px 15px rgba(37, 99, 235, 0.3);
    --shadow-lg: 0 8px 25px rgba(37, 99, 235, 0.4);
    --shadow-card: 0 25px 50px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(229, 231, 235, 0.5);
    --shadow-card-hover: 0 35px 60px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(229, 231, 235, 0.8);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary-green), var(--primary-green-light));
    --gradient-background: linear-gradient(135deg, var(--gray-50), var(--gray-100));
    
    /* Animations */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --animation-entrance: slideInUp 0.6s ease-out forwards;
}

/* === LINKS === */
a {
    color: var(--primary-green);
    text-decoration: none;
    transition: var(--transition-smooth);
}

a:hover {
    color: var(--primary-green-dark);
    text-decoration: underline;
}

/* === GRID LAYOUTS === */
.form-grid {
    display: grid;
    gap: 1.5rem;
}

.form-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.form-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-grid-4 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

/* === MODERN INPUTS === */
.modern-input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.modern-input {
    width: 100%;
    padding: 1.2rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    background: var(--white);
    transition: var(--transition-smooth);
    color: var(--text-primary);
    box-sizing: border-box;
}

.modern-input:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: #fafbff;
}

.modern-input:hover:not(:focus) {
    border-color: var(--border-medium);
}

/* === FLOATING LABELS === */
.modern-label {
    position: absolute;
    left: 1rem;
    top: 1.2rem;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition-smooth);
    pointer-events: none;
    transform-origin: left top;
    background: var(--white);
    padding: 0 0.25rem;
}

/* === PASSWORD TOGGLE === */
.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: var(--transition-smooth);
    z-index: 10;
}

.password-toggle:hover {
    color: var(--primary-green);
}

.modern-input:focus ~ .modern-label,
.modern-input:not(:placeholder-shown) ~ .modern-label,
.has-value .modern-label {
    transform: translateY(-2.2rem) scale(0.85);
    color: var(--primary-green);
    font-weight: 600;
}

/* === SELECT DROPDOWN === */
.modern-select {
    width: 100%;
    padding: 1.2rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    background: var(--white);
    transition: var(--transition-smooth);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    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 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 3rem;
}

.modern-select:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* === CHECKBOXES === */
.modern-checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 12px;
    border: 2px solid transparent;
    transition: var(--transition-smooth);
}

.modern-checkbox-group:hover {
    background: var(--gray-100);
}

.modern-checkbox-group .mb-3 {
    margin-bottom: 0 !important;
}

.modern-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-green);
    cursor: pointer;
    appearance: none;
    border: 2px solid var(--border-medium);
    border-radius: 4px;
    background: var(--white);
    transition: all 0.3s ease;
}

.modern-checkbox:checked {
    background: var(--primary-green);
    border-color: var(--primary-green);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}


input[type="checkbox"],
.form-check-input,
.terms-checkbox {
    accent-color: var(--primary-green) !important;
}

.form-check-input:checked {
    background-color: var(--primary-green) !important;
    border-color: var(--primary-green) !important;
}

.modern-checkbox-label {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    line-height: 1.4;
    margin: 0;
}

/* === BUTTONS === */
.btn-subtle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    color: #495057;
    text-decoration: none;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-subtle:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    color: #495057;
    text-decoration: none;
}

.btn-subtle:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2);
}

.btn-subtle:active {
    transform: translateY(1px);
}

.modern-btn {
    border: none;
    border-radius: 12px;
    padding: 1.2rem 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    min-width: 200px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Button content and loading states */
.btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: opacity 0.3s ease;
}

.btn-icon {
    transition: transform 0.3s ease;
}

.modern-btn:hover:not(.loading) .btn-icon {
    transform: translateX(4px);
}

.btn-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modern-btn.loading .btn-content {
    opacity: 0;
}

.modern-btn.loading .btn-loading {
    opacity: 1;
}

.modern-btn.loading {
    cursor: not-allowed;
    background: #6ee7b7;
    box-shadow: none;
    transform: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.modern-btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.modern-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
    color: white;
}

.modern-btn-primary:active {
    transform: translateY(-1px);
}

.modern-btn-small-primary {
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: 8px;
    padding: .7rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    position: relative;
}

.modern-btn-small-primary:hover {
    background: var(--primary-green-dark);
    text-decoration: none;
    color: white;
}

.modern-btn-secondary-small {
    background: var(--white);
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
    border-radius: 8px;
    padding: .7rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.modern-btn-secondary-small:hover {
    background: var(--primary-green);
    color: white;
    text-decoration: none;
}

.modern-btn-secondary {
    background: var(--white);
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
    box-shadow: var(--shadow-sm);
}

.modern-btn-secondary:hover {
    background: var(--primary-green);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.btn-update {
    background: #f0f9ff;
    color: #64748b;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: .7rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
}

.btn-update:hover {
    background: #e0f2fe;
    color: #475569;
    border-color: #94a3b8;
    text-decoration: none;
}

.btn-delete,
.btn-back {
    background: #fefefe;
    color: #64748b;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: .7rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
}

.btn-delete:hover,
.btn-back:hover {
    background: #f8fafc;
    color: #475569;
    border-color: #94a3b8;
    text-decoration: none;
}

/* === FORM SECTIONS === */
.form-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition-smooth);
    animation: var(--animation-entrance);
    opacity: 0;
    transform: translateY(30px);
}

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

.form-section:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === SECTION TITLES === */
.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-100);
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: 1px;
}

.section-title i {
    color: var(--primary-green);
    font-size: 1.2rem;
}

/* === ALERTS === */
.alert-modern {
    border: none;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.alert-modern.alert-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-left: 4px solid var(--danger-border);
}

.alert-modern.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-left: 4px solid var(--success-border);
}

.alert-modern.alert-info {
    background: var(--info-bg);
    color: var(--info-text);
    border-left: 4px solid var(--info-border);
}

.alert-modern.alert-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-left: 4px solid var(--warning-border);
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    .form-grid-2,
    .form-grid-3,
    .form-grid-4 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-section {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .section-title {
        font-size: 1.3rem;
        margin-bottom: 1.5rem;
    }
    
    .modern-btn {
        width: 100%;
        padding: 1rem 2rem;
    }
}

@media (max-width: 480px) {
    .form-section {
        padding: 1rem;
        border-radius: 16px;
    }
    
    .modern-input,
    .modern-select {
        padding: 1rem 0.75rem;
        font-size: 0.95rem;
    }
    
    .modern-btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}
