/* ========================================
   MODERN PROFESSIONAL DESIGN
   Latihan Soal Petugas Haji Indonesia
   ======================================== */

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Modern Color Palette */
    --primary: #0f766e;
    --primary-light: #14b8a6;
    --primary-dark: #0d5c56;
    --secondary: #0891b2;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Semantic Colors */
    --bg-primary: #ffffff;
    --bg-secondary: var(--gray-50);
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    --border: var(--gray-200);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-2xl: 2rem;
    --radius-full: 9999px;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    box-shadow: var(--shadow-2xl);
}

/* === HEADER === */
.header {
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
    padding: 2rem 2.5rem;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.logo {
    position: relative;
    z-index: 1;
}

.logo h1 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: white;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.logo p {
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
    letter-spacing: 0.02em;
}

/* === MAIN CONTENT === */
.main-content {
    flex: 1;
    padding: 2.5rem;
    background: var(--bg-secondary);
}

.page {
    display: none;
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.page.active {
    display: block;
}

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

/* === WELCOME SECTION === */
.welcome-section {
    text-align: center;
    margin-bottom: 2.5rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.05) 0%, rgba(20, 184, 166, 0.05) 100%);
    border-radius: var(--radius-2xl);
}

.welcome-section h2 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.welcome-section p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* === SEARCH BOX === */
.search-box {
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.search-box input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    box-shadow: var(--shadow-sm);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.1), var(--shadow-md);
    transform: translateY(-2px);
}

.search-box input::placeholder {
    color: var(--gray-400);
}

/* === CATEGORIES GRID === */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.category-card {
    background: var(--bg-primary);
    border: 2px solid transparent;
    border-radius: var(--radius-xl);
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    transform: scaleX(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.category-card:hover::before {
    transform: scaleX(1);
}

.category-card h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--gray-800);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.01em;
}

.category-card p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.category-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 600;
}

.question-count {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 0.375rem 1rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(15, 118, 110, 0.3);
}

/* === HISTORY SECTION === */
.history-section {
    margin-top: 4rem;
    padding: 2rem;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.history-section h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--gray-800);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    background: var(--bg-secondary);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.history-item:hover {
    background: var(--gray-100);
    transform: translateX(4px);
}

.history-info h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.375rem;
}

.history-info p {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.history-score {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.empty-state {
    text-align: center;
    color: var(--gray-400);
    padding: 3rem;
    font-size: 1rem;
}

/* === QUIZ PAGE === */
.quiz-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.quiz-header h2 {
    flex: 1;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 700;
    min-width: 200px;
}

.timer {
    background: linear-gradient(135deg, var(--warning) 0%, #f97316 100%);
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-back {
    padding: 0.75rem 1.25rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--gray-700);
}

.btn-back:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
    transform: translateX(-2px);
}

/* === PROGRESS === */
.progress-container {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.progress-bar {
    height: 12px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-full);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(20, 184, 166, 0.5);
}

/* === QUESTION CARD === */
.question-card {
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius-2xl);
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.question-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

.question-text {
    font-size: 1.25rem;
    line-height: 1.8;
    margin-bottom: 2.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.option {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    font-weight: 500;
    position: relative;
}

.option::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.option:hover {
    background: #d1fae5;
    border-color: var(--primary-light);
    transform: translateX(4px);
}

.option:hover::before {
    transform: scaleY(1);
}

.option.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(15, 118, 110, 0.3);
}

.option.selected::before {
    background: white;
    transform: scaleY(1);
}

.option.correct {
    background: var(--success);
    color: white;
    border-color: #059669;
}

.option.wrong {
    background: var(--danger);
    color: white;
    border-color: #dc2626;
}

/* === NAVIGATION BUTTONS === */
.navigation-buttons {
    display: flex;
    gap: 1rem;
}

/* === BUTTONS === */
.btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(15, 118, 110, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(15, 118, 110, 0.4);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #f97316 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

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

.btn-outline:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

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

/* === RESULT PAGE === */
.result-container {
    max-width: 900px;
    margin: 0 auto;
}

.result-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.result-header h2 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--primary);
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 2rem;
}

.score-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 10px 40px rgba(15, 118, 110, 0.3);
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background: white;
}

.score-circle span {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    z-index: 1;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

#scoreText {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.stat-item {
    background: var(--bg-primary);
    padding: 1.75rem;
    border-radius: var(--radius-xl);
    text-align: center;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.stat-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-item.correct {
    border-color: var(--success);
    background: #ecfdf5;
}

.stat-item.wrong {
    border-color: var(--danger);
    background: #fef2f2;
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
}

/* === REVIEW SECTION === */
.review-section {
    margin-bottom: 2.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.review-section.expanded {
    max-height: 10000px;
}

.review-item {
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}

.review-item.correct {
    border-left: 6px solid var(--success);
}

.review-item.wrong {
    border-left: 6px solid var(--danger);
}

.review-question {
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    font-size: 1.0625rem;
}

.review-answer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-size: 0.9375rem;
}

.review-answer div {
    padding: 1rem;
    border-radius: var(--radius-lg);
    font-weight: 500;
}

.review-answer .user-answer {
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

.review-answer .correct-answer {
    background: #ecfdf5;
    color: #065f46;
    border-left: 4px solid var(--success);
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* === MODAL === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-primary);
    border-radius: var(--radius-2xl);
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-2xl);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 2rem;
    border-bottom: 2px solid var(--border);
}

.modal-header h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.modal-body {
    padding: 2rem;
    font-size: 1rem;
    line-height: 1.7;
}

.modal-body p {
    margin-bottom: 1rem;
}

.modal-body .answer-option {
    background: var(--bg-secondary);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    margin-top: 1rem;
    font-weight: 600;
    border-left: 4px solid var(--primary);
}

.modal-body .correct-indicator {
    background: var(--success);
    color: white;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    margin-top: 1rem;
    font-weight: 600;
}

.modal-body .wrong-indicator {
    background: var(--danger);
    color: white;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    margin-top: 1rem;
    font-weight: 600;
}

.modal-footer {
    padding: 1.5rem 2rem 2rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.modal-footer .btn {
    padding: 0.875rem 1.75rem;
    flex: initial;
}

/* === FOOTER === */
.footer {
    background: var(--gray-900);
    color: white;
    text-align: center;
    padding: 2rem;
    font-size: 0.9375rem;
}

.footer p {
    margin: 0;
}

/* === LOADING === */
.loading {
    text-align: center;
    padding: 4rem;
    color: var(--text-secondary);
    font-size: 1.125rem;
    font-weight: 500;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .header {
        padding: 1.5rem 1.25rem;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .main-content {
        padding: 1.5rem;
    }
    
    .welcome-section {
        padding: 1.5rem;
    }
    
    .welcome-section h2 {
        font-size: 1.75rem;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .quiz-header {
        padding: 1.25rem;
    }
    
    .question-card {
        padding: 1.75rem;
    }
    
    .question-text {
        font-size: 1.0625rem;
    }
    
    .option {
        padding: 1.25rem;
        font-size: 0.9375rem;
    }
    
    .navigation-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .score-circle {
        width: 140px;
        height: 140px;
    }
    
    .score-circle span {
        font-size: 2.5rem;
    }
    
    .result-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modal {
        width: 95%;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.25rem;
    }
    
    .logo p {
        font-size: 0.875rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .welcome-section h2 {
        font-size: 1.5rem;
    }
    
    .category-card {
        padding: 1.5rem;
    }
    
    .question-card {
        padding: 1.5rem;
    }
    
    .stat-value {
        font-size: 2rem;
    }
}

/* === PRINT === */
@media print {
    .header, .footer, .navigation-buttons, .result-actions, .modal-overlay {
        display: none;
    }
    
    .container {
        box-shadow: none;
    }
    
    .main-content {
        padding: 0;
    }
}
