/**
 * Submit Questions Page Styles
 * Redesigned layout with hero header, step guide, and two-column upload/submissions
 */

/* Page Loader Styles - aligned with style.css (subjects_page, etc.) */
.loading-container {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4rem 2rem;
    background: rgba(248, 250, 252, 0.96);
    backdrop-filter: blur(4px);
    z-index: 9999;
}

/* Matches style.css spinner */
.spinner-container {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 2rem;
}

.main-spinner {
    width: 80px;
    height: 80px;
    border: 4px solid rgba(37, 99, 235, 0.1);
    border-left: 4px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.pulse-ring {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 100px;
    height: 100px;
    border: 2px solid rgba(37, 99, 235, 0.3);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

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

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.5;
    }
    100% {
        transform: scale(0.8);
        opacity: 1;
    }
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
    text-align: center;
}

.loading-subtext {
    font-size: 0.9rem;
    color: #6b7280;
    opacity: 0.8;
    text-align: center;
}

/* ── Hero header (matches subjects_page) ── */
.submit-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 1.5rem 0 1.25rem;
    text-align: center;
}

.submit-hero h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.submit-hero__sub {
    font-size: 0.92rem;
    opacity: 0.9;
    max-width: 540px;
    margin: 0 auto 1rem;
}

.submit-hero__stats {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.hero-stat {
    text-align: center;
    min-width: 90px;
}

.hero-stat__number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.hero-stat__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.85;
    font-weight: 500;
}

/* ── Main container ── */
.submit-questions-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ── How It Works section (matches subjects_page tip-card style) ── */
.how-it-works-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 1.5rem 2rem;
    margin: 1.5rem 0 1.5rem;
}

.how-it-works-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.how-it-works-title i {
    color: #4f46e5;
}

.how-it-works-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.step-card {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 1rem;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #f0f1f3;
    transition: transform 0.2s;
}

.step-card:hover {
    transform: translateY(-2px);
}

.step-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.step-content h5 {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.2rem 0;
}

.step-content p {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

.step-content a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}

.step-content a:hover {
    text-decoration: underline;
}

.how-it-works-note {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #92400e;
    line-height: 1.5;
}

.how-it-works-note i {
    color: #f59e0b;
    margin-top: 0.15rem;
    flex-shrink: 0;
}

/* ── Two-column layout ── */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
    margin-top: 1.5rem;
}

/* Upload section - left column, sticky */
.upload-section-redesigned {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 2rem;
}

/* Submissions section - right column */
.submissions-section-redesigned {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 1.5rem;
}

.section-title-redesigned {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
}

/* Compact upload form */
.upload-form-compact {
    display: grid;
    gap: 1rem;
}

.form-row-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.form-group-compact {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-label-compact {
    font-weight: 500;
    color: #374151;
    font-size: 0.85rem;
}

.form-input-compact, .form-select-compact, .form-textarea-compact {
    padding: 0.6rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
    transition: border-color 0.2s ease;
}

.form-input-compact:focus, .form-select-compact:focus, .form-textarea-compact:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea-compact {
    resize: vertical;
    min-height: 60px;
}

/* Compact file upload area */
.file-upload-area-compact {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 1.5rem 1rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #f9fafb;
}

.file-upload-area-compact:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.file-upload-area-compact.drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: scale(1.01);
}

.upload-icon-compact {
    font-size: 2rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.file-upload-area-compact:hover .upload-icon-compact {
    color: #3b82f6;
}

.upload-text-compact {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.upload-subtext-compact {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Enhanced submissions list */
.submissions-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 1rem;
}

.submissions-filter {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.filter-btn:hover:not(.active) {
    background: #f3f4f6;
}

/* Improved upload items */
.upload-item-redesigned {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.upload-item-redesigned:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #d1d5db;
}

.upload-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.upload-item-title-redesigned {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.upload-item-meta-redesigned {
    font-size: 0.75rem;
    color: #6b7280;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.status-badge-redesigned {
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-processing {
    background: #fef3c7;
    color: #d97706;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.status-failed {
    background: #fecaca;
    color: #991b1b;
}

/* Empty state styling */
.empty-submissions {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.empty-submissions-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-submissions-text {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.empty-submissions-subtext {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .upload-section-redesigned {
        position: static;
    }

    .submit-hero__stats {
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .submit-questions-container {
        padding: 0 0.5rem;
    }

    .submit-hero h1 {
        font-size: 1.3rem;
    }

    .submit-hero__stats {
        gap: 0.75rem;
    }

    .hero-stat__number {
        font-size: 1.2rem;
    }

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

    .upload-item-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .upload-item-meta-redesigned {
        flex-direction: column;
        gap: 0.25rem;
    }

    .how-it-works-section {
        padding: 1rem 1.25rem;
    }

    .how-it-works-steps {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .submissions-filter {
        flex-direction: column;
    }

    .filter-btn {
        text-align: center;
    }

    .submit-hero__stats {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }

    .hero-stat {
        display: flex;
        gap: 0.5rem;
        align-items: baseline;
    }
}
