/* 
 * 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: #4f46e5;
    --qb-primary-hover: #4338ca;
    --qb-primary-light: #e0e7ff;
    
    --qb-success: #10b981;
    --qb-success-hover: #059669;
    --qb-success-light: #d1fae5;
    
    --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;
}

/* --- Glassmorphism Top Bar --- */
.qb-topbar {
    background: var(--qb-surface-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--qb-shadow-glass);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.qb-topbar-brand h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--qb-primary);
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qb-timer {
    background: var(--qb-surface);
    border: 1px solid var(--qb-border);
    padding: 0.5rem 1rem;
    border-radius: var(--qb-radius-full);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--qb-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--qb-shadow-sm);
}

.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;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
}

.qb-btn-primary:hover {
    background: var(--qb-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.4);
}

.qb-btn-success {
    background: var(--qb-success);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
}

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

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

.qb-btn-outline:hover {
    background: var(--qb-bg);
    border-color: var(--qb-text-lighter);
}

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

/* --- Main Split-Screen Layout --- */
.qb-split-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - 73px); /* 100vh minus topbar height */
}

/* Left Panel (Passage / Grid) */
.qb-panel-left {
    width: 40%;
    min-width: 350px;
    background: var(--qb-bg);
    border-right: 1px solid var(--qb-border);
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}

/* Right Panel (Question) */
.qb-panel-right {
    width: 60%;
    background: var(--qb-surface);
    overflow-y: auto;
    padding: 2rem 3rem;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Scrollbar styling */
.qb-split-layout ::-webkit-scrollbar {
    width: 8px;
}
.qb-split-layout ::-webkit-scrollbar-track {
    background: transparent;
}
.qb-split-layout ::-webkit-scrollbar-thumb {
    background-color: var(--qb-border);
    border-radius: 20px;
}
.qb-split-layout ::-webkit-scrollbar-thumb:hover {
    background-color: var(--qb-text-lighter);
}

/* --- 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: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--qb-primary);
    margin-bottom: 0.5rem;
    display: block;
}
.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-success-light);
    border-color: var(--qb-success);
    color: var(--qb-success-hover);
}
.qb-grid-item.active {
    background: var(--qb-primary);
    border-color: var(--qb-primary);
    color: white;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

/* --- 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;
    }
}
