/* Override card border to white for quiz page */
.quiz-container .card {
    border: 1px solid #ffffff;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding-bottom: 15px; /* Reduced bottom padding */
}

/* Ensure "Test your market knowledge" is centered */
.quiz-container .card > p {
    text-align: center !important;
}

.quiz-container {
    max-width: 600px;
    margin: 0 auto;
}

/* Date Picker Container - Separate card like briefings page */
.date-picker-container {
    background-color: #1a1a1a;
    border-radius: 12px;
    padding: 15px;
    margin-top: 20px;
    margin-bottom: 20px;
    border: 1px solid #2a2a2a;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-picker-label {
    font-size: 14px;
    color: #888;
    margin-bottom: 0;
    display: inline-block;
    white-space: nowrap;
}

.date-picker-input {
    background-color: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 10px 15px;
    color: #ffffff;
    font-size: 16px;
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Make entire field clickable on iOS */
    -webkit-tap-highlight-color: rgba(255, 68, 68, 0.3);
    touch-action: manipulation;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.date-picker-input:focus {
    outline: none;
    border-color: #ff4444;
}

/* Green glow for completed quiz dates */
.date-picker-input.quiz-complete {
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.6),
                0 0 20px rgba(34, 197, 94, 0.4),
                0 0 30px rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
}

/* Red glow for incomplete quiz dates */
.date-picker-input.quiz-incomplete {
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6),
                0 0 20px rgba(239, 68, 68, 0.4),
                0 0 30px rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

/* Gray for unavailable dates */
.date-picker-input.quiz-unavailable {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #1a1a1a;
}


/* Make sure label doesn't interfere */
.date-selector label {
    pointer-events: none;
}

.quiz-actions-row {
    display: flex;
    align-items: stretch;
    gap: 0;
    min-height: 46px; /* Reserve space to prevent layout shift */
    box-sizing: border-box;
}

.reset-quiz-button {
    width: 100%;
    padding: 10px 16px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    color: #888;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
    box-sizing: border-box;
}

.reset-quiz-button:hover {
    background: #333;
    border-color: #555;
    color: #fff;
}

.reset-quiz-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quiz-status {
    padding: 12px 16px;
    background: #1a1a1a;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #4a9eff;
    min-height: 48px; /* Reserve space to prevent layout shift */
    box-sizing: border-box;
}

.quiz-status.completed {
    border-left-color: #ffffff;
}

.quiz-status.empty {
    border-left-color: #ff9800;
}

.quiz-status-inline {
    padding: 10px 16px;
    background: #1a1a1a;
    border-radius: 8px;
    border-left: 4px solid #4a9eff;
    display: flex;
    align-items: center;
    height: 100%; /* Match button height exactly */
    box-sizing: border-box;
    line-height: 1.4;
}

.quiz-status-inline.completed {
    border-left-color: #ffffff;
}

.quiz-status-inline.empty {
    border-left-color: #ff9800;
}

.question-card {
    /* Question cards inherit card styling from base, no need for background/border here */
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.question-card.answered {
    border-color: #4a9eff;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.question-number {
    font-size: 14px;
    color: #888;
    font-weight: 600;
}

.question-difficulty {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.question-difficulty.easy {
    background: #4caf50;
    color: #fff;
}

.question-difficulty.medium {
    background: #ff9800;
    color: #fff;
}

.question-difficulty.hard {
    background: #f44336;
    color: #fff;
}

.question-text {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 20px;
    line-height: 1.5;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.options-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.option-item {
    margin-bottom: 12px;
}

.option-item:last-child {
    margin-bottom: 0;
}

.option-button {
    width: 100%;
    padding: 14px 16px;
    background: #252525;
    border: 2px solid #333;
    border-radius: 8px;
    color: #ffffff;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    overflow-wrap: break-word;
    word-wrap: break-word;
    box-sizing: border-box;
}

.option-button:hover:not(:disabled) {
    background: #2a2a2a;
    border-color: #4a9eff;
}

.option-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.option-button.selected {
    background: #4a9eff;
    border-color: #4a9eff;
    color: #ffffff;
}

.option-button.correct {
    background: #4caf50;
    border-color: #4caf50;
    color: #ffffff;
}

.option-button.incorrect {
    background: #f44336;
    border-color: #f44336;
    color: #ffffff;
}

.question-result-container {
    min-height: 0; /* Only reserve space if explanation exists */
    margin-top: 16px;
}

.question-result {
    margin-top: 0;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    animation: slideIn 0.3s ease;
}

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

.question-result.correct {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid #4caf50;
    color: #4caf50;
}

.question-result.incorrect {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid #f44336;
    color: #f44336;
}

.question-explanation {
    margin-top: 12px;
    padding: 12px;
    background: #252525;
    border-radius: 8px;
    font-size: 14px;
    color: #ccc;
    line-height: 1.5;
    animation: slideIn 0.3s ease;
}

.xp-earned {
    display: inline-block;
    margin-left: 8px;
    color: #4caf50;
    font-weight: 600;
}

.quiz-progress-card {
    /* Regular card styling - no fixed positioning */
    padding: 20px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #2a2a2a;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 0;
    margin-top: 0;
    position: relative;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #fbbf24 0%, #fcd34d 100%);
    transition: width 0.3s ease-out;
    border-radius: 16px;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.progress-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 14px;
    color: #ffffff;
    margin-bottom: 16px;
    margin-top: 0;
}

.progress-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.progress-stat-label {
    color: #888;
    font-weight: 500;
}

.progress-stat-value {
    font-weight: 700;
    color: #4a9eff;
}

.progress-stat-separator {
    color: #444;
    margin: 0 4px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #888;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
}

.error-message {
    padding: 16px;
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid #f44336;
    border-radius: 8px;
    color: #f44336;
    margin-bottom: 20px;
}

.questions-wrapper {
    margin-bottom: 20px;
}

/* Skeleton loading styles */
.skeleton-line {
    background: linear-gradient(
        90deg,
        #2a2a2a 0%,
        #3a3a3a 50%,
        #2a2a2a 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.date-selector {
    transition: opacity 0.2s ease-in-out;
}

.question-skeleton-item {
    padding: 20px 0;
    border-bottom: 1px solid #2a2a2a;
}

.question-skeleton-item:last-child {
    border-bottom: none;
}

/* Question navigation */
.question-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 16px;
    border-top: 1px solid #2a2a2a;
}

.question-nav-button {
    background-color: #2a2a2a;
    color: #ffffff;
    border: 1px solid #3a3a3a;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.question-nav-button:hover:not(:disabled) {
    background-color: #3a3a3a;
    border-color: #4a4a4a;
}

.question-nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Amber border for Previous button when visible (not disabled) */
.question-navigation .question-nav-button:first-child:not(:disabled) {
    border-color: #fbbf24;
}

/* Amber border for Next button when visible (not disabled) */
.question-navigation .question-nav-button:last-child:not(:disabled) {
    border-color: #fbbf24;
}

.question-nav-indicator {
    color: #888;
    font-size: 14px;
}

@media (max-width: 768px) {
    .date-selector {
        gap: 8px;
    }
    
    .date-selector label {
        font-size: 14px;
    }
    
    .date-selector input {
        padding: 10px 8px;
        font-size: 14px;
        min-width: 140px;
        max-width: 180px;
        /* Ensure larger touch target on mobile */
        min-height: 44px; /* iOS recommended minimum touch target */
        -webkit-tap-highlight-color: rgba(74, 158, 255, 0.3);
    }
    
    .quiz-progress-card {
        padding: 15px;
    }
    
    .progress-stats {
        font-size: 12px;
        gap: 8px;
    }
    
    .progress-stat-separator {
        margin: 0 2px;
    }
    
    .question-nav-button {
        padding: 8px 16px;
        font-size: 12px;
    }
}
