/* ==========================================================================
   FGD (فيدرالية اليسار) - Membership Form Styles
   Theme: Bleu Nuit (Midnight Blue) & Jaune Or (Golden Yellow)
   Dual Logos Header Layout
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=Tajawal:wght@400;500;700;800&display=swap');

:root {
    /* Bleu Nuit (Midnight Blue) */
    --midnight-dark: #070e1b;
    --midnight-primary: #0f1c32;
    --midnight-surface: #172a4d;
    --midnight-light: #243d6b;
    --midnight-soft: #f0f4f9;

    /* Jaune Or (Golden Yellow) */
    --yellow-primary: #f59e0b;
    --yellow-vibrant: #fbbf24;
    --yellow-hover: #d97706;
    --yellow-dark: #b45309;
    --yellow-light: #fffbeb;
    --yellow-soft: #fef3c7;
    --yellow-border: #fcd34d;
    --yellow-glow: rgba(245, 158, 11, 0.35);

    /* Backgrounds & Text */
    --bg-body: #f4f7fb;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-light: #94a3b8;
    
    /* Borders & Inputs */
    --border-color: #d8e2ec;
    --border-focus: #0f1c32;
    --input-bg: #f8fafc;
    
    /* Status Colors */
    --success-color: #10b981;
    --success-bg: #ecfdf5;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --error-bg: #fef2f2;
    
    /* Shadows & Radii */
    --shadow-sm: 0 1px 2px 0 rgba(15, 28, 50, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 28, 50, 0.08), 0 2px 4px -2px rgba(15, 28, 50, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(15, 28, 50, 0.08), 0 8px 10px -6px rgba(15, 28, 50, 0.05);
    --shadow-xl: 0 25px 50px -12px rgba(15, 28, 50, 0.18);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    background-image: 
        radial-gradient(circle at 10% 10%, rgba(15, 28, 50, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(245, 158, 11, 0.06) 0%, transparent 45%);
    color: var(--text-main);
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 2rem 1rem;
}

/* Container */
.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

/* Header & Dual Logos */
.form-header {
    margin-bottom: 2.25rem;
    animation: fadeInDown 0.6s ease;
}

.header-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    background: #ffffff;
    padding: 1.5rem 2rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.header-top-bar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--midnight-primary) 0%, var(--yellow-primary) 50%, var(--midnight-primary) 100%);
}

.logo-box {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #ffffff;
    padding: 8px 12px;
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.logo-box:hover {
    transform: translateY(-2px);
}

.logo-box img {
    max-height: 105px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.06));
    transition: var(--transition);
}

.logo-box:hover img {
    transform: scale(1.03);
}

.header-center-info {
    text-align: center;
    flex-grow: 1;
}

.party-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--midnight-primary);
    color: var(--yellow-vibrant);
    font-size: 0.86rem;
    font-weight: 700;
    padding: 5px 16px;
    border-radius: 9999px;
    border: 1px solid var(--midnight-light);
    box-shadow: 0 4px 10px rgba(15, 28, 50, 0.12);
    margin-bottom: 0.75rem;
}

.party-badge .badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--yellow-primary);
    box-shadow: 0 0 8px var(--yellow-primary);
}

.page-title {
    font-size: 1.85rem;
    font-weight: 900;
    color: var(--midnight-primary);
    margin-bottom: 0.35rem;
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 0.98rem;
    color: var(--text-muted);
    font-weight: 600;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Main Form Card */
.form-card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    padding: 2.75rem;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.7s ease;
}

.form-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--midnight-primary) 0%, var(--yellow-primary) 50%, var(--midnight-primary) 100%);
}

/* Form Sections */
.form-section-title {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 1.18rem;
    font-weight: 800;
    color: var(--midnight-primary);
    margin: 2.25rem 0 1.35rem;
    padding-bottom: 0.85rem;
    border-bottom: 2px solid #eef2f6;
}

.form-section-title:first-of-type {
    margin-top: 0;
}

.section-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--midnight-primary);
    color: var(--yellow-vibrant);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 3px 6px rgba(15, 28, 50, 0.15);
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.35rem 1.6rem;
}

.col-span-2 {
    grid-column: span 2;
}

/* Form Control */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.form-label {
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--midnight-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.form-label .required {
    color: var(--yellow-hover);
    font-size: 1.15rem;
    line-height: 1;
}

.form-label .sub-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-right: auto;
}

/* Input Fields */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    right: 15px;
    color: var(--text-light);
    font-size: 1.15rem;
    pointer-events: none;
    transition: var(--transition);
    z-index: 2;
}

.form-control {
    width: 100%;
    font-family: inherit;
    font-size: 0.96rem;
    font-weight: 500;
    color: var(--text-main);
    background-color: var(--input-bg);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.8rem 2.75rem 0.8rem 1rem;
    transition: var(--transition);
    outline: none;
}

.form-control:hover {
    border-color: #94a3b8;
    background-color: #ffffff;
}

.form-control:focus {
    border-color: var(--midnight-primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(15, 28, 50, 0.1), 0 0 0 1px var(--yellow-primary);
}

.form-control:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
    color: var(--yellow-hover);
}

textarea.form-control {
    padding: 0.85rem 1.15rem;
    min-height: 95px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230f1c32'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 14px center;
    background-size: 18px;
    padding-left: 2.6rem;
}

/* Radio Cards (Sexe & Affiliation) */
.radio-cards-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.95rem;
}

.radio-card {
    position: relative;
    cursor: pointer;
}

.radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-card-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 0.85rem 1.1rem;
    background-color: var(--input-bg);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.96rem;
    font-weight: 700;
    color: var(--text-main);
    transition: var(--transition);
}

.radio-card:hover .radio-card-content {
    border-color: #94a3b8;
    background-color: #ffffff;
}

.radio-card input[type="radio"]:checked + .radio-card-content {
    border-color: var(--midnight-primary);
    background-color: var(--midnight-primary);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(15, 28, 50, 0.2);
}

.radio-card input[type="radio"]:checked + .radio-card-content .radio-card-icon {
    color: var(--yellow-vibrant);
}

.radio-card-icon {
    font-size: 1.25rem;
    color: var(--yellow-hover);
}

/* Conditional Field Box */
.conditional-field {
    background: #fdfaf0;
    border: 1.5px dashed var(--yellow-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-top: 0.65rem;
    transition: var(--transition);
    display: none;
    animation: fadeIn 0.3s ease;
}

.conditional-field.active {
    display: block;
}

/* Checkbox & Terms */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin: 2rem 0 1.35rem;
    padding: 1.15rem;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-md);
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--midnight-primary);
    margin-top: 3px;
    cursor: pointer;
}

.checkbox-label {
    font-size: 0.9rem;
    color: var(--midnight-primary);
    font-weight: 600;
    line-height: 1.6;
    cursor: pointer;
    user-select: none;
}

/* Submit Button */
.btn-submit {
    width: 100%;
    font-family: inherit;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--midnight-dark);
    background: linear-gradient(135deg, var(--yellow-vibrant) 0%, var(--yellow-primary) 50%, #d97706 100%);
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    box-shadow: 0 10px 25px -5px rgba(245, 158, 11, 0.45);
    transition: var(--transition);
    margin-top: 1.25rem;
}

.btn-submit:hover {
    background: linear-gradient(135deg, #fde047 0%, var(--yellow-vibrant) 50%, var(--yellow-primary) 100%);
    box-shadow: 0 14px 30px -5px rgba(245, 158, 11, 0.55);
    transform: translateY(-2px);
}

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

.btn-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.spinner {
    display: none;
    width: 22px;
    height: 22px;
    border: 3px solid rgba(15, 28, 50, 0.25);
    border-top-color: var(--midnight-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Alert Boxes */
.alert {
    padding: 1.1rem 1.35rem;
    border-radius: var(--radius-md);
    font-size: 0.94rem;
    font-weight: 600;
    margin-bottom: 1.65rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    animation: fadeIn 0.4s ease;
}

.alert-danger {
    background-color: var(--error-bg);
    color: #991b1b;
    border: 1.5px solid #fecaca;
}

.alert-success {
    background-color: var(--success-bg);
    color: #065f46;
    border: 1.5px solid #a7f3d0;
}

.field-error {
    font-size: 0.82rem;
    color: var(--error-color);
    font-weight: 700;
    margin-top: 0.3rem;
    display: none;
}

.form-group.has-error .form-control {
    border-color: var(--error-color);
    background-color: var(--error-bg);
}

.form-group.has-error .field-error {
    display: block;
}

/* Success Card Modal / Page */
.success-wrapper {
    text-align: center;
    padding: 2.25rem 1rem;
}

.success-icon-box {
    width: 85px;
    height: 85px;
    background: var(--midnight-primary);
    color: var(--yellow-vibrant);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.6rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 0 0 10px rgba(15, 28, 50, 0.08), 0 10px 25px rgba(245, 158, 11, 0.25);
    animation: scaleBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-title {
    font-size: 1.85rem;
    font-weight: 900;
    color: var(--midnight-primary);
    margin-bottom: 0.5rem;
}

.success-desc {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto 2rem;
}

.receipt-card {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    max-width: 540px;
    margin: 0 auto 2.25rem;
    text-align: right;
    position: relative;
    border-top: 4px solid var(--yellow-primary);
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px dashed #cbd5e1;
    font-size: 0.95rem;
}

.receipt-row:last-child {
    border-bottom: none;
}

.receipt-label {
    color: var(--text-muted);
    font-weight: 600;
}

.receipt-value {
    color: var(--midnight-primary);
    font-weight: 800;
}

.ref-badge {
    background: var(--midnight-primary);
    color: var(--yellow-vibrant);
    font-family: monospace;
    font-size: 0.98rem;
    font-weight: 800;
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid var(--yellow-primary);
    white-space: nowrap !important;
    display: inline-block;
    letter-spacing: 0.5px;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    color: var(--midnight-primary);
    font-weight: 800;
    font-size: 0.96rem;
    padding: 0.8rem 1.6rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: #f1f5f9;
    border-color: var(--midnight-primary);
    transform: translateY(-2px);
}

/* Footer */
.form-footer {
    text-align: center;
    margin-top: 2.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    animation: fadeIn 0.8s ease;
}

.form-footer a {
    color: var(--midnight-primary);
    text-decoration: none;
    font-weight: 700;
    border-bottom: 1.5px dotted var(--yellow-primary);
    padding-bottom: 1px;
}

.form-footer a:hover {
    color: var(--yellow-dark);
}

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

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

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

@keyframes scaleBounce {
    0% { transform: scale(0); }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

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

/* Responsive */
@media (max-width: 768px) {
    .header-top-bar {
        flex-direction: column;
        padding: 1.5rem 1rem;
        gap: 1.25rem;
    }

    .dual-logos-mobile {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 1.5rem;
        width: 100%;
    }

    .logo-box img {
        max-height: 80px;
    }

    .form-card {
        padding: 1.6rem 1.25rem;
        border-radius: var(--radius-lg);
    }

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

    .col-span-2 {
        grid-column: span 1;
    }

    .page-title {
        font-size: 1.55rem;
    }

    .page-subtitle {
        font-size: 0.92rem;
    }
}
