/* Bible App Styles */
:root {
  --primary-color: #2c3e50;
  --secondary-color: #34495e;
  --accent-color: #3498db;
  --text-color: #333;
  --light-color: #ecf0f1;
  --border-color: #ddd;
  --shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--light-color);
  overflow-x: hidden;
  position: relative;
  height: 100vh;
  width: 100vw;
}

.container {
  max-width: 100%;
  padding: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Styles */
.app-header {
  background-color: var(--primary-color);
  color: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  position: sticky;
  top: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.app-title {
  font-size: 1.5rem;
  font-weight: 600;
  width: 25%;
}

.current-chapter {
  flex: 1;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.current-chapter.visible {
  opacity: 1;
}

.header-buttons {
  display: flex;
  gap: 10px;
  width: 25%;
  justify-content: flex-end;
}

.menu-btn, .settings-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
}

/* Bible Content Area */
.bible-content {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  background-color: white;
  font-size: 1.1rem;
}

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

.verse {
  margin-bottom: 1rem;
  line-height: 1.8;
}

.verse-number {
  font-weight: bold;
  color: var(--accent-color);
  font-size: 0.8rem;
  vertical-align: super;
  margin-right: 0.3rem;
}

.notice-box {
  background-color: #f8f9fa;
  border-left: 4px solid var(--accent-color);
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 4px;
}

.notice-message {
  color: var(--primary-color);
  line-height: 1.5;
}

.empty-message {
  color: #6c757d;
  text-align: center;
  padding: 2rem 0;
  font-style: italic;
}

/* Offline toggle styles */
.offline-toggle-container {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.offline-info {
  font-size: 0.8rem;
  color: #ccc;
  margin-top: 0.5rem;
}

.offline-note {
  font-size: 0.8rem;
  color: var(--accent-color);
  margin-top: 0.3rem;
}

/* Sidebar Menu */
.sidebar {
  position: fixed;
  top: 0;
  left: -80%;
  width: 80%;
  height: 100%;
  background-color: var(--secondary-color);
  color: white;
  z-index: 1000;
  overflow-y: auto;
  transition: left 0.3s ease;
  box-shadow: var(--shadow);
}

.sidebar.open {
  left: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-title {
  font-size: 1.2rem;
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
}

.bible-nav {
  padding: 1rem;
}

.testament-title {
  font-size: 1.1rem;
  margin: 1rem 0 0.5rem;
  color: var(--accent-color);
}

.book-list {
  list-style: none;
  margin-left: 1rem;
}

.book-item {
  padding: 0.5rem 1rem;
  cursor: pointer;
  margin: 0 -1rem;
  border-left: 4px solid transparent;
  transition: background-color 0.2s, border-left-color 0.2s;
}

.book-item:hover {
  background-color: rgba(52, 152, 219, 0.2);
}

.book-item.active {
  background-color: var(--accent-color);
  border-left-color: white;
}

.chapter-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  list-style: none;
  margin: 0.5rem 0 1rem 0;
  max-height: 60vh;
  overflow-y: auto;
  padding: 0 0.5rem;
}

.chapter-item {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 0.5rem;
  text-align: center;
  cursor: pointer;
}

.chapter-item:hover, .chapter-item.active {
  background-color: var(--accent-color);
}

.chapters-section {
  padding: 0.5rem;
  overflow: hidden;
}

/* Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

.overlay.open {
  display: block;
}

/* Navigation controls */
.navigation-controls {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background-color: var(--primary-color);
  color: white;
}

.nav-btn {
  background: none;
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 1.5rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.nav-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.nav-btn:active {
  background-color: rgba(255, 255, 255, 0.3);
}

.nav-btn i {
  font-size: 1.5rem;
}

/* Loading indicator */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--accent-color);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Media queries for responsive design */
@media (min-width: 768px) {
  .container {
    max-width: 600px;
    margin: 0 auto;
    box-shadow: var(--shadow);
  }

  .sidebar {
    max-width: 400px;
  }
}

/* Swipe area for mobile gesture support */
.swipe-area {
  position: absolute;
  width: 100%;
  height: calc(100% - 110px); /* adjust based on header + footer height */
  top: 60px; /* adjust based on header height */
  touch-action: manipulation; /* Allow scrolling while still capturing swipes */
  pointer-events: none; /* This allows touches to pass through to elements beneath */
}

/* Chapter header styling */
.chapter-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.back-btn {
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  margin-right: 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.2s;
}

.back-btn:hover {
  background-color: var(--accent-color);
}

.chapter-header .book-title {
  margin: 0;
}

/* Active book and chapter highlighting */
.book-item.active, .chapter-item.active {
  background-color: var(--accent-color);
}

.welcome-message {
  text-align: center;
  padding: 2rem;
  color: var(--primary-color);
}

.welcome-message h2 {
  margin-bottom: 1rem;
}

/* Button styles */
button {
  transition: all 0.2s ease;
}

button:active {
  transform: scale(0.98);
}

/* Enhances accessibility */
@media (prefers-reduced-motion) {
  * {
    transition: none !important;
    animation: none !important;
  }
}