/*
 * Book App Stylesheet
 * Mobile-first PWA design following Every Layout principles
 */

/* ==========================================================================
   Every Layout System Imports
   ========================================================================== */

@import url("/assets/every-layout/tokens-ae7fa4af.css");
@import url("/assets/every-layout/base-2b72ee81.css");
@import url("/assets/every-layout/components/index-30e23822.css");

/* ==========================================================================
   App-Specific Design Tokens
   ========================================================================== */

:root {
  /* Color palette - inspired by libraries and books */
  --color-primary: #8B4513;      /* saddle brown - like old book leather */
  --color-primary-dark: #654321; /* darker brown */
  --color-primary-light: #D2691E; /* chocolate */

  --color-secondary: #2F4F4F;    /* dark slate gray - like aged paper */
  --color-secondary-light: #708090; /* slate gray */

  --color-background: #FFF8F0;   /* cream - like book pages */
  --color-surface: #FFFFFF;      /* white */
  --color-text: #2C1810;         /* dark brown - readable on cream */
  --color-text-secondary: #5C4033; /* lighter brown */

  --color-success: #2D5016;      /* forest green */
  --color-error: #8B0000;        /* dark red */

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;

  /* Borders & Shadows */
  --border-radius: 8px;
  --border-radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 20px rgba(0,0,0,0.15);

  /* Layout */
  --content-max-width: 1200px;
  --nav-height: 60px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #1A1410;
    --color-surface: #2C1810;
    --color-text: #F5E6D3;
    --color-text-secondary: #D2B48C;
    --color-primary: #D2691E;
    --color-secondary: #708090;
  }
}

/* ==========================================================================
   App-Specific Base Styles
   ========================================================================== */

body {
  font-family: var(--font-sans);
  font-size: var(--s0);
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-background);
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  line-height: 1.2;
}

h1 { font-size: var(--s3); }
h2 { font-size: var(--s2); }
h3 { font-size: var(--s1); }

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-text-secondary);
  font-size: var(--s-1);
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--color-primary);
  text-decoration: none;
}

/* ==========================================================================
   Forms
   ========================================================================== */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"],
input[type="week"],
select,
textarea {
  width: 100%;
  padding: var(--space-s) var(--space-m);
  border: 2px solid var(--color-secondary-light);
  border-radius: var(--border-radius);
  background: var(--color-surface);
  transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

button,
input[type="submit"] {
  padding: var(--space-s) var(--space-l);
  background: var(--color-primary);
  color: var(--color-surface);
  border: none;
  border-radius: var(--border-radius);
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

button:hover,
input[type="submit"]:hover {
  background: var(--color-primary-dark);
}

label {
  display: block;
  font-weight: 600;
  color: var(--color-text-secondary);
}

/* ==========================================================================
   Flash Messages
   ========================================================================== */

/* Flash message container */
[data-controller="flash"] {
  position: fixed;
  top: var(--space-m);
  left: var(--space-m);
  right: var(--space-m);
  z-index: 2000;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
  transform: translateY(0);
  opacity: 1;
}

/* Dismissing state - slide up and fade out */
[data-controller="flash"].flash--dismissing {
  transform: translateY(-100%);
  opacity: 0;
}

.notice, .alert {
  padding: var(--space-m);
  padding-right: var(--space-2xl); /* Make room for close button */
  border-radius: var(--border-radius);
  margin: 0; /* Reset any default margins */
  box-shadow: var(--shadow-lg);
  position: relative;
}

.notice {
  background: var(--color-success);
  color: white;
}

.alert {
  background: var(--color-error);
  color: white;
}

.flash__close {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-xs);
  padding: var(--space-xs);
  background: transparent;
  border: none;
  color: white;
  font-size: var(--s1);
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s, background-color 0.2s;
}

.flash__close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Utilities (Final Adjustments)
   ========================================================================== */

/* Font Sizes - based on modular scale */
.font-size\:xs { font-size: var(--s-2) !important; }
.font-size\:sm { font-size: var(--s-1) !important; }
.font-size\:base { font-size: var(--s0) !important; }
.font-size\:lg { font-size: var(--s1) !important; }
.font-size\:xl { font-size: var(--s2) !important; }
.font-size\:2xl { font-size: var(--s3) !important; }

/* Line Heights - presentational adjustments */
.line-height\:tight { line-height: 1.2 !important; }
.line-height\:normal { line-height: 1.5 !important; }
.line-height\:relaxed { line-height: 1.6 !important; }

/* Colors - semantic variations */
.color\:primary { color: var(--color-primary) !important; }
.color\:secondary { color: var(--color-text-secondary) !important; }

/* Width/Height - using modular scale */
.width\:s-2 { width: var(--s-2) !important; }
.width\:s-1 { width: var(--s-1) !important; }
.width\:s0 { width: var(--s0) !important; }
.width\:s1 { width: var(--s1) !important; }
.width\:s2 { width: var(--s2) !important; }
.height\:s-2 { height: var(--s-2) !important; }
.height\:s-1 { height: var(--s-1) !important; }
.height\:s0 { height: var(--s0) !important; }
.height\:s1 { height: var(--s1) !important; }
.height\:s2 { height: var(--s2) !important; }

/* Padding - for pages with fixed bottom nav */
.padding-bottom\:nav-height { padding-bottom: var(--nav-height) !important; }

/* ==========================================================================
   Components
   ========================================================================== */

/* Card - minimal decorative styling for composed layouts */
.card {
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

.card--bumpable {
  transition: transform 0.2s, box-shadow 0.2s;
}

.card--bumpable:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.card--media {
  overflow: hidden;
  background: var(--color-surface);
}

.card--media img {
  width: 100%;
  object-fit: cover;
  display: block;
}

/* FAB - Floating Action Button */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--space-l));
  right: var(--space-l);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  text-decoration: none;
  transition: transform 0.2s, background-color 0.2s;
}

.fab:hover {
  background: var(--color-primary-dark);
  transform: scale(1.1);
  text-decoration: none;
}

/* User Menu - Three-dot dropdown menu for account actions */
.user-menu {
  position: relative;
}

.user-menu__button {
  padding: var(--space-xs);
  background: transparent;
  border: none;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.user-menu__button:hover {
  background: var(--color-primary);
  color: var(--color-surface);
  border-radius: var(--border-radius);
}

.user-menu__icon {
  flex-shrink: 0;
}

.user-menu__dropdown {
  position: absolute;
  top: calc(100% + var(--space-xs));
  right: 0;
  min-width: 180px;
  background: var(--color-surface);
  border: 1px solid var(--color-secondary-light);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 500;
}

.user-menu__dropdown--active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu__item {
  display: block;
  padding: var(--space-m);
  color: var(--color-text);
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
  border-radius: var(--border-radius);
}

.user-menu__item:hover {
  background: var(--color-background);
  color: var(--color-primary);
  text-decoration: none;
}

/* ==========================================================================
   Bottom Navigation & Drawer
   ========================================================================== */

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--color-surface);
  border-top: 1px solid var(--color-secondary-light);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-text-secondary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s, background-color 0.2s;
}

.bottom-nav__item:hover {
  background: var(--color-background);
  color: var(--color-primary);
  text-decoration: none;
}

.bottom-nav__add-button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--nav-height);
  height: 100%;
  color: var(--color-primary);
  background: transparent;
  transition: color 0.2s, background-color 0.2s;
}

.bottom-nav__add-button:hover {
  background: var(--color-background);
  text-decoration: none;
}

/* Drawer Backdrop */
.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
  z-index: 998;
}

.drawer-backdrop--active {
  opacity: 1;
  visibility: visible;
}

/* Drawer */
.drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-secondary-light);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
  z-index: 999;
  touch-action: none;
}

.drawer--active {
  transform: translateY(0);
}

.drawer__handle {
  width: 32px;
  height: 4px;
  background: var(--color-secondary-light);
  border-radius: 2px;
  margin: var(--space-s) auto;
  flex-shrink: 0;
}

.drawer__content {
  padding: var(--space-m) var(--space-l);
  padding-bottom: calc(var(--nav-height) + var(--space-l));
}

.drawer__content h3 {
  color: var(--color-text);
}

.drawer__option {
  display: block;
  padding: var(--space-m);
  background: var(--color-background);
  border-radius: var(--border-radius);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.2s;
}

.drawer__option:hover {
  background: var(--color-primary-light);
  color: white;
  text-decoration: none;
}

/* Book show specific styles */
.book-cover {
  width: 100%;
  max-width: 200px;
  height: auto;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
}

/* Ensure mobile viewport is set */
