/* ========================================
   WAKALA GENERATOR - MAIN STYLESHEET
   تصميم احترافي للوكالات الإدارية المغربية
   ======================================== */

/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* ألوان المشروع */
    --primary-color: #2C5F2D;
    --primary-dark: #234D24;
    --primary-light: #4A7C4E;
    --secondary-color: #F5F5F5;
    --accent-color: #D4AF37;
    --text-primary: #1A1A1A;
    --text-secondary: #666666;
    --border-color: #CCCCCC;
    --border-light: #E0E0E0;

    /* ألوان الحالات */
    --success-bg: #E8F5E9;
    --success-color: #2C5F2D;
    --success-border: #4CAF50;
    --error-bg: #FFEBEE;
    --error-color: #C62828;
    --error-border: #EF5350;
    --warning-bg: #FFF3E0;
    --warning-color: #E65100;

    /* المسافات */
    --spacing-xs: 4px;
    --spacing-s: 8px;
    --spacing-m: 16px;
    --spacing-l: 24px;
    --spacing-xl: 32px;
    --spacing-xxl: 48px;

    /* الخطوط */
    --font-heading: 'Amiri', serif;
    --font-body: 'Cairo', sans-serif;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.18);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    direction: rtl;
    line-height: 1.6;
}

/* ========== CONTAINER ========== */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 var(--spacing-m);
}

/* ========== HEADER ========== */
.site-header {
    background: white;
    padding: var(--spacing-l) 0;
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-xl);
}

.header-content {
    text-align: center;
}

.flag-icon {
    font-size: 32px;
    display: block;
    margin-bottom: var(--spacing-s);
    animation: wave 2s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.site-title {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.site-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ========== WELCOME CARD ========== */
.welcome-card {
    background: white;
    padding: var(--spacing-l);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-xl);
    border-right: 4px solid var(--accent-color);
}

.welcome-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
}

.welcome-text strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* ========== FORM ========== */
.wakala-form {
    background: white;
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.form-section {
    margin-bottom: var(--spacing-xl);
}

.form-section:last-of-type {
    margin-bottom: var(--spacing-l);
}

/* Section Headers */
.section-header {
    margin-bottom: var(--spacing-l);
    padding-bottom: var(--spacing-m);
    border-bottom: 2px solid var(--accent-color);
    position: relative;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    text-align: center;
}

/* Form Groups */
.form-group {
    margin-bottom: var(--spacing-l);
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-s);
}

/* Form Inputs */
.form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: var(--font-body);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    color: var(--text-primary);
    transition: all var(--transition-base);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.1);
}

.form-input.error {
    border-color: var(--error-color);
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.1);
}

.form-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Textarea */
.form-textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

/* Select */
select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232C5F2D' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 36px;
}

/* Input Hints */
.input-hint {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
    font-style: italic;
}

/* Optional field styling */
.form-input:not([required]) {
    border-style: dashed;
}

.form-input:not([required]):focus {
    border-style: solid;
}

/* Form Row (للحقول جنب بعض) */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-m);
}

/* Checkbox Group */
.checkbox-group {
    margin-bottom: var(--spacing-l);
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: var(--spacing-m);
    background: var(--secondary-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.checkbox-label:hover {
    background: #E8E8E8;
}

.form-checkbox {
    width: 20px;
    height: 20px;
    margin-left: var(--spacing-s);
    cursor: pointer;
    accent-color: var(--primary-color);
}

.checkbox-text {
    font-size: 14px;
    color: var(--text-primary);
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-block;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-body);
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    outline: none;
}

.btn:active {
    transform: scale(0.97);
}

/* Primary Button */
.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

/* Danger Button */
.btn-danger {
    background: var(--error-color);
    color: white;
}

.btn-danger:hover {
    background: #B71C1C;
}

/* Small Button */
.btn-small {
    padding: 10px 20px;
    font-size: 14px;
}

/* Button Disabled */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: var(--spacing-m);
    margin-top: var(--spacing-xl);
}

.form-actions .btn {
    flex: 1;
}

/* ========== MESSAGES ========== */
.message-container {
    margin-top: var(--spacing-l);
}

.message {
    padding: var(--spacing-m);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-m);
    animation: slideDown var(--transition-base);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-success {
    background: var(--success-bg);
    color: var(--success-color);
    border: 1px solid var(--success-border);
}

.message-error {
    background: var(--error-bg);
    color: var(--error-color);
    border: 1px solid var(--error-border);
}

.message-warning {
    background: var(--warning-bg);
    color: var(--warning-color);
}

/* ========== MODAL ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalFadeIn var(--transition-base);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: var(--spacing-m);
    left: var(--spacing-m);
    background: var(--error-color);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: #B71C1C;
    transform: rotate(90deg);
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: var(--spacing-l);
    text-align: center;
}

.preview-container {
    background: var(--secondary-color);
    padding: var(--spacing-l);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-l);
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-actions {
    display: flex;
    gap: var(--spacing-m);
}

.modal-actions .btn {
    flex: 1;
}

/* ========== LOADING OVERLAY ========== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: var(--spacing-l);
    font-size: 18px;
    color: var(--primary-color);
    font-weight: 600;
}

/* ========== FOOTER ========== */
.site-footer {
    background: white;
    padding: var(--spacing-xl) 0;
    margin-top: var(--spacing-xxl);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.footer-content {
    text-align: center;
}

.privacy-notice {
    margin-bottom: var(--spacing-l);
}

.privacy-title {
    font-family: var(--font-heading);
    font-size: 18px;
    color: var(--primary-color);
    margin-bottom: var(--spacing-m);
}

.privacy-list {
    list-style: none;
    padding: 0;
}

.privacy-list li {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-s);
}

/* Social Links */
.social-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-l);
    margin: var(--spacing-xl) 0;
    flex-wrap: wrap;
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-s);
    padding: var(--spacing-s) var(--spacing-m);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-base);
    background: var(--secondary-color);
    color: var(--text-primary);
}

.social-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.social-link svg {
    width: 20px;
    height: 20px;
}

.social-link.tiktok:hover {
    background: #000;
    color: white;
}

.social-link.instagram:hover {
    background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%);
    color: white;
}

.social-link.email:hover {
    background: var(--primary-color);
    color: white;
}

.copyright {
    margin-top: var(--spacing-l);
    font-size: 13px;
    color: var(--text-secondary);
}

.footer-link {
    color: var(--primary-color);
    text-decoration: none;
}

.footer-link:hover {
    text-decoration: underline;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    :root {
        font-size: 15px;
    }

    .site-title {
        font-size: 24px;
    }

    .flag-icon {
        font-size: 40px;
    }

    .wakala-form {
        padding: var(--spacing-l);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .modal-content {
        max-width: 95%;
        padding: var(--spacing-l);
    }

    .modal-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-s);
    }

    .wakala-form {
        padding: var(--spacing-m);
    }

    .btn {
        padding: 12px 20px;
        font-size: 15px;
    }
}

/* ========== UTILITIES ========== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-1 { margin-top: var(--spacing-m); }
.mt-2 { margin-top: var(--spacing-l); }
.mb-1 { margin-bottom: var(--spacing-m); }
.mb-2 { margin-bottom: var(--spacing-l); }

/* ========== PRINT STYLES ========== */
@media print {
    body {
        background: white;
    }

    .site-header,
    .site-footer,
    .form-actions,
    .welcome-card {
        display: none;
    }
}