
:root {
    /* Light Mode Variables */
    --bg-color: #f0f4f8;
    --card-bg: #ffffff;
    --primary-color: #4a90e2; 
    --primary-hover: #357ABD;
    --text-color: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    
    /* VAK Colors */
    --vis-color: #4a90e2;
    --aud-color: #2ecc71;
    --kin-color: #e74c3c;
    
    --btn-bg: #4a90e2;
    --btn-text: #ffffff;
    --btn-secondary-bg: #f1f5f9;
    --btn-secondary-text: #475569;
    
    --input-bg: #f8fafc;
    --answer-bg: #ffffff;
    --answer-hover: #f1f5f9;
    --answer-selected-bg: #e7f3ff;
    --answer-selected-border: #4a90e2;

    --explanation-bg: #f7f9fc;
    
    --border-radius: 16px; 
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    /* Dark Mode Variables */
    --bg-color: #0f172a; 
    --card-bg: #1e293b; 
    
    --primary-color: #22d3ee; 
    --primary-hover: #06b6d4; 
    
    --text-color: #f1f5f9; 
    --text-muted: #94a3b8; 
    --border-color: #334155; 
    
    --btn-bg: #06b6d4; 
    --btn-text: #0f172a;
    --btn-secondary-bg: #334155; 
    --btn-secondary-text: #f1f5f9;

    --input-bg: #0f172a;
    --answer-bg: #334155; 
    --answer-hover: #475569; 
    --answer-selected-bg: #0e7490; 
    --answer-selected-border: #22d3ee;

    --explanation-bg: #0f172a; 
}

/* Global Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    transition: background-color var(--transition), color var(--transition);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 40px;
}

#root {
    width: 100%;
    max-width: 600px;
    padding: 20px;
}

/* Header & Theme Toggle */
.app-header {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.theme-toggle {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    cursor: pointer;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.theme-toggle:active { transform: scale(0.9); }

/* Main Container */
.container {
    width: 100%;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 2.5rem;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    transition: background-color var(--transition);
}

/* Admin Access Button (Floating) */
.admin-access-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    background: var(--card-bg);
    color: var(--text-muted);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    opacity: 0.6;
    border: 1px solid var(--border-color);
}

.admin-access-btn:hover {
    opacity: 1;
    color: var(--primary-color);
    transform: scale(1.1);
}

/* Splash & Quiz Layout */
.splash-content, .quiz-container {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Inputs */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.name-input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-color);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.name-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.1);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 1.1rem;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    background-color: var(--btn-bg);
    color: var(--btn-text);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    opacity: 0.9;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.secondary {
    background-color: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
}

/* Quiz UI */
#progress-container { margin-bottom: 2rem; }
#progress-text { font-size: 0.8rem; font-weight: 600; color: var(--primary-color); margin-bottom: 0.5rem; text-transform: uppercase; }
#progress-bar-full { width: 100%; height: 8px; background: var(--border-color); border-radius: 10px; overflow: hidden; }
#progress-bar { height: 100%; background: var(--primary-color); transition: width 0.3s; }

#question-text { font-size: 1.25rem; font-weight: 600; margin-bottom: 2rem; line-height: 1.5; text-align: left; }
.answer-grid { display: flex; flex-direction: column; gap: 0.8rem; }
.answer-btn { 
    text-align: left; padding: 1.1rem; border-radius: 12px; 
    background: var(--answer-bg); border: 2px solid var(--border-color);
    color: var(--text-color); cursor: pointer; transition: 0.2s; font-family: inherit;
}
.answer-btn:hover { border-color: var(--primary-color); }
.answer-btn.selected { background: var(--answer-selected-bg); border-color: var(--answer-selected-border); font-weight: 600; }

/* Auto-Advance Highlight */
.answer-btn.just-selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: var(--btn-text);
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Fixed Navigation at Bottom */
.quiz-nav-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 950;
    display: flex;
    justify-content: center;
    padding: 40px 20px 30px 20px;
    background: linear-gradient(0deg, var(--bg-color) 60%, transparent);
    pointer-events: none; /* Allow clicks to pass through transparent parts */
}

.quiz-nav-fixed > * {
    pointer-events: auto; /* Re-enable clicks for the button */
    width: 100%;
    max-width: 600px;
}

.quiz-footer { margin-top: auto; padding-top: 0; }
.footer-actions { display: flex; gap: 1rem; width: 100%; justify-content: center; }
.nav-btn { flex: 1; max-width: 300px; box-shadow: var(--shadow); }

/* Review Component Styling */
.review-container { display: flex; flex-direction: column; flex: 1; }
.review-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; }
.review-item { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 1rem; background: var(--input-bg); border: 1px solid var(--border-color); 
    border-radius: 12px; gap: 1rem;
}
.review-info { flex: 1; }
.review-question { font-size: 0.75rem; font-weight: 600; color: var(--primary-color); text-transform: uppercase; margin-bottom: 0.2rem; }
.review-answer-text { font-size: 0.9rem; line-height: 1.4; color: var(--text-color); }
.btn-edit { 
    background: var(--btn-secondary-bg); color: var(--btn-secondary-text); 
    border: none; padding: 0.5rem 0.8rem; border-radius: 8px; font-size: 0.75rem; 
    font-weight: 600; cursor: pointer; white-space: nowrap;
}

/* Results Styling */
.results-wrapper { text-align: left; }
.results-header { text-align: center; margin-bottom: 2rem; }
.dominant-result-card {
    background: linear-gradient(135deg, var(--primary-color), var(--vis-color));
    color: white; padding: 2rem; border-radius: 16px; text-align: center; margin-bottom: 2rem;
}
.dominant-value { font-size: 2rem; font-weight: 800; margin-top: 0.5rem; }

.stats-section { background: var(--explanation-bg); padding: 1.5rem; border-radius: 16px; margin-bottom: 2rem; }
.stat-row { margin-bottom: 1rem; }
.stat-info { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 0.4rem; font-size: 0.9rem; }
.stat-bar-bg { width: 100%; height: 10px; background: var(--border-color); border-radius: 10px; }
.stat-bar { height: 100%; border-radius: 10px; }
.stat-bar.visual { background: var(--vis-color); }
.stat-bar.auditory { background: var(--aud-color); }
.stat-bar.kinesthetic { background: var(--kin-color); }

.style-detail-card { 
    background: var(--card-bg); border: 1px solid var(--border-color); 
    padding: 1.5rem; border-radius: 16px; margin-bottom: 1.5rem; 
}
.style-detail-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.style-icon { font-size: 2rem; }
.style-content h5 { margin: 1rem 0 0.5rem; font-size: 0.9rem; color: var(--primary-color); text-transform: uppercase; }
.style-content ul { list-style: none; padding-left: 0; }
.style-content li { font-size: 0.9rem; margin-bottom: 0.5rem; padding-left: 1.5rem; position: relative; }
.style-content li::before { content: "•"; position: absolute; left: 0; color: var(--primary-color); font-weight: bold; }

#results-actions { display: flex; gap: 1rem; margin-top: 2rem; }

/* Animations */
@keyframes fill-bar {
  from { width: 0; }
  to { width: var(--target-width); }
}

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

@keyframes scale-bounce {
  0% { transform: scale(0.9); opacity: 0; }
  70% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes rotate-spinner {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-reveal {
  opacity: 0;
  animation: reveal-up 0.6s ease-out forwards;
}

.animate-bounce-in {
  opacity: 0;
  animation: scale-bounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.stat-bar.animate-fill {
  animation: fill-bar 1.5s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

/* OVERRIDES FOR CAPTURING (html2canvas) */
.is-capturing .animate-reveal,
.is-capturing .animate-bounce-in {
  opacity: 1 !important;
  animation: none !important;
  transform: none !important;
}

.is-capturing .stat-bar.animate-fill {
  animation: none !important;
  width: var(--target-width) !important;
}

/* Processing Screen Spinner */
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: rotate-spinner 1s linear infinite;
  margin: 0 auto 20px;
}

/* Admin Specific Mobile Enhancements */
.admin-card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.admin-card {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-card:active {
    transform: scale(0.98);
}

.admin-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.admin-card-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-color);
}

.admin-card-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.admin-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-card-org {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
}

.admin-card-scores {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    background: var(--card-bg);
    padding: 8px 12px;
    border-radius: 8px;
    margin: 4px 0;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.admin-card-dominant {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.admin-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.admin-desktop-only {
    display: block; /* Changed from table-row to block to wrap the table correctly */
}

.admin-mobile-only {
    display: none;
}

@media (max-width: 640px) {
    .container { padding: 1.5rem; min-height: auto; }
    .title { font-size: 1.5rem; }
    #results-actions { flex-direction: column; }
    .review-item { padding: 0.8rem; }
    
    .admin-desktop-only {
        display: none !important;
    }
    
    .admin-mobile-only {
        display: flex !important;
    }
}
