/* reset and base styles */
:root {
  /* Colors - White & Blue Theme */
  --bg-color: #ffffff;
  --primary-blue: #0A3D91; /* Royal Blue */
  --accent-blue: #2A6BCE;
  --light-blue: #E8F0FE; /* Ice Blue */
  --text-dark: #1A1A1A;
  --text-light: #5A5A5A;
  --white: #ffffff;
  --error: #FF3B30;
  --success: #34C759;

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  
  /* Typography */
  --font-base: 'Heebo', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Layout */
  --nav-height: 70px;
  --border-radius: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-base);
  background-color: var(--bg-color);
  background-image: radial-gradient(circle at 10% 20%, rgba(232, 240, 254, 0.6) 0%, rgba(255, 255, 255, 1) 90%);
  color: var(--text-dark);
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Prevent body scroll, handle in views */
}

/* Glassmorphism Utilities */
.glass-panel, .glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--border-radius);
}

.glass-card {
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.glass-card:active {
  transform: scale(0.98);
}

/* Main App Layout */
#app {
  width: 100%;
  height: 100vh;
  position: relative;
}

/* Auth View */
#auth-view {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  background: linear-gradient(135deg, white 0%, var(--light-blue) 100%);
  transition: opacity 0.4s ease;
}
#auth-view.hidden {
  opacity: 0;
  pointer-events: none;
}

.logo-title {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--primary-blue);
  margin-bottom: 0.5rem;
}
.accent-text {
  color: var(--accent-blue);
}
.subtitle {
  font-size: 1.1rem;
  color: var(--text-light);
  margin-bottom: 3rem;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: white;
  border: 1px solid #ddd;
  padding: 14px 24px;
  border-radius: 30px;
  font-family: var(--font-base);
  font-size: 1.1rem;
  font-weight: 500;
  color: #3c4043;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  transition: all 0.2s ease;
}
.google-btn img {
  width: 24px; height: 24px;
}
.google-btn:active {
  background: #f8f9fa;
  transform: translateY(2px);
}

/* Main UI */
#main-ui {
  display: flex;
  flex-direction: column;
  height: 100%;
}
#main-ui.hidden {
  display: none;
}

#views-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.view {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: var(--nav-height);
  padding: 1.5rem;
  padding-top: 2.5rem; /* Status bar space */
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(10px);
}
.view.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* App Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.app-header h2 {
  font-weight: 700;
  color: var(--primary-blue);
  font-size: 1.8rem;
}
.user-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background-color: var(--light-blue);
  background-size: cover;
  background-position: center;
  border: 2px solid var(--white);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Streak Card */
.streak-card {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(135deg, var(--light-blue), white);
}
.streak-count {
  display: block;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary-blue);
}
.streak-label {
  color: var(--text-light);
  font-weight: 500;
}

/* Massive Action Button */
.action-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 2rem 0;
}
.massive-action-btn {
  position: relative;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--primary-blue);
  border: none;
  box-shadow: 0 10px 30px rgba(10, 61, 145, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
}
.massive-action-btn:active {
  transform: scale(0.92);
}
.massive-action-btn.done {
  background: var(--success);
  box-shadow: 0 10px 30px rgba(52, 199, 89, 0.4);
  pointer-events: none;
}
.btn-text {
  color: white;
  font-size: 2rem;
  font-weight: 800;
  font-family: var(--font-base);
  z-index: 2;
}
.btn-glow {
  position: absolute;
  top: 50%; left: 50%;
  width: 100%; height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 70%);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}
.massive-action-btn:hover .btn-glow {
  opacity: 1;
}
.status-msg {
  margin-top: 1rem;
  color: var(--text-light);
  font-weight: 500;
  transition: color 0.3s;
}

/* Scrollable Text Area */
.scrollable-text {
  max-height: 150px;
  overflow-y: auto;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-dark);
  padding-right: 10px;
}
.scrollable-text::-webkit-scrollbar { width: 4px; }
.scrollable-text::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* Friends List */
.friends-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.icon-btn {
  background: var(--light-blue);
  color: var(--primary-blue);
  border: none;
  border-radius: 50%;
  width: 36px; height: 36px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.friend-item {
  display: flex;
  align-items: center;
  padding: 12px;
  background: var(--white);
  border-radius: 12px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.friend-avatar {
  width: 40px; height: 40px; border-radius: 50%; margin-left: 12px; background-size: cover;
}
.friend-info { flex: 1; }
.friend-name { font-weight: 600; font-size: 1rem; }
.friend-status { font-size: 0.85rem; color: var(--text-light); }
.chizuk-btn {
  background: var(--accent-blue);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom); /* iOS support */
  z-index: 50;
}
.nav-item {
  background: none; border: none;
  display: flex; flex-direction: column; align-items: center;
  color: var(--text-light);
  cursor: pointer;
  width: 20%;
  transition: color 0.2s ease;
}
.nav-item svg { width: 24px; height: 24px; margin-bottom: 4px; stroke: currentColor; }
.nav-item span { font-size: 0.75rem; font-weight: 500; }
.nav-item.active { color: var(--primary-blue); }
.nav-item.active svg { stroke-width: 2.5; }

/* Brachot Grid */
.brachot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.bracha-card { text-align: center; cursor: pointer; padding: 1.5rem 1rem;}
.bracha-card .icon { font-size: 2.5rem; margin-bottom: 10px; }
.bracha-card h4 { font-size: 1rem; color: var(--primary-blue); font-weight: 600; }

/* Buttons & Inputs */
.primary-btn {
  background: var(--primary-blue); color: white; border: none;
  padding: 14px 20px; border-radius: 12px; font-size: 1.1rem; font-weight: 600;
  cursor: pointer; font-family: var(--font-base); transition: transform 0.1s;
}
.primary-btn:active { transform: scale(0.98); }
.full-width { width: 100%; margin-bottom: 1rem; }
.input-field {
  width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px;
  font-family: var(--font-base); font-size: 1rem; margin-bottom: 1rem; background: var(--white);
}

/* Modals */
.modal-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
  z-index: 200; display: flex; align-items: center; justify-content: center; padding: 1rem;
  opacity: 1; transition: opacity 0.3s;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
.modal-content {
  width: 100%; max-width: 400px;
  transform: translateY(0); transition: transform 0.3s;
  display: flex; flex-direction: column;
}
.modal-overlay.hidden .modal-content { transform: translateY(20px); }
.modal-content.full-screen { max-width: 100%; height: 100%; border-radius: 0; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.close-modal-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-light); }

/* Jitsi Specific */
.jitsi-wrapper { background: black; padding: 0; margin: 0; }
.jitsi-wrapper .modal-header { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 10; color: white; background: rgba(0,0,0,0.5); padding: 10px; border-radius: 8px; margin: 0; }
.jitsi-wrapper .modal-header h3 { margin: 0; }
.jitsi-wrapper .close-modal-btn { color: white; }
#jitsi-container { width: 100%; height: 100%; flex: 1; }

/* Toasts */
#toast-container { position: absolute; top: 20px; left: 20px; right: 20px; z-index: 300; pointer-events: none; }
.toast {
  background: var(--glass-bg); backdrop-filter: blur(10px);
  border: 1px solid var(--primary-blue); border-right: 4px solid var(--primary-blue);
  padding: 16px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-bottom: 10px; animation: slideInDown 0.3s ease forwards;
}
@keyframes slideInDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.empty-state { text-align: center; color: var(--text-light); font-style: italic; padding: 1rem; }
