/* ===================================
   CSS Variables & Theme
=================================== */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(26, 26, 37, 0.8);
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #6b6b7b;
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --accent-glow: rgba(99, 102, 241, 0.3);
  --border-color: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.03);
  --shadow-color: rgba(0, 0, 0, 0.3);
  --success: #10b981;
  --warning: #f59e0b;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

/* ===================================
   Reset & Base
=================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===================================
   Background Animation
=================================== */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.1) 0%, transparent 60%);
  z-index: -1;
  pointer-events: none;
}

/* ===================================
   Header
=================================== */
header {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

nav button {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

nav button:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: scale(1.05);
}

#cartCount {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

nav button:hover #cartCount {
  -webkit-text-fill-color: white;
}

/* ===================================
   Main Content
=================================== */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* ===================================
   Intro Section
=================================== */
#intro {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
  overflow: hidden;
}

#intro::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-gradient);
}

#intro h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  animation: fadeInUp 0.8s ease-out;
}

.highlight {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 1.3rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  animation: fadeInUp 0.8s ease-out 0.1s both;
}

.identity {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text-muted);
  max-width: 800px;
  margin: 0 auto 1.5rem;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

.emphasis {
  color: #ec4899;
  font-weight: 600;
  font-style: normal;
}

.about {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto 1rem;
  line-height: 1.8;
  animation: fadeInUp 0.8s ease-out 0.3s both;
}

.fadein-word {
  display: inline-block;
  color: var(--accent-primary);
  font-weight: 500;
  animation: glow 2s ease-in-out infinite alternate;
}

.delay-1 { animation-delay: 0.3s; }
.delay-2 { animation-delay: 0.6s; }

@keyframes glow {
  from { text-shadow: 0 0 5px var(--accent-glow); }
  to { text-shadow: 0 0 20px var(--accent-glow), 0 0 30px var(--accent-glow); }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#intro button {
  margin-top: 2rem;
  background: var(--accent-gradient);
  border: none;
  color: white;
  padding: 1rem 2rem;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 20px var(--accent-glow);
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

#intro button:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 30px var(--accent-glow);
}

/* ===================================
   Book Grid
=================================== */
.book-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  padding: 1rem 0;
}

.book {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.book::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transition: transform var(--transition-normal);
}

.book:hover::before {
  transform: scaleX(1);
}

.book:hover {
  transform: translateY(-8px);
  border-color: var(--accent-primary);
  box-shadow: 0 20px 40px var(--shadow-color);
}

.book img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  transition: transform var(--transition-normal);
}

.book:hover img {
  transform: scale(1.03);
}

.book h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.book p {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.book p em {
  font-style: italic;
  color: var(--text-muted);
}

.book p strong {
  color: var(--success);
  font-size: 1.25rem;
}

.book button {
  width: 100%;
  margin-top: 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.book button:hover {
  background: var(--accent-gradient);
  border-color: transparent;
  transform: scale(1.02);
}

/* ===================================
   Modal (Cart)
=================================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-content h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 1.75rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
  line-height: 1;
}

.close:hover {
  color: var(--text-primary);
}

#cartItems {
  list-style: none;
  margin-bottom: 1.5rem;
}

#cartItems li {
  padding: 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-content > p {
  font-size: 1.25rem;
  font-weight: 600;
  text-align: right;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

#cartTotal {
  color: var(--success);
  font-size: 1.5rem;
}

.hidden {
  display: none !important;
}

/* ===================================
   Footer
=================================== */
footer {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  text-align: center;
  padding: 2rem;
  margin-top: 4rem;
  color: var(--text-muted);
}

/* ===================================
   Scrollbar
=================================== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-secondary);
}

/* ===================================
   Responsive
=================================== */
@media (max-width: 768px) {
  header {
    padding: 1rem;
  }
  
  header h1 {
    font-size: 1.25rem;
  }
  
  main {
    padding: 1rem;
  }
  
  #intro {
    padding: 2rem 1rem;
  }
  
  #intro h2 {
    font-size: 1.75rem;
  }
  
  .tagline {
    font-size: 1.1rem;
  }
  
  .book-list {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
  }
  
  .book img {
    height: 250px;
  }
}

@media (max-width: 480px) {
  .book-list {
    grid-template-columns: 1fr;
  }
  
  nav button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
}
