/* ===== CSS Variables & Reset ===== */
:root {
    --primary: #1e3a8a;
    --primary-light: #3b82f6;
    --secondary: #fbbf24;
    --secondary-hover: #f59e0b;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --bg-page: #f9fafb;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --error: #ef4444;
    --success: #10b981;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

.hidden {
    display: none !important;
}

/* ===== Typography ===== */
h1, h2, h3 {
    font-weight: 800;
    line-height: 1.3;
}

/* ===== Hero Section ===== */
.hero {
    position: relative;
    padding: 80px 20px;
    background-image: url('https://offertabs.s3.amazonaws.com/offer/68zf7e/site/media/6ae704c2667439.54720899.png');
    background-size: cover;
    background-position: center;
    background-color: var(--primary);
    text-align: center;
    overflow: hidden;
    width: 100%;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.9) 0%, rgba(15, 23, 42, 0.8) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.badge {
    display: inline-block;
    padding: 6px 16px;
    background-color: rgba(251, 191, 36, 0.2);
    color: var(--secondary);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 24px;
}

.hero h1 {
    color: #ffffff;
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 16px;
}

.hero p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.125rem;
    font-weight: 300;
}

/* ===== Main Container ===== */
.container {
    max-width: 900px;
    margin: -40px auto 40px;
    padding: 0 20px;
    position: relative;
    z-index: 10;
    width: 100%;
}

/* ===== Forms ===== */
#form-container {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 60px;
    width: 100%;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
    width: 100%;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.required {
    color: var(--error);
}

.field-description {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    margin-top: -4px;
}

input[type="text"],
input[type="tel"],
select,
textarea {
    width: 100%;
    max-width: 100%;
    padding: 14px 16px;
    font-family: inherit;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: #ffffff;
    transition: all 0.3s ease;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 16px center;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* ===== Narrative Section ===== */
.narrative-section {
    background: transparent;
    padding: 0;
}

.question-item {
    margin-bottom: 16px;
    background: #f9fafb;
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    width: 100%;
}

.question-item:hover {
    border-color: var(--primary-light);
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-main);
    margin: 0;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 4px;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.question-textarea {
    margin-top: 16px;
    width: 100%;
}


.file-upload-wrapper {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    background-color: var(--bg-page);
    transition: all 0.3s ease;
    width: 100%;
}

.file-upload-wrapper:hover {
    border-color: var(--primary-light);
    background-color: rgba(59, 130, 246, 0.05);
}

input[type="file"] {
    width: 100%;
    cursor: pointer;
    font-family: inherit;
}

/* ===== Buttons ===== */
.btn-primary {
    width: 100%;
    padding: 16px;
    background-color: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-primary:hover {
    background-color: #152968;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    background-color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    padding: 12px 24px;
    background-color: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: rgba(30, 58, 138, 0.05);
}

/* ===== Messages ===== */
.message {
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    text-align: center;
    width: 100%;
}

.error-message {
    background-color: #fef2f2;
    color: var(--error);
    border: 1px solid #fecaca;
}

.success-message {
    background-color: #ecfdf5;
    color: var(--success);
    border: 1px solid #a7f3d0;
}

.success-message h2 {
    margin-bottom: 8px;
}

/* ===== Gallery Section ===== */
.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-header h2 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 12px;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.gallery-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    outline: none;
}

.gallery-card:hover, .gallery-card:focus-visible {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.gallery-image-wrapper {
    width: 100%;
    height: 220px;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-page);
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-card:hover .gallery-image {
    transform: scale(1.05);
}

.gallery-content {
    padding: 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.narrative-text {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-main);
    margin-bottom: 16px;
    white-space: pre-wrap;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vote-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--bg-page);
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vote-btn:hover:not(:disabled) {
    background-color: var(--primary);
    color: #ffffff;
}

.vote-btn:disabled {
    background-color: var(--bg-page);
    border-color: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
}

.load-more-container {
    text-align: center;
    margin-bottom: 40px;
}

/* ===== Lightbox ===== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.lightbox.hidden {
    display: none !important;
    opacity: 0;
}

.lightbox-content-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0,0,0,0.1);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-main);
    z-index: 10;
    transition: background 0.2s ease;
}

.lightbox-close:hover {
    background: rgba(0,0,0,0.2);
}

.lightbox-media {
    flex: 1;
    background: var(--bg-page);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-height: 90vh;
}

.lightbox-info {
    flex: 1;
    padding: 40px 30px;
    overflow-y: auto;
    max-height: 90vh;
}

.lightbox-caption {
    white-space: pre-wrap;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-main);
}

/* ===== Contact Section ===== */
.contact-section {
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 60px 20px;
    text-align: center;
    margin-top: 40px;
    width: 100%;
}

.contact-section h2 {
    color: var(--primary);
    font-size: 1.75rem;
    margin-bottom: 24px;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.contact-item {
    background: var(--bg-page);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 1.1rem;
    color: var(--text-main);
    flex-wrap: wrap;
}

.contact-item a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.2s ease;
}

.contact-item a:hover {
    color: var(--primary);
    text-decoration: underline;
}

#wbx-powered-by-slot {
    margin: 20px auto;
    width: 100%;
}

/* ===== Responsive Mobile Fixes ===== */
@media (max-width: 768px) {
    .hero {
        padding: 60px 16px;
    }
    
    .container {
        margin-top: -20px;
        padding: 0 16px;
    }
    
    #form-container {
        padding: 24px 16px;
    }

    /* Fix the narrow right column issue by enforcing flex column on the grid */
    .form-grid {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
    
    .form-group {
        margin-bottom: 0;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .lightbox-content-wrapper {
        flex-direction: column;
        max-height: 85vh;
    }
    
    .lightbox-media {
        max-height: 40vh;
    }
    
    .lightbox-media img {
        max-height: 40vh;
    }
    
    .lightbox-info {
        padding: 24px 20px;
        max-height: 45vh;
    }
    
    .contact-item {
        flex-direction: column;
        gap: 8px;
    }
}
