/* 
 * WP Question Bank - Test Engine Split-Screen UI
 * Premium Glassmorphism Design
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --qb-bg: #f1f5f9;
    --qb-surface: #ffffff;
    --qb-surface-glass: rgba(255, 255, 255, 0.85);
    
    --qb-primary: #005b9f;
    --qb-primary-hover: #00457a;
    --qb-primary-light: #e6f0f7;
    
    --qb-success: #10b981;
    --qb-success-hover: #059669;
    --qb-success-light: #d1fae5;
    
    --qb-warning: #eab308;
    --qb-warning-hover: #ca8a04;
    
    --qb-text: #1e293b;
    --qb-text-light: #64748b;
    --qb-text-lighter: #94a3b8;
    
    --qb-border: #e2e8f0;
    --qb-border-focus: #c7d2fe;
    
    --qb-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --qb-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --qb-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --qb-shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    
    --qb-radius: 12px;
    --qb-radius-lg: 20px;
    --qb-radius-full: 9999px;
    
    --qb-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background-color: var(--qb-bg);
}

.qb-test-engine-wrapper {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--qb-text);
    background-color: var(--qb-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.qb-test-engine-wrapper * {
    box-sizing: border-box;
}

/* --- Top Bar (ANBK Style) --- */
.qb-topbar {
    background: var(--qb-primary);
    border-bottom: 3px solid var(--qb-warning);
    box-shadow: var(--qb-shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.qb-topbar-brand h1 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qb-student-info {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
}
.qb-student-info small {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.8;
}

.qb-timer {
    background: transparent;
    padding: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qb-timer.urgent {
    color: #ef4444;
    border-color: #fecaca;
    background: #fef2f2;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .7; }
}

.qb-btn {
    appearance: none;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--qb-radius);
    transition: var(--qb-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.qb-btn-primary {
    background: var(--qb-primary);
    color: white;
    border: 1px solid var(--qb-primary-hover);
}

.qb-btn-primary:hover {
    background: var(--qb-primary-hover);
}

.qb-btn-warning {
    background: var(--qb-warning);
    color: white;
    border: 1px solid var(--qb-warning-hover);
}

.qb-btn-warning:hover {
    background: var(--qb-warning-hover);
}

.qb-btn-outline {
    background: var(--qb-surface);
    border: 1px solid var(--qb-text-lighter);
    color: var(--qb-text);
}

.qb-btn-outline:hover {
    background: var(--qb-bg);
}

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

/* --- Main Body ANBK --- */
.qb-main-body {
    flex: 1;
    background-color: #f1f5f9;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow-y: auto;
    height: calc(100vh - 73px);
}

.qb-anbk-card {
    background: white;
    width: 100%;
    max-width: 1400px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    overflow: hidden;
}

.qb-anbk-card-header {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.qb-question-number-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.qb-anbk-card-header-left {
    display: flex;
    flex-direction: column;
}

.qb-anbk-card-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.qb-btn-info {
    background: #005b9f;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
}

.qb-timer-badge {
    background: transparent;
    color: #333;
    border: 1px solid #ccc;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}
.qb-timer-badge.urgent {
    color: red;
    border-color: red;
}

.qb-btn-daftar-soal {
    background: #007bff;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.qb-subject-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 5px;
}

/* Card Body */
.qb-anbk-card-body {
    display: flex;
    padding: 20px;
    min-height: 400px;
}

.qb-anbk-half-left {
    width: 50%;
    padding-right: 20px;
    border-right: 2px dashed #ccc;
    font-size: 1.05rem;
    line-height: 1.6;
}

.qb-anbk-half-right {
    width: 50%;
    padding-left: 20px;
}

.qb-anbk-full {
    width: 100%;
}

/* Options */
.qb-option-card-anbk {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    cursor: pointer;
}
.qb-option-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    background: white;
    flex-shrink: 0;
    margin-top: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qb-option-card-anbk.selected .qb-option-checkbox {
    border-color: #005b9f;
}
.qb-option-checkbox-inner {
    width: 10px;
    height: 10px;
    background: #005b9f;
}

/* Footer Nav Outside Card */
.qb-anbk-footer-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    width: 100%;
    max-width: 1400px;
    padding-bottom: 40px;
}

.qb-anbk-btn-prev {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
}
.qb-anbk-btn-prev:disabled { opacity: 0.5; cursor: not-allowed; }

.qb-anbk-btn-ragu {
    background: #ffc107;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.qb-anbk-btn-ragu input {
    transform: scale(1.3);
}

.qb-anbk-btn-next {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
}

/* Modal Navigasi Soal */
.qb-nav-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}
.qb-nav-modal {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
}
.qb-nav-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
    margin-bottom: 15px;
}
.qb-grid-item-anbk {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    border: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
}
.qb-grid-item-anbk.answered { background: #333; color: white; border-color: #333; }
.qb-grid-item-anbk.doubtful { background: #ffc107; color: white; border-color: #ffc107; }
.qb-grid-item-anbk.active { border: 2px solid #007bff; box-shadow: inset 0 0 0 2px white; }

/* TKA Font Controls */
.qb-font-controls {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.25rem;
}
.qb-font-btn {
    background: transparent;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    font-weight: 600;
}
.qb-font-btn:hover, .qb-font-btn.active {
    color: var(--qb-primary);
}

/* --- Passage Content --- */
.qb-passage-card {
    background: var(--qb-surface);
    padding: 2rem;
    border-radius: var(--qb-radius-lg);
    box-shadow: var(--qb-shadow);
    border: 1px solid rgba(255,255,255,0.5);
    line-height: 1.7;
    font-size: 1.05rem;
    color: var(--qb-text);
}
.qb-passage-card p {
    margin-bottom: 1.2rem;
}
.qb-passage-card img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

/* --- Question Content --- */
.qb-question-header {
    margin-bottom: 2rem;
}
.qb-question-number {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--qb-primary);
    margin-bottom: 1rem;
    display: inline-block;
    border-bottom: 2px solid var(--qb-warning);
    padding-bottom: 0.2rem;
}
.qb-question-text {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.6;
    color: var(--qb-text);
}
.qb-question-text img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px solid var(--qb-border);
}

/* --- Interactive Options --- */
.qb-options-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 3rem;
}

.qb-option-card {
    background: var(--qb-surface);
    border: 2px solid var(--qb-border);
    border-radius: var(--qb-radius);
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    transition: var(--qb-transition);
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.qb-option-card:hover {
    border-color: var(--qb-border-focus);
    background: #f8fafc;
    transform: translateX(4px);
}

.qb-option-card.selected {
    border-color: var(--qb-primary);
    background: var(--qb-primary-light);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.qb-option-label {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--qb-bg);
    border: 2px solid var(--qb-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--qb-text-light);
    transition: var(--qb-transition);
    flex-shrink: 0;
}

.qb-option-card.selected .qb-option-label {
    background: var(--qb-primary);
    border-color: var(--qb-primary);
    color: white;
}

.qb-option-content {
    flex: 1;
    font-size: 1.05rem;
    line-height: 1.5;
}

/* Option Click Ripple Effect */
.qb-option-card::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(79,70,229,0.1) 0%, transparent 100%);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
    border-radius: 50%;
    pointer-events: none;
}
.qb-option-card:active::after {
    transform: translate(-50%, -50%) scale(2);
    opacity: 1;
    transition: 0s;
}

/* --- Bottom Navigation --- */
.qb-nav-footer {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--qb-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- Question Grid (If no passage) --- */
.qb-grid-container {
    background: var(--qb-surface);
    padding: 1.5rem;
    border-radius: var(--qb-radius-lg);
    box-shadow: var(--qb-shadow);
}
.qb-grid-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--qb-text-light);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.qb-question-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.5rem;
}
.qb-grid-item {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1px solid var(--qb-border);
    background: var(--qb-surface);
    color: var(--qb-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--qb-transition);
}
.qb-grid-item:hover {
    border-color: var(--qb-primary);
    color: var(--qb-primary);
}
.qb-grid-item.answered {
    background: var(--qb-text);
    border-color: var(--qb-text);
    color: white;
}
.qb-grid-item.doubtful {
    background: var(--qb-warning);
    border-color: var(--qb-warning);
    color: white;
}
.qb-grid-item.active {
    border-color: var(--qb-primary);
    box-shadow: 0 0 0 2px var(--qb-primary);
}

/* --- Loader --- */
.qb-loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--qb-bg);
}
.qb-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--qb-border);
    border-top-color: var(--qb-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 992px) {
    .qb-split-layout {
        flex-direction: column;
        overflow: auto;
    }
    .qb-panel-left, .qb-panel-right {
        width: 100%;
        min-width: unset;
        height: auto;
        overflow: visible;
    }
    .qb-panel-left {
        border-right: none;
        border-bottom: 1px solid var(--qb-border);
        padding: 1.5rem;
    }
    .qb-panel-right {
        padding: 1.5rem;
    }
}

/* Ticker Tape */
.qb-ticker-wrap {
    width: 100%;
    overflow: hidden;
    background: #1e293b;
    color: white;
    padding: 12px 0;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
    position: relative;
    z-index: 10;
}
.qb-ticker {
    display: inline-block;
    white-space: nowrap;
    padding-right: 100%;
    box-sizing: content-box;
    animation: ticker 30s linear infinite;
}
.qb-ticker-item {
    display: inline-block;
    padding: 0 50px;
    font-size: 15px;
    font-weight: 500;
}
@keyframes ticker {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

/* Floating Bubbles */
.qb-bubbles-wrap {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}
.qb-bubble {
    position: absolute;
    background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(168,85,247,0.08));
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4f46e5;
    font-weight: bold;
    animation: float 10s infinite ease-in-out;
    box-shadow: 0 10px 20px rgba(0,0,0,0.02);
}
.qb-bubble-1 { width: 150px; height: 150px; left: 5%; top: 10%; animation-delay: 0s; }
.qb-bubble-2 { width: 200px; height: 200px; left: 85%; top: 5%; animation-delay: 2s; }
.qb-bubble-3 { width: 120px; height: 120px; left: 75%; top: 75%; animation-delay: 4s; }
.qb-bubble-4 { width: 180px; height: 180px; left: 15%; top: 65%; animation-delay: 6s; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-30px) rotate(5deg); }
}

/* 3D Flashcard Spaced Repetition */
.qb-flashcard {
    background: transparent;
    width: 100%;
    height: 350px;
    perspective: 1000px;
}
.qb-flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    border-radius: 24px;
}
.qb-flashcard.flipped .qb-flashcard-inner {
    transform: rotateY(180deg);
}
.qb-flashcard-front, .qb-flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden; /* Safari */
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    border-radius: 24px;
    border: 2px solid #e2e8f0;
}
.qb-flashcard-front {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
}
.qb-flashcard-back {
    transform: rotateY(180deg);
    background: #ffffff;
    align-items: flex-start;
    text-align: left;
}

/* 3D Utility Classes for VocabSwipe */
.perspective-1000 {
    perspective: 1000px;
}
.transform-style-3d {
    transform-style: preserve-3d;
}
.backface-hidden {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.rotate-y-180 {
    transform: rotateY(180deg);
}
