/* CSS DESIGN SYSTEM & TOKENS */
:root {
  /* Colors */
  --bg-primary: #070a13;
  --bg-secondary: #0f1424;
  --card-bg: rgba(18, 24, 43, 0.7);
  --card-border: rgba(255, 255, 255, 0.06);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  /* Feature Colors */
  --prayers-color: #f59e0b; /* Gold/Amber */
  --routines-color: #10b981; /* Emerald */
  --tasks-color: #3b82f6; /* Blue */
  --expenses-color: #ec4899; /* Pink */
  
  /* System Colors */
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  
  /* Glassmorphism */
  --glass-bg: rgba(15, 22, 42, 0.65);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glass-blur: blur(12px);
  
  /* Fonts */
  --font-main: 'Outfit', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Active theme dynamic overrides */
  --active-accent: var(--prayers-color);
  --active-accent-rgb: 245, 158, 11;
}

/* RESET & BASE STYLES */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* APP SHELL */
.app-shell {
  width: 100%;
  max-width: 500px; /* Centered mobile layout on desktop */
  height: 100%;
  background: radial-gradient(circle at top right, rgba(16, 24, 48, 0.8), var(--bg-primary) 70%),
              radial-gradient(circle at bottom left, rgba(10, 18, 38, 0.9), var(--bg-primary) 80%);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border-left: 1px solid rgba(255, 255, 255, 0.03);
  border-right: 1px solid rgba(255, 255, 255, 0.03);
}

/* APP HEADER */
.app-header {
  height: 70px;
  min-height: 70px;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  z-index: 10;
  background: rgba(7, 10, 19, 0.5);
  backdrop-filter: blur(10px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--active-accent), rgba(255,255,255,0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  box-shadow: 0 0 15px rgba(var(--active-accent-rgb), 0.2);
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.user-avatar svg {
  width: 18px;
  height: 18px;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-greeting {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.app-status {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-dot.online {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-dot.syncing {
  background-color: var(--warning);
  box-shadow: 0 0 8px var(--warning);
  animation: pulse 1.5s infinite;
}

.header-right {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
}

/* VIEWPORT & ROUTING */
.content-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 90px 16px; /* Extra bottom padding for nav */
  position: relative;
  scrollbar-width: none; /* Hide scrollbar Firefox */
}

.content-viewport::-webkit-scrollbar {
  display: none; /* Hide scrollbar Chrome/Safari */
}

.tab-content {
  display: none;
  flex-direction: column;
  gap: 20px;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-content.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* SECTION HEROS */
.section-hero {
  position: relative;
  border-radius: 24px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  box-shadow: var(--glass-shadow);
  backdrop-filter: var(--glass-blur);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 140px;
}

.hero-glow {
  position: absolute;
  top: -50px;
  right: -50px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.35;
  pointer-events: none;
}

.prayers-glow { background-color: var(--prayers-color); }
.routines-glow { background-color: var(--routines-color); }
.tasks-glow { background-color: var(--tasks-color); }
.expenses-glow { background-color: var(--expenses-color); }

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
}

.hero-label-sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 6px;
  display: block;
}

.next-prayer-name {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 60%, rgba(255, 255, 255, 0.6));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.countdown-timer {
  font-size: 32px;
  font-weight: 700;
  font-family: monospace;
  margin-top: 8px;
  background: linear-gradient(90deg, #fff, var(--active-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 10px rgba(var(--active-accent-rgb), 0.1);
}

.hero-stat-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 8px;
}

.hero-stat {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
}

.stat-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.hero-divider {
  width: 1px;
  height: 35px;
  background: rgba(255, 255, 255, 0.1);
}

.hero-large-val {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #ffffff 60%, var(--expenses-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* PROGRESS BAR */
.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  margin-top: 16px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--active-accent);
  border-radius: 10px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 10px rgba(var(--active-accent-rgb), 0.5);
}

/* SECTION BODY & CARDS LIST */
.section-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
  margin-top: 8px;
}

.section-title-bar h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.action-buttons-row {
  display: flex;
  gap: 8px;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 150px;
}

/* GENERIC CARD STYLES */
.app-card {
  border-radius: 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-card:active {
  transform: scale(0.98);
  background: rgba(18, 24, 43, 0.9);
}

.card-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.card-icon-container {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid rgba(255,255,255,0.03);
  transition: all 0.3s ease;
}

.card-icon-container svg {
  width: 18px;
  height: 18px;
}

.card-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.card-right {
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2;
}

/* BUTTONS */
.btn {
  font-family: var(--font-main);
  font-weight: 600;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: var(--active-accent);
  color: #000;
  box-shadow: 0 4px 15px rgba(var(--active-accent-rgb), 0.25);
}

.btn-primary:active {
  box-shadow: 0 2px 5px rgba(var(--active-accent-rgb), 0.2);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}

.btn-secondary:active {
  background: rgba(255, 255, 255, 0.08);
}

.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger-outline:active {
  background: rgba(239, 68, 68, 0.08);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.btn-icon svg {
  width: 14px;
  height: 14px;
}

.icon-only-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-only-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.icon-only-btn:active {
  transform: scale(0.9);
}

/* SPECIFIC SECTIONS IMPLEMENTATIONS */

/* Prayers Card Styles */
.prayer-card.current {
  border-color: rgba(var(--active-accent-rgb), 0.3);
  background: linear-gradient(90deg, rgba(var(--active-accent-rgb), 0.08), rgba(18, 24, 43, 0.7));
  box-shadow: 0 4px 20px rgba(var(--active-accent-rgb), 0.05);
}

.prayer-card.current .card-icon-container {
  background: rgba(var(--active-accent-rgb), 0.15);
  color: var(--active-accent);
  border-color: rgba(var(--active-accent-rgb), 0.2);
}

.prayer-card.completed {
  opacity: 0.65;
}

.prayer-card.completed .card-icon-container {
  color: var(--success);
}

.prayer-time {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: monospace;
}

/* Routines Card Styles */
.routine-card.completed .card-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.routine-card.completed .card-icon-container {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.15);
}

/* Checkbox Animation */
.checkbox-container {
  position: relative;
  width: 24px;
  height: 24px;
  cursor: pointer;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 24px;
  width: 24px;
  background-color: transparent;
  border: 2px solid var(--text-muted);
  border-radius: 8px;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkbox-container:active .checkmark {
  transform: scale(0.9);
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--active-accent);
  border-color: var(--active-accent);
  box-shadow: 0 0 10px rgba(var(--active-accent-rgb), 0.4);
}

.checkmark svg {
  width: 14px;
  height: 14px;
  color: #000;
  display: none;
  stroke-width: 3px;
}

.checkbox-container input:checked ~ .checkmark svg {
  display: block;
  animation: scale-up 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Tasks Card Styles */
.task-card.completed .card-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
  margin-top: 4px;
  display: inline-block;
  width: max-content;
}

.task-tag.high { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.task-tag.medium { background: rgba(245, 158, 107, 0.15); color: var(--warning); }
.task-tag.low { background: rgba(59, 130, 246, 0.15); color: var(--info); }

/* Expenses Card Styles */
.expense-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--expenses-color);
}

.expense-category {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  display: inline-block;
  width: max-content;
}

/* BOTTOM NAVIGATION BAR */
.bottom-nav {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  height: 66px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  background: rgba(10, 15, 30, 0.75);
  backdrop-filter: blur(15px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding: 0 10px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  flex: 1;
  height: 100%;
  position: relative;
  z-index: 2;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2px;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.3s ease;
}

.nav-item span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: -0.1px;
  opacity: 0.8;
  transition: color 0.3s ease;
}

.nav-item.active {
  color: var(--active-accent);
}

.nav-item.active svg {
  transform: translateY(-4px) scale(1.1);
  color: var(--active-accent);
}

.nav-item.active span {
  color: var(--active-accent);
  font-weight: 700;
}

.nav-indicator {
  position: absolute;
  top: 6px;
  left: 0;
  height: 54px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 1;
}

/* DYNAMIC MODALS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: flex-end; /* Bottom sheet layout for mobile feel */
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

@media (min-width: 500px) {
  .modal-overlay {
    align-items: center;
  }
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  background: var(--bg-secondary);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
  padding: 24px 20px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 500px) {
  .modal-content {
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transform: scale(0.9) translateY(30px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

@media (min-width: 500px) {
  .modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h4 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.form-input {
  font-family: var(--font-main);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  color: #fff;
  outline: none;
  transition: all 0.25s ease;
}

.form-input:focus {
  border-color: var(--active-accent);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(var(--active-accent-rgb), 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-footer .btn {
  flex: 1;
  padding: 12px;
}

/* TOASTS SYSTEM */
.toast-container {
  position: fixed;
  bottom: 95px;
  left: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
  max-width: 460px;
  margin: 0 auto;
}

.toast {
  background: rgba(15, 20, 35, 0.95);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  animation: slide-up-fade 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  pointer-events: auto;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

.toast svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.toast.success svg { color: var(--success); }
.toast.error svg { color: var(--danger); }
.toast.info svg { color: var(--info); }

/* LOADING/EMPTY STATES */
.loading-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
  background: var(--card-bg);
  border-radius: 18px;
  border: 1px solid var(--card-border);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--active-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.empty-state svg {
  width: 32px;
  height: 32px;
  color: var(--text-muted);
}

/* CORE KEYFRAMES KEYFRAMES */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.5; }
}

@keyframes scale-up {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

@keyframes slide-up-fade {
  from {
    transform: translateY(15px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
