/* Viqtorina – production-style overrides, mobile-first */

:root {
  --viq-bg-blue: #7eb8da;
  --viq-bg-blue-dark: #5a9fc9;
  --viq-card-bg: #ffffff;
  --viq-card-radius: 12px;
  --viq-card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --viq-sidebar-active-bg: #e3f2fd;
  --viq-sidebar-active-text: #1565c0;
  --viq-nav-active: #1976d2;
  --viq-btn-google: #4285f4;
  --viq-progress-fill: #4caf50;
  --viq-answer-blue: #2196f3;
  --viq-answer-green: #4caf50;
  --viq-answer-orange: #ff9800;
  --viq-answer-neutral: #e0e0e0;
  --viq-touch-min: 44px;
}

/* Prevent horizontal scroll on mobile */
html {
  overflow-x: hidden;
}

body {
  background: linear-gradient(135deg, #a8d4ee 0%, #7eb8da 50%, #5a9fc9 100%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(30deg, transparent 40%, rgba(255,255,255,0.06) 40%, rgba(255,255,255,0.06) 60%, transparent 60%),
    linear-gradient(-30deg, transparent 40%, rgba(255,255,255,0.04) 40%, rgba(255,255,255,0.04) 60%, transparent 60%);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* Sparkle accents */
body::after {
  content: "✦";
  position: fixed;
  bottom: 15%;
  right: 10%;
  font-size: 1.2rem;
  color: rgba(255,255,255,0.6);
  pointer-events: none;
  z-index: 0;
}

/* Main content above background – prevent overflow on mobile */
.container-fluid {
  position: relative;
  z-index: 1;
  max-width: 100%;
}

/* Header above main content so dropdown is never hidden */
header {
  position: relative;
  z-index: 1030;
}

/* Ensure dropdown menu stays above content */
.navbar .dropdown-menu {
  z-index: 1035;
}

header .navbar {
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom: none;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border-radius: 0 0 var(--viq-card-radius) var(--viq-card-radius);
  margin-bottom: 0.75rem !important;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

@media (min-width: 768px) {
  header .navbar {
    margin-bottom: 1.5rem !important;
  }
}

/* Dropdown menu above all content */
.navbar .dropdown-menu {
  z-index: 1060;
  border-radius: var(--viq-card-radius);
  box-shadow: var(--viq-card-shadow);
  border: none;
  padding: 0.5rem;
}

.navbar-brand {
  font-weight: 700;
  color: #333 !important;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.navbar-brand .viq-logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: linear-gradient(180deg, #2196f3 0%, #4caf50 40%, #ffc107 70%, #fff 100%);
  border-radius: 6px;
  font-size: 0.9rem;
}

@media (min-width: 576px) {
  .navbar-brand .viq-logo-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
}

.navbar-nav .nav-link {
  color: #555 !important;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid transparent;
}

.navbar-nav .nav-link:hover {
  color: var(--viq-nav-active) !important;
}

.navbar-nav .nav-link.active,
.navbar-nav .nav-item a[href].active {
  color: var(--viq-nav-active) !important;
  border-bottom-color: var(--viq-nav-active);
}

/* Navbar togglers – touch-friendly on mobile */
.navbar-toggler {
  min-width: var(--viq-touch-min);
  min-height: var(--viq-touch-min);
  padding: 0.5rem;
}

/* Google login button – touch-friendly on mobile */
.btn-google {
  background: var(--viq-btn-google);
  color: #fff !important;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: var(--viq-touch-min);
  justify-content: center;
}

@media (min-width: 576px) {
  .btn-google {
    padding: 0.4rem 0.9rem;
    min-height: 0;
  }
}

.btn-google:hover {
  background: #3367d6;
  color: #fff !important;
}

/* Player stats in navbar */
.player-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.75rem;
  background: var(--viq-sidebar-active-bg);
  border-radius: 8px;
  border: 1px solid rgba(21, 101, 192, 0.15);
}

.player-stats-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 80px;
}

.player-stats-level {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--viq-sidebar-active-text);
  line-height: 1.2;
  white-space: nowrap;
}

.player-stats-progress {
  width: 100%;
}

.player-stats-progress-bar {
  height: 4px;
  background: rgba(21, 101, 192, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.player-stats-progress-fill {
  height: 100%;
  background: var(--viq-progress-fill);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.player-stats-points {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}

.player-stats-points-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--viq-nav-active);
}

.player-stats-points-label {
  font-size: 0.6rem;
  color: #666;
  text-transform: uppercase;
}

/* Mobile responsive player stats */
@media (max-width: 576px) {
  .player-stats {
    width: 100%;
    justify-content: space-between;
  }
  
  .player-stats-info {
    min-width: 0;
    flex: 1;
  }
}

/* Sidebar: white card with shadow, fixed width so main can use remaining space */
.sidebar {
  background: var(--viq-card-bg) !important;
  border-radius: var(--viq-card-radius);
  box-shadow: var(--viq-card-shadow);
  border: none !important;
  padding: 1rem 0.5rem !important;
  min-height: 280px;
  min-width: 12rem;
  flex: 0 0 auto;
}

/* Sidebar inside offcanvas (mobile): no min-height, full width */
.sidebar-offcanvas {
  min-height: 0;
  min-width: 0;
  box-shadow: none;
}

.sidebar-offcanvas .nav-link {
  min-height: var(--viq-touch-min);
  display: flex;
  align-items: center;
}

.sidebar .nav-link {
  color: #666 !important;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.sidebar .nav-link:hover {
  background: #f5f5f5;
  color: #333 !important;
}

.sidebar .nav-link.active {
  background: var(--viq-sidebar-active-bg) !important;
  color: var(--viq-sidebar-active-text) !important;
  font-weight: 600;
  border-left: 3px solid var(--viq-sidebar-active-text);
}

.sidebar .nav-link .bi {
  font-size: 1.1rem;
  opacity: 0.85;
}

.sidebar .nav-link.active .bi {
  opacity: 1;
}

/* Main content area – align top with sidebar, full width on mobile */
main {
  padding-left: 0 !important;
  width: 100%;
  max-width: 100%;
}

@media (min-width: 768px) {
  main {
    padding-left: 0.5rem !important;
  }
}

main > *:first-child {
  margin-top: 0;
}

/* Quiz card container – reduced padding on mobile */
.quiz-card {
  background: var(--viq-card-bg);
  border-radius: var(--viq-card-radius);
  box-shadow: var(--viq-card-shadow);
  padding: 1rem;
  position: relative;
  overflow: visible;
}

@media (min-width: 576px) {
  .quiz-card {
    padding: 1.5rem;
  }
}

@media (min-width: 768px) {
  .quiz-card {
    padding: 2rem;
  }
}

.quiz-card .quiz-decor {
  position: absolute;
  font-size: 1.25rem;
  opacity: 0.6;
  pointer-events: none;
}

@media (min-width: 576px) {
  .quiz-card .quiz-decor {
    font-size: 1.75rem;
    opacity: 0.7;
  }
}

@media (min-width: 768px) {
  .quiz-card .quiz-decor {
    font-size: 2rem;
  }
}

.quiz-card .quiz-decor.coin-tl { top: -0.25rem; left: -0.25rem; }
.quiz-card .quiz-decor.coin-bl { bottom: -0.25rem; left: -0.25rem; }
.quiz-card .quiz-decor.trophy-br { bottom: -0.25rem; right: -0.25rem; }
.quiz-card .quiz-decor.q-br { bottom: 40%; right: -0.25rem; }

/* Quiz progress */
.quiz-progress-text {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.quiz-progress-bar {
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.quiz-progress-bar .fill {
  height: 100%;
  background: var(--viq-progress-fill);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Quiz question title – readable on small screens */
.quiz-question-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #222;
  margin-bottom: 1rem;
  line-height: 1.4;
}

@media (min-width: 576px) {
  .quiz-question-title {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
  }
}

@media (min-width: 768px) {
  .quiz-question-title {
    font-size: 1.35rem;
    margin-bottom: 1.5rem;
  }
}

/* Answer grid 2x2 */
.quiz-answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 576px) {
  .quiz-answers {
    grid-template-columns: 1fr;
  }
}

/* Touch-friendly answer buttons (min 44px tap target) */
.quiz-answer-btn {
  display: block;
  width: 100%;
  padding: 0.85rem 0.75rem;
  min-height: var(--viq-touch-min);
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
}

@media (min-width: 576px) {
  .quiz-answer-btn {
    padding: 0.9rem 1rem;
    font-size: 1rem;
    min-height: 0;
  }
}

.quiz-answer-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.quiz-answer-btn.answer-a,
.quiz-answer-btn.answer-b,
.quiz-answer-btn.answer-c,
.quiz-answer-btn.answer-d {
  background: var(--viq-answer-neutral);
  color: #424242;
}

/* Selected state - before submitting */
.quiz-answer-btn:has(.quiz-answer-radio:checked) {
  background: var(--viq-answer-blue) !important;
  color: #fff !important;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.4);
  transform: scale(1.02);
}

/* Result states for answers */
.quiz-answer-btn.correct { background: var(--viq-answer-green) !important; color: #fff !important; }
.quiz-answer-btn.incorrect { background: var(--viq-answer-orange) !important; color: #fff !important; }
.quiz-answer-btn.neutral { background: #e0e0e0 !important; color: #666 !important; }

/* Next button – touch-friendly on mobile */
.quiz-next-btn {
  background: #9e9e9e;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1.5rem;
  min-height: var(--viq-touch-min);
  font-weight: 500;
  width: 100%;
  max-width: 20rem;
}

@media (min-width: 576px) {
  .quiz-next-btn {
    width: auto;
    padding: 0.6rem 2rem;
    min-height: 0;
  }
}

.quiz-next-btn:not(:disabled):hover {
  background: #757575;
  color: #fff;
}

.quiz-next-btn.btn-primary {
  background: var(--viq-answer-blue);
}

.quiz-next-btn.btn-primary:hover {
  background: #1976d2;
  color: #fff;
}

/* Timer and answers row layout */
.quiz-content-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.quiz-content-row .quiz-answers {
  flex: 1;
  margin-bottom: 0;
}

/* Circular timer */
.quiz-timer-circle {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.quiz-timer-circle svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.quiz-timer-circle .timer-bg {
  fill: none;
  stroke: #e0e0e0;
  stroke-width: 8;
}

.quiz-timer-circle .timer-progress {
  fill: none;
  stroke: var(--viq-answer-blue);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}

.quiz-timer-circle .timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--viq-answer-blue);
}

/* Mobile: stack timer above answers */
@media (max-width: 576px) {
  .quiz-content-row {
    flex-direction: column-reverse;
  }
  
  .quiz-timer-circle {
    width: 70px;
    height: 70px;
  }
  
  .quiz-timer-circle .timer-text {
    font-size: 1.25rem;
  }
}

/* Stopped timer state (after answering) */
.quiz-timer-circle.stopped .timer-progress {
  stroke: var(--viq-answer-green);
  transition: none;
}

.quiz-timer-circle.stopped .timer-text {
  color: var(--viq-answer-green);
}

/* Footer – compact on mobile */
.footer {
  background: rgba(255, 255, 255, 0.9);
  border-top: none;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
  color: #555;
  margin-top: 1rem;
  padding: 0.75rem 0;
  font-size: 0.875rem;
}

@media (min-width: 768px) {
  .footer {
    margin-top: 2rem;
    padding: 1rem 0;
    font-size: 1rem;
  }
}

/* Responsive tables – horizontal scroll on mobile */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-left: -0.25rem;
  margin-right: -0.25rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

@media (min-width: 768px) {
  .table-responsive {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }
}

/* Cards on other pages – responsive padding */
.content-card {
  background: var(--viq-card-bg);
  border-radius: var(--viq-card-radius);
  box-shadow: var(--viq-card-shadow);
  padding: 1rem;
}

@media (min-width: 576px) {
  .content-card {
    padding: 1.5rem;
  }
}

@media (min-width: 768px) {
  .content-card {
    padding: 2rem;
  }
}

/* List group overrides when used inside quiz (result list) */
.quiz-card .list-group-item {
  border-radius: 8px;
  margin-bottom: 0.35rem;
}

/* Profile page styles */
.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--viq-answer-blue);
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.25);
}

.profile-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--viq-answer-blue), var(--viq-bg-blue-dark));
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--viq-answer-blue);
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.25);
}

.profile-name {
  font-size: 1.75rem;
  font-weight: 600;
  color: #333;
}

.profile-stat-card {
  background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
  border-radius: var(--viq-card-radius);
}

.profile-stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--viq-answer-blue);
}

.profile-stat-label {
  font-size: 0.9rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-level-card {
  background: #f8f9fa;
  border-radius: var(--viq-card-radius);
}

.profile-level-name {
  font-weight: 600;
  color: var(--viq-sidebar-active-text);
}

.profile-level-points {
  font-size: 0.85rem;
  color: #666;
}

.profile-progress-bar {
  height: 12px;
  background: #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
}

.profile-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--viq-answer-blue), var(--viq-answer-green));
  border-radius: 6px;
  transition: width 0.3s ease;
}

.profile-skills h4 {
  color: #333;
  font-weight: 600;
}

.chart-container {
  position: relative;
  max-width: 400px;
  margin: 0 auto;
}

.profile-stats-inline {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.profile-stat-inline {
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
  border-radius: var(--viq-card-radius);
}

.profile-stat-inline .profile-stat-value {
  font-size: 1.5rem;
}

.profile-level-inline {
  min-width: 150px;
  padding: 0.5rem 1rem;
  background: #f8f9fa;
  border-radius: var(--viq-card-radius);
}

@media (max-width: 576px) {
  .profile-avatar,
  .profile-avatar-placeholder {
    width: 100px;
    height: 100px;
    font-size: 2.5rem;
  }

  .profile-name {
    font-size: 1.5rem;
    margin: 1rem 0 !important;
  }

  .profile-stat-value {
    font-size: 2rem;
  }

  .chart-container {
    max-width: 300px;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
  }

  .profile-stats-inline {
    width: 100%;
    justify-content: center;
    margin-top: 1rem;
  }
}

/* Rating Submenu Styles */
.sidebar .nav-link .bi-chevron-down {
  transition: transform 0.2s;
}

.sidebar .nav-link .bi-chevron-down.rotate-180 {
  transform: rotate(180deg);
}

.sidebar .nav-item > ul .nav-link {
  padding-top: 0.375rem;
  padding-bottom: 0.375rem;
  font-size: 0.9rem;
}

/* Ensure modals always appear above header/offcanvas/background */
.modal {
  z-index: 1055;
}

.modal-backdrop {
  z-index: 1050;
}

/* Ensure offcanvas menu overlays main content on mobile */
.offcanvas {
  z-index: 1045;
}

.offcanvas-backdrop {
  z-index: 1040;
}
