/* ==========================================
   EXCEL QUIZ - ExcelNauka.pl
   ========================================== */

:root {
    --primary: #ffb606;
    --primary-hover: #e6a400;
    --secondary: #103C21;
    --secondary-light: #1a5c32;
    --dark: #0a2614;
    --light: #f8f9fa;
    --white: #ffffff;
    --text: #333333;
    --text-light: #666666;
    --border: #e0e0e0;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
    --success: #22c55e;
    --success-bg: #f0fdf4;
    --error: #ef4444;
    --error-bg: #fef2f2;
    --info: #3b82f6;
    --info-bg: #eff6ff;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--light);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================
   LAYOUT
   ========================================== */

.eq-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

.eq-header {
    background: var(--secondary);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.eq-header .eq-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.eq-logo {
    color: var(--white);
    font-size: 1.3rem;
    font-weight: 700;
    text-decoration: none;
}

.eq-logo span {
    color: var(--primary);
}

.eq-score {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-weight: 600;
    font-size: 1rem;
}

.eq-main {
    flex: 1;
    padding: 40px 20px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.eq-footer {
    background: var(--dark);
    color: var(--text-light);
    text-align: center;
    padding: 20px;
    font-size: 0.85rem;
    margin-top: auto;
}

/* ==========================================
   PROGRESS BAR
   ========================================== */

.eq-progress {
    background: var(--border);
    height: 6px;
    position: relative;
}

.eq-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    transition: width 0.5s ease;
    width: 0%;
    border-radius: 0 3px 3px 0;
}

.eq-progress-text {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ==========================================
   WELCOME SCREEN
   ========================================== */

.eq-welcome {
    text-align: center;
    padding: 60px 0;
}

.eq-welcome h1 {
    font-size: 2.5rem;
    color: var(--secondary);
    margin-bottom: 16px;
    line-height: 1.2;
}

.eq-welcome h1 span {
    color: var(--primary);
}

.eq-welcome p {
    font-size: 1.15rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto 40px;
}

.eq-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.eq-feature {
    background: var(--white);
    padding: 24px 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.eq-feature-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.eq-feature h3 {
    font-size: 1rem;
    color: var(--secondary);
    margin-bottom: 6px;
}

.eq-feature p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0;
}

/* ==========================================
   BUTTONS
   ========================================== */

.eq-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

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

.eq-btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

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

.eq-btn-secondary:hover {
    background: var(--secondary-light);
    transform: translateY(-2px);
}

.eq-btn-outline {
    background: transparent;
    color: var(--secondary);
    border: 2px solid var(--border);
}

.eq-btn-outline:hover {
    border-color: var(--secondary);
    background: var(--secondary);
    color: var(--white);
}

.eq-btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.eq-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================
   SURVEY
   ========================================== */

.eq-survey {
    max-width: 600px;
    margin: 0 auto;
}

.eq-survey-step {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.4s ease;
}

.eq-survey-header {
    margin-bottom: 30px;
}

.eq-survey-step-indicator {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.eq-survey-step h2 {
    font-size: 1.5rem;
    color: var(--secondary);
}

.eq-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.eq-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    background: var(--white);
}

.eq-option:hover {
    border-color: var(--primary);
    background: #fffbeb;
}

.eq-option.selected {
    border-color: var(--primary);
    background: #fffbeb;
}

.eq-option-radio {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.eq-option.selected .eq-option-radio {
    border-color: var(--primary);
}

.eq-option.selected .eq-option-radio::after {
    content: '';
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
}

.eq-option-icon {
    font-size: 1.5rem;
}

.eq-option-content h4 {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 2px;
}

.eq-option-content p {
    font-size: 0.8rem;
    color: var(--text-light);
    margin: 0;
}

.eq-survey-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==========================================
   TASK VIEW
   ========================================== */

.eq-task {
    animation: fadeInUp 0.4s ease;
}

.eq-task-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.eq-task-badge {
    display: inline-block;
    background: var(--secondary);
    color: var(--white);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.eq-task-card h2 {
    font-size: 1.4rem;
    color: var(--secondary);
    margin-bottom: 12px;
}

.eq-task-description {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 24px;
    line-height: 1.7;
}

/* ==========================================
   EXCEL-LIKE TABLE
   ========================================== */

.eq-spreadsheet-wrapper {
    margin: 20px 0;
    border: 2px solid #b0b8c1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--white);
}

.eq-excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    user-select: none;
}

/* Corner cell (top-left empty) */
.eq-excel-corner {
    width: 40px;
    min-width: 40px;
    background: #e8ecf0;
    border-right: 1px solid #b0b8c1;
    border-bottom: 1px solid #b0b8c1;
}

/* Column headers (A, B, C...) */
.eq-excel-col-header {
    background: #e8ecf0;
    color: #444;
    padding: 6px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    border-right: 1px solid #d0d5db;
    border-bottom: 1px solid #b0b8c1;
    letter-spacing: 1px;
}

/* Sub-headers (nazwy kolumn) */
.eq-excel-subheader {
    background: var(--secondary);
    color: var(--white);
    padding: 8px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.82rem;
    border-right: 1px solid rgba(255,255,255,0.15);
    border-bottom: 1px solid #b0b8c1;
}

/* Row number headers (1, 2, 3...) */
.eq-excel-row-header {
    background: #e8ecf0;
    color: #666;
    padding: 8px 6px;
    text-align: center;
    font-weight: 500;
    font-size: 0.8rem;
    border-right: 1px solid #b0b8c1;
    border-bottom: 1px solid #d0d5db;
    width: 40px;
    min-width: 40px;
}

/* Regular data cells */
.eq-excel-cell {
    padding: 9px 14px;
    border-right: 1px solid #e4e8ec;
    border-bottom: 1px solid #e4e8ec;
    cursor: pointer;
    transition: background 0.15s ease;
    position: relative;
}

.eq-excel-cell:hover:not(.eq-excel-cell-editable) {
    background: #f0f4f8;
}

.eq-excel-cell-number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Editable cell (where user enters formula) */
.eq-excel-cell-editable {
    padding: 0;
    background: #fffbeb;
    border: 2px solid var(--primary) !important;
    cursor: text;
}

.eq-excel-cell-input {
    width: 100%;
    height: 100%;
    border: none;
    padding: 9px 14px;
    background: transparent;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.9rem;
    outline: none;
    color: var(--secondary);
}

.eq-excel-cell-input::placeholder {
    color: #ccc;
    font-style: italic;
}

/* Selected cell (click) */
.eq-excel-cell-selected {
    background: #dbeafe !important;
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
    z-index: 1;
}

/* Range selection (drag) */
.eq-excel-cell-range {
    background: #dbeafe !important;
    position: relative;
}

.eq-excel-cell-range::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid rgba(59, 130, 246, 0.4);
    pointer-events: none;
}

/* Cell hint text */
.eq-cell-hint {
    font-size: 0.78rem;
    color: var(--text-light);
    margin: 6px 0 16px;
    font-style: italic;
}

/* Formula input fallback */
.eq-formula-input-wrapper {
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.eq-formula-label {
    font-weight: 600;
    color: var(--secondary);
    white-space: nowrap;
    font-size: 0.9rem;
}

.eq-formula-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    transition: var(--transition);
}

.eq-formula-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 182, 6, 0.2);
}

.eq-task-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 24px;
}

/* Hint */
.eq-hint {
    background: var(--info-bg);
    border-left: 4px solid var(--info);
    padding: 12px 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-top: 16px;
    font-size: 0.9rem;
    color: var(--text);
    animation: fadeIn 0.3s ease;
}

/* Feedback */
.eq-feedback {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-top: 20px;
    font-weight: 500;
    animation: fadeIn 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.eq-feedback-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.eq-feedback.success {
    background: var(--success-bg);
    border-left: 4px solid var(--success);
    color: #166534;
}

.eq-feedback.error {
    background: var(--error-bg);
    border-left: 4px solid var(--error);
    color: #991b1b;
}

.eq-feedback.partial {
    background: #fffbeb;
    border-left: 4px solid var(--primary);
    color: #92400e;
}

/* ==========================================
   QUIZ VIEW
   ========================================== */

.eq-quiz {
    max-width: 700px;
    margin: 0 auto;
    animation: fadeInUp 0.4s ease;
}

.eq-quiz-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
}

.eq-quiz-badge {
    display: inline-block;
    background: var(--primary);
    color: var(--dark);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.eq-quiz-card h2 {
    font-size: 1.3rem;
    color: var(--secondary);
    margin-bottom: 28px;
    line-height: 1.5;
}

.eq-quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 28px;
}

.eq-quiz-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.eq-quiz-option:hover:not(.disabled) {
    border-color: var(--primary);
    background: #fffbeb;
}

.eq-quiz-option.selected {
    border-color: var(--primary);
    background: #fffbeb;
}

.eq-quiz-option.correct {
    border-color: var(--success);
    background: var(--success-bg);
}

.eq-quiz-option.incorrect {
    border-color: var(--error);
    background: var(--error-bg);
}

.eq-quiz-option.disabled {
    cursor: default;
    opacity: 0.7;
}

.eq-quiz-option.disabled.correct {
    opacity: 1;
}

.eq-quiz-option-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text);
    flex-shrink: 0;
    transition: var(--transition);
}

.eq-quiz-option.selected .eq-quiz-option-letter {
    background: var(--primary);
    color: var(--dark);
}

.eq-quiz-option.correct .eq-quiz-option-letter {
    background: var(--success);
    color: white;
}

.eq-quiz-option.incorrect .eq-quiz-option-letter {
    background: var(--error);
    color: white;
}

.eq-quiz-explanation {
    background: var(--info-bg);
    border-left: 4px solid var(--info);
    padding: 14px 18px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 24px;
    font-size: 0.9rem;
    line-height: 1.6;
    animation: fadeIn 0.3s ease;
}

/* ==========================================
   SUMMARY VIEW
   ========================================== */

.eq-summary {
    max-width: 700px;
    margin: 0 auto;
    animation: fadeInUp 0.4s ease;
}

.eq-summary-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
    text-align: center;
    margin-bottom: 24px;
}

.eq-summary-card h1 {
    font-size: 2rem;
    color: var(--secondary);
    margin-bottom: 8px;
}

.eq-summary-subtitle {
    color: var(--text-light);
    margin-bottom: 32px;
}

.eq-score-big {
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 4px;
}

.eq-score-max {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 32px;
}

.eq-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.eq-stat-item {
    padding: 16px;
    background: var(--light);
    border-radius: var(--radius-sm);
}

.eq-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
}

.eq-stat-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
}

.eq-summary-details {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    text-align: left;
}

.eq-summary-details h3 {
    font-size: 1.1rem;
    color: var(--secondary);
    margin-bottom: 16px;
}

.eq-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.eq-result-item:last-child {
    border-bottom: none;
}

.eq-result-icon {
    font-size: 1.2rem;
}

.eq-result-title {
    flex: 1;
    font-size: 0.9rem;
}

.eq-result-points {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-light);
}

.eq-summary-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 32px;
}

/* ==========================================
   AUTH (header login)
   ========================================== */

.eq-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.eq-auth {
    display: flex;
    align-items: center;
    gap: 8px;
}

.eq-auth-name {
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    font-weight: 500;
}

.eq-btn-xs {
    padding: 5px 12px;
    font-size: 0.75rem;
    border-radius: 6px;
}

.eq-btn-outline.eq-btn-xs {
    color: var(--white);
    border-color: rgba(255,255,255,0.3);
}

.eq-btn-outline.eq-btn-xs:hover {
    border-color: var(--white);
    background: rgba(255,255,255,0.1);
    color: var(--white);
}

/* ==========================================
   EMAIL SECTION
   ========================================== */

.eq-email-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: left;
}

.eq-email-section h3 {
    font-size: 1rem;
    color: var(--secondary);
    margin-bottom: 12px;
    text-align: center;
}

.eq-email-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.eq-email-input {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
}

.eq-email-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 182, 6, 0.15);
}

.eq-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-light);
    cursor: pointer;
}

.eq-checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    accent-color: var(--primary);
}

.eq-email-success {
    color: var(--success);
    font-size: 0.85rem;
    font-weight: 500;
}

.eq-email-error {
    color: var(--error);
    font-size: 0.85rem;
    font-weight: 500;
}

/* ==========================================
   RANKING
   ========================================== */

.eq-ranking-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    text-align: left;
    margin-bottom: 24px;
}

.eq-ranking-section h3 {
    font-size: 1.1rem;
    color: var(--secondary);
    margin-bottom: 16px;
}

.eq-ranking-login-hint {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.eq-ranking-login-hint a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.eq-ranking-login-hint a:hover {
    text-decoration: underline;
}

.eq-ranking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.eq-ranking-table thead th {
    background: var(--light);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.eq-ranking-row td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.eq-ranking-row:last-child td {
    border-bottom: none;
}

.eq-ranking-me {
    background: #fffbeb;
}

.eq-ranking-me td {
    font-weight: 600;
}

.eq-ranking-pos {
    width: 40px;
    text-align: center;
}

.eq-ranking-pct {
    font-weight: 600;
    color: var(--secondary);
}

.eq-ranking-date {
    color: var(--text-light);
    font-size: 0.8rem;
}

.eq-ranking-empty {
    color: var(--text-light);
    font-style: italic;
    font-size: 0.9rem;
}

.eq-loading {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ==========================================
   ANIMATIONS
   ========================================== */

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

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

.fade-out {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

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

@media (max-width: 768px) {
    .eq-welcome h1 {
        font-size: 1.8rem;
    }

    .eq-features {
        grid-template-columns: 1fr;
    }

    .eq-survey-step,
    .eq-task-card,
    .eq-quiz-card,
    .eq-summary-card {
        padding: 24px;
    }

    .eq-stats-grid {
        grid-template-columns: 1fr;
    }

    .eq-formula-input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .eq-task-actions {
        flex-direction: column;
    }

    .eq-task-actions .eq-btn {
        width: 100%;
    }

    .eq-summary-actions {
        flex-direction: column;
    }
}
