/* ==========================================
   RESET & BASE STYLES
   ========================================== */

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

:root {
    /* Colors - Modern Islamic palette */
    --primary-color: #2C5F41;        /* Deep green */
    --secondary-color: #F4F7F5;      /* Light mint */
    --accent-color: #D4AF37;         /* Gold */
    --text-primary: #1A1A1A;         /* Almost black */
    --text-secondary: #666666;       /* Gray */
    --text-light: #999999;           /* Light gray */
    --background: #FFFFFF;           /* White */
    --background-alt: #FAFBFA;       /* Very light green */
    --border-light: #E8F0EA;         /* Light green border */
    --shadow: rgba(44, 95, 65, 0.1);
    
    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-arabic: 'Amiri', serif;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;
    
    /* Breakpoints */
    --mobile: 768px;
    --tablet: 1024px;
    --desktop: 1200px;
}

body {
    font-family: var(--font-primary);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
}

.container {
    max-width: var(--desktop);
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

/* ==========================================
   HEADER
   ========================================== */

.header {
    background: var(--background);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    position: relative;
}

.logo a {
    text-decoration: none;
    color: var(--primary-color);
    display: flex;
    align-items: center;
}

.logo-img {
    height: 50px;
    max-width: 180px;
    width: auto;
    object-fit: contain;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.logo span {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Navigation */
.nav-list {
    display: flex;
    list-style: none;
    gap: var(--spacing-lg);
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 50%;
    background-color: var(--accent-color);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Search */
.search-container {
    position: relative;
}

.search-form {
    display: flex;
    align-items: center;
    background: var(--background-alt);
    border: 1px solid var(--border-light);
    border-radius: 25px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.search-form:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--shadow);
}

.search-input {
    border: none;
    background: transparent;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    min-width: 250px;
    outline: none;
}

.search-input::placeholder {
    color: var(--text-light);
}

.search-btn {
    background: var(--primary-color);
    border: none;
    color: white;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-btn:hover {
    background: #245038;
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-toggle span {
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

/* ==========================================
   MAIN CONTENT
   ========================================== */

.main {
    min-height: calc(100vh - 160px);
    padding: var(--spacing-xl) 0;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--background-alt) 100%);
    padding: var(--spacing-2xl) 0;
    text-align: center;
    border-radius: 20px;
    margin-bottom: var(--spacing-xl);
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto var(--spacing-lg);
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow);
}

.hero-cta:hover {
    background: #245038;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow);
}

/* Grid Layouts */
.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Cards */
.card {
    background: var(--background);
    border: 1px solid var(--border-light);
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--shadow);
    border-color: var(--primary-color);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--background-alt);
}

.card-content {
    padding: var(--spacing-md);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    line-height: 1.4;
}

.card-title a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

.card-title a:hover {
    color: var(--primary-color);
}

.card-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: var(--spacing-sm);
}

.card-excerpt {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: var(--spacing-sm);
}

.tag {
    background: var(--secondary-color);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
}

.tag:hover {
    background: var(--primary-color);
    color: white;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #245038;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
}

.section-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ==========================================
   FOOTER
   ========================================== */

.footer {
    background: var(--primary-color);
    color: white;
    padding: var(--spacing-2xl) 0 var(--spacing-md);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.footer-logo {
    height: 60px;
    width: auto;
    object-fit: contain;
    margin-bottom: var(--spacing-md);
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: var(--spacing-md);
    color: white;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--accent-color);
}

.social-links {
    display: flex;
    gap: var(--spacing-sm);
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.social-link:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
}

.newsletter-form {
    display: flex;
    gap: 0.5rem;
}

.newsletter-input {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
}

.newsletter-btn {
    background: var(--accent-color);
    color: var(--primary-color);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.newsletter-btn:hover {
    background: #c19b26;
}

.footer-bottom {
    text-align: center;
    padding-top: var(--spacing-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 1024px) {
    .nav-list {
        gap: var(--spacing-md);
    }
    
    .search-input {
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--background);
        border-top: 1px solid var(--border-light);
        box-shadow: 0 5px 15px var(--shadow);
        z-index: 999;
    }

    .nav.active {
        display: block;
    }

    .nav-list {
        flex-direction: column;
        padding: var(--spacing-md);
        gap: 0;
    }

    .nav-list li {
        width: 100%;
        border-bottom: 1px solid var(--border-light);
    }

    .nav-list li:last-child {
        border-bottom: none;
    }

    .nav-link {
        display: block;
        padding: var(--spacing-md);
        width: 100%;
    }

    .mobile-toggle {
        display: flex;
    }

    .mobile-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }
    
    .search-container {
        order: 3;
        flex: 1;
    }
    
    .search-input {
        min-width: auto;
        width: 100%;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    
    .newsletter-form {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-xs);
    }
    
    .main {
        padding: var(--spacing-lg) 0;
    }
    
    .hero {
        padding: var(--spacing-lg) 0;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
}

/* ==========================================
   ENHANCED FORM STYLES
   ========================================== */

.form-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

.form-success {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1) !important;
}

.form-loading {
    position: relative;
    pointer-events: none;
}

.form-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 1rem;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-light);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translateY(-50%);
}

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

/* Enhanced Newsletter Form */
.newsletter-form {
    display: flex;
    gap: 0.5rem;
    max-width: 400px;
    margin: 0 auto;
}

.newsletter-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transition: all 0.3s ease;
}

.newsletter-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.newsletter-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.3);
}

/* Floating labels effect */
.form-group-floating {
    position: relative;
    margin-bottom: var(--spacing-lg);
}

.form-input-floating {
    width: 100%;
    padding: 1.25rem 1rem 0.75rem;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    font-size: 1rem;
    background: var(--background);
    transition: all 0.3s ease;
}

.form-label-floating {
    position: absolute;
    left: 1rem;
    top: 1.25rem;
    font-size: 1rem;
    color: var(--text-light);
    transition: all 0.3s ease;
    pointer-events: none;
    background: var(--background);
    padding: 0 0.25rem;
}

.form-input-floating:focus + .form-label-floating,
.form-input-floating:not(:placeholder-shown) + .form-label-floating {
    top: -0.5rem;
    left: 0.75rem;
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
}

.form-input-floating:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(44, 95, 65, 0.1);
}

/* ==========================================
   MODERN INPUT STYLES
   ========================================== */

/* Styles de base pour tous les champs de formulaire */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="url"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    font-size: 1rem;
    font-family: var(--font-primary);
    background: var(--background);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(44, 95, 65, 0.05);
    line-height: 1.5;
}

/* États focus avec animation douce */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(44, 95, 65, 0.1), 0 4px 12px rgba(44, 95, 65, 0.15);
    background: white;
    transform: translateY(-1px);
}

/* États hover */
input[type="text"]:hover,
input[type="email"]:hover,
input[type="tel"]:hover,
input[type="password"]:hover,
input[type="url"]:hover,
input[type="search"]:hover,
textarea:hover,
select:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(44, 95, 65, 0.08);
}

/* Styles pour les placeholders */
input::placeholder,
textarea::placeholder {
    color: var(--text-light);
    transition: all 0.3s ease;
    font-style: italic;
}

input:focus::placeholder,
textarea:focus::placeholder {
    color: rgba(153, 153, 153, 0.6);
    opacity: 0.8;
}

/* Styles spéciaux pour textarea */
textarea {
    min-height: 120px;
    resize: vertical;
    font-family: var(--font-primary);
    line-height: 1.6;
}

textarea:focus {
    min-height: 140px;
}

/* Styles pour select avec icône personnalisée */
select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg fill='%23666666' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.5rem;
    padding-right: 3rem;
    appearance: none;
    cursor: pointer;
}

select:focus {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg fill='%232C5F41' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
}

/* Styles pour les champs avec icônes */
.form-group-with-icon {
    position: relative;
}

.form-group-with-icon input {
    padding-left: 3rem;
}

.form-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1.125rem;
    pointer-events: none;
    transition: color 0.3s ease;
    z-index: 2;
}

.form-group-with-icon input:focus + .form-icon {
    color: var(--primary-color);
}

/* Styles pour les checkboxes et radios modernisés */
input[type="checkbox"],
input[type="radio"] {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    border-radius: 6px;
    border: 2px solid var(--border-light);
    background: var(--background);
    cursor: pointer;
    position: relative;
    appearance: none;
    transition: all 0.3s ease;
    vertical-align: middle;
}

input[type="radio"] {
    border-radius: 50%;
}

input[type="checkbox"]:hover,
input[type="radio"]:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 95, 65, 0.1);
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 95, 65, 0.2);
}

input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.875rem;
    font-weight: bold;
}

input[type="radio"]:checked::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: white;
}

/* États disabled */
input:disabled,
textarea:disabled,
select:disabled {
    background-color: var(--background-alt);
    color: var(--text-light);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Animation de chargement */
@keyframes loading-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.form-group.loading input,
.form-group.loading textarea,
.form-group.loading select {
    background: linear-gradient(90deg, var(--background) 25%, var(--background-alt) 50%, var(--background) 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

/* Styles pour les boutons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border: 2px solid transparent;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-primary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-height: 48px;
    line-height: 1.5;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #245038 100%);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #245038 0%, #1e4230 100%);
    color: white;
}

.btn-secondary {
    background: var(--background);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

/* Styles pour les groupes de champs */
.form-row {
    display: grid;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

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

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

/* Styles pour les labels */
.form-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-label.required::after {
    content: ' *';
    color: #dc3545;
    font-weight: normal;
}

/* Messages d'aide */
.form-help {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    line-height: 1.4;
}

/* Messages d'erreur */
.field-error {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.field-error::before {
    content: "⚠";
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row.two-columns,
    .form-row.three-columns {
        grid-template-columns: 1fr;
    }
    
    input, textarea, select {
        font-size: 16px; /* Évite le zoom sur iOS */
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}