/* Mobile-First CSS for PYQ System */

/* Base Styles */
.pyq-mobile-container {
    padding: 1rem 0.5rem;
    max-width: 100%;
    margin: 0 auto;
}

/* Mobile Navigation */
.pyq-mobile-nav {
    position: sticky;
    top: 0;
    background: white;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

.pyq-mobile-nav .nav-tabs {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.pyq-mobile-nav .nav-tabs::-webkit-scrollbar {
    display: none;
}

.pyq-mobile-nav .nav-link {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border: none;
    background: #f8f9fa;
    color: #6c757d;
    border-radius: 0;
    min-width: 120px;
    text-align: center;
}

.pyq-mobile-nav .nav-link.active {
    background: #007bff;
    color: white;
}

/* Mobile Search */
.pyq-mobile-search {
    position: sticky;
    top: 60px;
    background: white;
    z-index: 999;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.pyq-mobile-search .search-input {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 0.75rem 1rem;
    border-radius: 25px;
    border: 1px solid #ced4da;
    width: 100%;
}

.pyq-mobile-search .filter-chips {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.pyq-mobile-search .chip {
    background: #e9ecef;
    color: #495057;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.75rem;
    white-space: nowrap;
    border: 1px solid #dee2e6;
}

.pyq-mobile-search .chip.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Mobile Question Cards */
.pyq-mobile-question {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
    padding: 1rem;
    border-left: 4px solid #007bff;
}

.pyq-mobile-question .question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.pyq-mobile-question .question-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.pyq-mobile-question .meta-badge {
    background: #e9ecef;
    color: #495057;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.625rem;
    font-weight: 600;
}

.pyq-mobile-question .question-text {
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    font-weight: 500;
}

.pyq-mobile-question .options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pyq-mobile-question .option {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.pyq-mobile-question .option:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.pyq-mobile-question .option.selected {
    background: #d1ecf1;
    border-color: #bee5eb;
}

.pyq-mobile-question .option.correct {
    background: #d4edda;
    border-color: #c3e6cb;
}

.pyq-mobile-question .option.incorrect {
    background: #f8d7da;
    border-color: #f5c6cb;
}

.pyq-mobile-question .option-letter {
    background: #6c757d;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: bold;
    flex-shrink: 0;
}

.pyq-mobile-question .option.selected .option-letter {
    background: #007bff;
}

.pyq-mobile-question .option.correct .option-letter {
    background: #28a745;
}

.pyq-mobile-question .option.incorrect .option-letter {
    background: #dc3545;
}

/* Mobile Test Interface */
.pyq-mobile-test {
    min-height: 100vh;
    background: #f8f9fa;
}

.pyq-mobile-test-header {
    background: white;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 1001;
}

.pyq-mobile-test-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.pyq-mobile-test-timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #495057;
}

.pyq-mobile-test-timer .timer-warning {
    color: #ffc107;
}

.pyq-mobile-test-timer .timer-danger {
    color: #dc3545;
}

.pyq-mobile-test-progress-bar {
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}

.pyq-mobile-test-progress-bar .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    transition: width 0.3s ease;
}

.pyq-mobile-test-question {
    padding: 1rem;
    background: white;
    margin: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pyq-mobile-test-navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 0.5rem;
    z-index: 1002;
}

.pyq-mobile-test-navigation .btn {
    flex: 1;
    padding: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    font-size: 0.875rem;
}

.pyq-mobile-test-navigation .btn-primary {
    background: #007bff;
    border-color: #007bff;
}

.pyq-mobile-test-navigation .btn-secondary {
    background: #6c757d;
    border-color: #6c757d;
}

.pyq-mobile-test-navigation .btn-success {
    background: #28a745;
    border-color: #28a745;
}

/* Mobile Results */
.pyq-mobile-results {
    padding: 1rem;
    background: #f8f9fa;
    min-height: 100vh;
}

.pyq-mobile-results .score-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pyq-mobile-results .score-display {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.pyq-mobile-results .score-display.excellent {
    color: #28a745;
}

.pyq-mobile-results .score-display.good {
    color: #20c997;
}

.pyq-mobile-results .score-display.average {
    color: #ffc107;
}

.pyq-mobile-results .score-display.poor {
    color: #dc3545;
}

.pyq-mobile-results .stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pyq-mobile-results .stat-item {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.pyq-mobile-results .stat-value {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.pyq-mobile-results .stat-label {
    font-size: 0.75rem;
    color: #6c757d;
}

.pyq-mobile-results .action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pyq-mobile-results .action-buttons .btn {
    padding: 0.875rem;
    font-weight: 600;
    border-radius: 6px;
}

/* Mobile Action Buttons */
.pyq-mobile-actions {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}

.pyq-mobile-actions .fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: none;
    color: white;
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

.pyq-mobile-actions .fab-primary {
    background: #007bff;
}

.pyq-mobile-actions .fab-secondary {
    background: #6c757d;
}

.pyq-mobile-actions .fab-success {
    background: #28a745;
}

.pyq-mobile-actions .fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* Mobile Loading States */
.pyq-mobile-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    margin: 1rem;
}

.pyq-mobile-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.pyq-mobile-loading .loading-text {
    color: #6c757d;
    font-size: 0.875rem;
}

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

/* Mobile Empty States */
.pyq-mobile-empty {
    text-align: center;
    padding: 2rem 1rem;
    background: white;
    border-radius: 8px;
    margin: 1rem;
}

.pyq-mobile-empty .empty-icon {
    font-size: 3rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

.pyq-mobile-empty .empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
}

.pyq-mobile-empty .empty-description {
    color: #6c757d;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* Responsive Design */
@media (max-width: 576px) {
    .pyq-mobile-container {
        padding: 0.5rem 0.25rem;
    }

    .pyq-mobile-question {
        padding: 0.75rem;
    }

    .pyq-mobile-question .question-text {
        font-size: 0.8125rem;
    }

    .pyq-mobile-question .option {
        padding: 0.625rem;
        font-size: 0.75rem;
    }

    .pyq-mobile-test-question {
        margin: 0.5rem;
        padding: 0.75rem;
    }

    .pyq-mobile-results .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) {
    .pyq-mobile-container {
        max-width: 768px;
        padding: 1rem;
    }

    .pyq-mobile-question {
        padding: 1.25rem;
    }

    .pyq-mobile-test-question {
        margin: 1rem auto;
        max-width: 600px;
    }

    .pyq-mobile-actions {
        position: fixed;
        bottom: 2rem;
        right: 2rem;
    }
}

/* Touch Optimizations */
.pyq-mobile-question .option,
.pyq-mobile-test-navigation .btn,
.pyq-mobile-actions .fab {
    min-height: 44px; /* iOS touch target size */
    -webkit-tap-highlight-color: transparent;
}

/* Smooth Scrolling */
.pyq-mobile-container {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Pull to Refresh */
.pyq-mobile-pull-refresh {
    position: sticky;
    top: -60px;
    height: 60px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: top 0.3s ease;
}

.pyq-mobile-pull-refresh.active {
    top: 0;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .pyq-mobile-container {
        background: #1a1a1a;
        color: #ffffff;
    }

    .pyq-mobile-nav,
    .pyq-mobile-search,
    .pyq-mobile-question,
    .pyq-mobile-test-header,
    .pyq-mobile-test-question,
    .pyq-mobile-results .score-card,
    .pyq-mobile-results .stat-item {
        background: #2d2d2d;
        border-color: #404040;
    }

    .pyq-mobile-question .option {
        background: #404040;
        border-color: #555555;
        color: #ffffff;
    }

    .pyq-mobile-loading,
    .pyq-mobile-empty {
        background: #2d2d2d;
        color: #ffffff;
    }
}