/* Force light mode as default, override system preferences */
:root {
  --body-bg: linear-gradient(to bottom, #f8f9fa, #e9ecef);
  --body-color: #000000;
  --navbar-bg: #f8f9fa;
  --feature-card-bg: rgba(255, 255, 255, 0.9);
  --feature-card-text: #000000;
  --shape-bg: linear-gradient(135deg, #0095d5, #00c4ff);
  --shape-shadow: 0 0 20px rgba(0, 149, 213, 0.5);
  --hero-shape-bg: linear-gradient(135deg, #0095d5, #00c4ff);
  --hero-shape-shadow: 0 0 20px rgba(0, 149, 213, 0.5);
  --bolt-list-bg: #fff;
  --bolt-list-border: #ddd;
  --list-group-bg: #fff;
  --list-group-border: #dee2e6;
  --list-group-item-bg: #fff;
  
  /* Override system color scheme preferences */
  color-scheme: light;
}

/* Ensure our manual dark mode takes precedence over system preferences */
html:not(.dark-mode) {
  color-scheme: light !important;
}

html.dark-mode {
  --body-bg: linear-gradient(to bottom, #121212, #1e1e1e);
  --body-color: #d1d1d1;
  --navbar-bg: #333333;
  --feature-card-bg: #2c2c2c;
  --feature-card-text: #d1d1d1;
  --shape-bg: linear-gradient(135deg, #bb86fc, #6200ea);
  --shape-shadow: 0 0 20px rgba(187, 134, 252, 0.5);
  --hero-shape-bg: linear-gradient(135deg, #bb86fc, #6200ea);
  --hero-shape-shadow: 0 0 20px rgba(187, 134, 252, 0.5);
  --bolt-list-bg: #1e1e1e;
  --bolt-list-border: #444;
  --list-group-bg: #2c2c2c;
  --list-group-border: #444;
  --list-group-item-bg: #3a3a3a;
  
  /* Explicitly set dark color scheme when in dark mode */
  color-scheme: dark;
}

/* Updated body styles with background image */
body {
  margin: 0;
  padding: 0;
  background-image: url('/img/background.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-color: #f8f9fa; /* Fallback color */
  color: var(--body-color);
  font-family: 'Poppins', sans-serif;
  line-height: 1.6;
}

/* Background wrapper and overlay for all pages */
.background-wrapper {
  position: relative;
  min-height: 100vh;
}

.background-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.7);
  z-index: 1;
  pointer-events: none; /* Prevent overlay from capturing clicks */
}

html.dark-mode .background-overlay {
  background: rgba(0, 0, 0, 0.7);
}

/* Disable background overlay on Login, Register, and Password Reset pages */
body.page-login .background-overlay,
body.page-register .background-overlay,
body.page-forgot-password .background-overlay,
body.page-reset-password .background-overlay {
  display: none !important;
}

.container, .container * {
  position: relative;
  z-index: 2;
}

/* Adjust text colors for better contrast over background image */
h1, h2, .lead {
  color: #333;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
}

html.dark-mode h1,
html.dark-mode h2,
html.dark-mode .lead {
  color: #e0e0e0;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}

/* Navbar styles */
.navbar, footer {
  background-color: var(--navbar-bg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar.sticky {
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-link {
  position: relative;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: #0095d5;
}

.nav-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -5px;
  left: 0;
  background-color: #0095d5;
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* Dark mode navbar fixes */
html.dark-mode .navbar .navbar-brand,
html.dark-mode .navbar .nav-link {
  color: #d1d1d1 !important; /* Ensure menu items and brand are light in dark mode */
}

html.dark-mode .navbar .nav-link:hover {
  color: #bb86fc !important;
}

html.dark-mode .navbar .nav-link::after {
  background-color: #bb86fc !important;
}

/* Feature card styles */
.feature-card {
  background: var(--feature-card-bg);
  border-radius: 15px;
  padding: 20px;
  transition: transform 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Ensure feature card text, including h5.card-title, is readable in dark mode */
.feature-card h3,
.feature-card h5.card-title,
.feature-card p {
  color: var(--feature-card-text);
}

html.dark-mode .feature-card h5.card-title,
html.dark-mode .feature-card .card-text {
  color: var(--feature-card-text) !important;
}

/* General styles */
h1, h2 {
  font-weight: 600;
  letter-spacing: 1px;
}

.shape-container {
  position: relative;
  min-height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.shape {
  width: 100px;
  height: 100px;
  background: var(--shape-bg);
  transition: all 0.3s ease;
  box-shadow: var(--shape-shadow);
}

.circle {
  border-radius: 50%;
}

.hidden {
  display: none !important;
}

.fullscreen-mode {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--body-bg);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.hero-shape {
  width: 150px;
  height: 150px;
  background: var(--hero-shape-bg);
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: var(--hero-shape-shadow);
  animation: pulse 4s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

body.dark-mode {
  color: var(--body-color);
}

.navbar.dark-mode, footer.dark-mode {
  background-color: var(--navbar-bg);
}

.shape.dark-mode {
  background: var(--shape-bg);
  box-shadow: var(--shape-shadow);
}

.fullscreen-mode.dark-mode {
  background: var(--body-bg);
}

.hero-shape.dark-mode {
  background: var(--hero-shape-bg);
  box-shadow: var(--hero-shape-shadow);
}

.bolt-list.dark-mode {
  background-color: var(--bolt-list-bg);
  border-color: var(--bolt-list-border);
}

.bolt-item.dark-mode {
  background: #3a3a3a !important;
  color: #ffffff !important;
}

.dark-mode .list-group {
  background-color: var(--list-group-bg);
  border-color: var(--list-group-border);
}

.dark-mode .list-group-item {
  background-color: var(--list-group-item-bg);
  color: #ffffff !important;
  border-color: var(--list-group-border);
}

.dark-mode #recentSessions {
  background-color: var(--list-group-bg);
}

body.dark-mode .container #features .feature-card {
  background: var(--feature-card-bg);
  color: #d1d1d1 !important;
  box-shadow: 0 4px 15px rgba(44, 44, 44, 0.5) !important;
}

body.dark-mode .container #features .feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(44, 44, 44, 0.7) !important;
}

body.dark-mode .container #features .feature-card .text-primary {
  color: #bb86fc !important;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(90deg, #0095d5, #00c4ff);
  border: none;
  border-radius: 25px;
  padding: 10px 20px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 149, 213, 0.4);
}

.btn-info {
  background: linear-gradient(90deg, #6b7280, #9ca3af);
  border: none;
  border-radius: 25px;
  padding: 10px 20px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  color: white;
}

.btn-info:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(107, 114, 128, 0.4);
  background: linear-gradient(90deg, #4b5563, #7c8694);
}

.dark-mode .btn-info {
  background: linear-gradient(90deg, #4b5563, #7c8694);
}

.dark-mode .btn-info:hover {
  background: linear-gradient(90deg, #374151, #5e6876);
  box-shadow: 0 4px 15px rgba(75, 85, 99, 0.4);
}

.btn-secondary {
  background: linear-gradient(90deg, #6c757d, #adb5bd);
  border-radius: 25px;
  padding: 10px 20px;
  transition: transform 0.3s ease;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
}

.btn-dark-mode {
  background-color: #333333;
  color: #f1f1f1;
  border: none;
  border-radius: 25px;
  padding: 10px 20px;
  transition: all 0.3s ease;
}

.btn-dark-mode:hover {
  background-color: #bb86fc;
  color: #121212;
}

.btn-dark-mode.active {
  background-color: #bb86fc;
  color: #121212;
}

/* Hide dark mode button in PWA mode */
.pwa-mode .btn-dark-mode,
.pwa-mode #darkModeToggle {
  display: none !important;
}

#shapeSelection {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#shapeSelection:focus {
  border-color: #0095d5;
  box-shadow: 0 0 8px rgba(0, 149, 213, 0.3);
}

.bolt-list {
  margin-top: 20px;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--bolt-list-border);
  border-radius: 5px;
  padding: 10px;
  background-color: var(--bolt-list-bg);
}

.bolt-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
}

.bolt-item input {
  width: 60px;
  margin-right: 10px;
}

.btn-copy {
  background: linear-gradient(90deg, #28a745, #34ce57);
  border: none;
  border-radius: 25px;
  padding: 8px 15px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-copy:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

/* Mobile Responsiveness */
@media (max-width: 767px) {
  .col-md-6 {
    margin-bottom: 2rem;
  }
  .shape-container {
    min-height: 150px;
  }
  h1 {
    font-size: 1.75rem;
  }
  .display-4 {
    font-size: 2.5rem;
  }
  p {
    font-size: 0.9rem;
  }
  .hero-shape {
    width: 100px;
    height: 100px;
  }
}

/* Tooltip styling */
.tooltip-inner {
  background-color: rgba(0, 149, 213, 0.9);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: 10px;
}

.tooltip.bs-tooltip-top .tooltip-arrow::before {
  border-top-color: rgba(0, 149, 213, 0.9);
}

.tooltip.bs-tooltip-bottom .tooltip-arrow::before {
  border-bottom-color: rgba(0, 149, 213, 0.9);
}

.tooltip.bs-tooltip-left .tooltip-arrow::before {
  border-left-color: rgba(0, 149, 213, 0.9);
}

.tooltip.bs-tooltip-right .tooltip-arrow::before {
  border-right-color: rgba(0, 149, 213, 0.9);
}

.dark-mode .tooltip-inner {
  background-color: rgba(187, 134, 252, 0.9);
}

.dark-mode .tooltip.bs-tooltip-top .tooltip-arrow::before {
  border-top-color: rgba(187, 134, 252, 0.9);
}

.dark-mode .tooltip.bs-tooltip-bottom .tooltip-arrow::before {
  border-bottom-color: rgba(187, 134, 252, 0.9);
}

.dark-mode .tooltip.bs-tooltip-left .tooltip-arrow::before {
  border-left-color: rgba(187, 134, 252, 0.9);
}

.dark-mode .tooltip.bs-tooltip-right .tooltip-arrow::before {
  border-right-color: rgba(187, 134, 252, 0.9);
}

/* Center the hero-shape on all screen sizes */
.hero-shape-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* Ensure the hero-shape remains centered on mobile */
@media (max-width: 767px) {
  .hero-shape-wrapper {
    margin: 0 auto;
  }
}

/* Stopwatch display styling */
#stopwatch {
  font-family: 'Courier New', Courier, monospace;
  display: block;
  width: 150px;
  margin: 0 auto;
  text-align: center;
  padding: 0;
  line-height: 1;
}

/* Streak Display Styling */
.streak-container {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(90deg, #ff6f61, #ff9f80);
  color: #fff;
  padding: 8px 16px;
  border-radius: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-top: 10px;
}

html.dark-mode .streak-container {
  background: linear-gradient(90deg, #ff4d4d, #ff8080);
  box-shadow: 0 2px 10px rgba(255, 77, 77, 0.3);
}

.streak-container strong {
  font-size: 1.2rem;
  margin-right: 8px;
}

.streak-container span.emoji {
  font-size: 1.5rem;
}

/* Dark mode styles for footer and Bootstrap text classes */
html.dark-mode .text-muted {
  color: #c0c0c0 !important;
}

html.dark-mode .link-secondary {
  color: #adb5bd !important;
}

html.dark-mode .link-secondary:hover {
  color: #dee2e6 !important;
}

/* Notification System Styles */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  max-width: 400px;
  pointer-events: none;
}

.notification {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-bottom: 10px;
  overflow: hidden;
  pointer-events: all;
  transform: translateX(100%);
  animation: slideInRight 0.3s ease-out forwards;
  backdrop-filter: blur(10px);
  border-left: 4px solid #4A90E2;
}

.notification.notification-success {
  border-left-color: #28a745;
}

.notification.notification-error {
  border-left-color: #dc3545;
}

.notification.notification-warning {
  border-left-color: #ffc107;
}

.notification.notification-achievement {
  border-left-color: #ffd700;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 165, 0, 0.05));
}

.notification-content {
  display: flex;
  align-items: flex-start;
  padding: 12px 16px;
  position: relative;
}

.notification-message {
  flex: 1;
  color: #333;
  font-size: 14px;
  line-height: 1.4;
  margin-right: 10px;
}

.notification-close {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  line-height: 1;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.notification-close:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

/* Dark mode notification styles */
html.dark-mode .notification {
  background: rgba(44, 44, 44, 0.95);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

html.dark-mode .notification-message {
  color: #e0e0e0;
}

html.dark-mode .notification-close {
  color: #ccc;
}

html.dark-mode .notification-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

html.dark-mode .notification.notification-achievement {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.1));
}

/* Notification animations */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.notification.removing {
  animation: slideOutRight 0.3s ease-in forwards;
}

/* Notification status indicators */
.notification-status {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  display: inline-block;
}

.notification-status.enabled {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.notification-status.disabled {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

html.dark-mode .notification-status.enabled {
  background-color: #1e3a26;
  color: #75b798;
  border: 1px solid #2d5a37;
}

html.dark-mode .notification-status.disabled {
  background-color: #3a1e20;
  color: #f8a8ac;
  border: 1px solid #5a2d30;
}

/* Mobile responsiveness for notifications */
@media (max-width: 768px) {
  .notification-container {
    left: 10px;
    right: 10px;
    top: 10px;
    max-width: none;
  }
  
  .notification {
    transform: translateY(-100%);
    animation: slideInDown 0.3s ease-out forwards;
  }
  
  .notification.removing {
    animation: slideOutUp 0.3s ease-in forwards;
  }
  
  @keyframes slideInDown {
    from {
      transform: translateY(-100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  
  @keyframes slideOutUp {
    from {
      transform: translateY(0);
      opacity: 1;
    }
    to {
      transform: translateY(-100%);
      opacity: 0;
    }
  }
}