/* =========================================
   Global Styles, Variables & Fonts
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Lato:wght@300;400;700&display=swap');

/* --- Icon Font Placeholder (Replace with actual font import/CSS) --- */
/* Example using CSS classes */
@font-face {
  font-family: 'Icons';
  /* src: url('fonts/icons.woff2') format('woff2'), url('fonts/icons.woff') format('woff'); */
  font-weight: normal;
  font-style: normal;
  font-display: block;
}
[class^="icon-"]:before, [class*=" icon-"]:before {
  font-family: 'Icons';
  speak: none;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: inline-block; /* Ensure icons behave well */
}
/* Add real icon codes here */
.icon-basket:before { content: "\\1F6D2"; } /* Shopping cart emoji */
.icon-heart:before { content: "\\2661"; } /* White heart */
.btn-wishlist.active .icon-heart:before { content: "\\2665"; } /* Black heart */
.icon-user:before { content: "\\1F464"; } /* Bust in silhouette */
.icon-logout:before { content: "\\27A1"; } /* Right arrow */
.icon-check:before { content: "\\2714"; } /* Check mark */
.icon-dashboard:before { content: "\\1F4CA"; } /* Bar chart */
.icon-book:before { content: "\\1F4D6"; } /* Open book */
.icon-orders:before { content: "\\1F4E6"; } /* Package */
.icon-users:before { content: "\\1F465"; } /* Two busts */
/* --- End Icon Font Placeholder --- */

:root {
  --primary-color: #389167; /* Green */
  --secondary-color: #a02323; /* Red */
  --accent-color: #a05423; /* Brown */
  --primary-light: #e1f0e9;
  --secondary-light: #f3e0e0;
  --accent-light: #f3e9e0;

  --text-color: #343a40;
  --text-light: #f8f9fa;
  --text-muted: #6c757d;
  --link-color: var(--primary-color);
  --link-hover: var(--accent-color);

  --bg-color: #ffffff;
  --bg-soft: #f8f9fa;
  --bg-dark: #212529;
  --border-color: #dee2e6;

  --font-heading: 'Playfair Display', serif;
  --font-body: 'Lato', sans-serif;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);

  --transition-speed: 0.3s;
  --transition-ease: cubic-bezier(0.25, 0.8, 0.25, 1);
  --page-turn-speed: 0.5s; /* Faster page transitions */
  --page-turn-ease: cubic-bezier(0.645, 0.045, 0.355, 1);

  --container-width: 1300px;
  --header-height: 70px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  margin: 0;
  padding: 0;
  background-color: var(--bg-soft);
  color: var(--text-color);
  line-height: 1.7;
  font-weight: 400;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Subtle texture overlay */
  background-image: linear-gradient(rgba(248, 249, 250, 0.95), rgba(248, 249, 250, 1)), url('img/subtle_pattern.png');
  background-attachment: fixed;
}

body.modal-open {
  overflow: hidden; /* Prevent body scroll when modal is open */
}

#app-container {
  max-width: var(--container-width);
  margin: 0 auto;
  background-color: var(--bg-color);
  box-shadow: var(--shadow-lg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

main#main-content {
  flex-grow: 1;
  padding: 0; /* Remove padding here if pages have it */
  position: relative;
  overflow: auto; /* Allow scrolling */
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}
a:hover {
  color: var(--link-hover);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-color);
  margin-top: 1.5em;
  margin-bottom: 0.8em;
  line-height: 1.3;
  font-weight: 700;
}
h1 { font-size: 2.8em; color: var(--primary-color); border-bottom: 3px solid var(--accent-color); padding-bottom: 15px; margin-bottom: 30px; }
h2 { font-size: 2em; }
h3 { font-size: 1.6em; }

p {
  margin-bottom: 1.2em;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* =========================================
   Utility Classes
   ========================================= */
.hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.full-width { width: 100%; }
.text-center { text-align: center; }
.link-view-all { font-size: 0.9em; font-weight: bold; }
.section-divider { margin: 40px 0; border: 0; border-top: 1px solid var(--border-color); }

/* =========================================
   Header & Navigation
   ========================================= */
.site-header {
  background-color: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  padding: 0 30px;
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: box-shadow var(--transition-speed) ease;
}
.site-header.scrolled {
  box-shadow: var(--shadow-md);
}

.site-header .logo a {
  font-family: var(--font-heading);
  font-size: 1.8em;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: 1px;
  text-decoration: none;
}

.main-nav {
  display: flex;
}
.main-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
}
.main-nav li {
  margin-left: 25px;
}
.main-nav a {
  font-weight: 700;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 15px;
  border-radius: 5px;
  position: relative;
  overflow: hidden;
  transition: color var(--transition-speed) ease;
  color: var(--text-muted);
}
.main-nav a::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: var(--primary-color);
  transition: all var(--transition-speed) var(--transition-ease);
  transform: translateX(-50%);
}
.main-nav a:hover,
.main-nav a.active {
  color: var(--primary-color);
}
.main-nav a:hover::before,
.main-nav a.active::before {
  width: 70%;
}

.nav-logout-btn {
  background: none; border: none; cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700; font-size: 0.9em;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 10px 15px;
  transition: color var(--transition-speed) ease;
}
.nav-logout-btn:hover { color: var(--secondary-color); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}
.header-actions a {
  color: var(--text-muted);
  font-size: 1.3em; /* Icon size */
  position: relative;
  transition: color var(--transition-speed) ease;
  line-height: 1; /* Align icons better */
}
.header-actions a:hover { color: var(--primary-color); }

.basket-summary .basket-count,
.wishlist-link .wishlist-count {
  position: absolute;
  top: -8px;
  right: -10px;
  background-color: var(--secondary-color);
  color: white;
  border-radius: 50%;
  font-size: 0.6em;
  font-weight: bold;
  line-height: 1;
  padding: 4px 6px;
  min-width: 18px;
  text-align: center;
}
.wishlist-link .wishlist-count {
  background-color: var(--accent-color);
}
.wishlist-link .wishlist-count:empty {
  display: none;
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
  display: none; /* Hidden by default */
  background: none; border: none; font-size: 1.8em;
  cursor: pointer; color: var(--text-color);
  z-index: 1100;
}

/* =========================================
   Footer
   ========================================= */
.site-footer {
  background-color: var(--bg-dark);
  color: var(--text-light);
  padding: 40px 30px;
  margin-top: auto;
}
.footer-content {
  max-width: var(--container-width);
  margin: 0 auto;
  text-align: center;
  font-size: 0.9em;
}
.footer-content p {
  margin: 5px 0;
  color: rgba(255, 255, 255, 0.7);
}
.footer-content a {
  color: var(--text-light);
  text-decoration: underline;
}
.footer-content a:hover { color: var(--primary-color); }

/* =========================================
   Page Content & Transitions (REVISED)
   ========================================= */
#page-container {
  position: relative;
  width: 100%;
  min-height: 70vh; /* Ensure container has height */
}

.page-content {
  background-color: var(--bg-color);
  opacity: 0;
  visibility: hidden;
  position: absolute; /* Keep non-active pages out of flow */
  top: 0; left: 0; width: 100%;
  transform: scale(0.98); /* Start slightly scaled down */
  transform-origin: center center;
  transition: opacity var(--page-turn-speed) var(--transition-ease),
              visibility 0s linear var(--page-turn-speed), /* Hide instantly AFTER opacity transition */
              transform var(--page-turn-speed) var(--transition-ease);
  z-index: 5; /* Default lower z-index */
  padding: 30px; /* Add padding inside pages */
  box-sizing: border-box;
}

.page-content.active {
  opacity: 1;
  visibility: visible; /* Become visible instantly */
  transform: scale(1);
  position: relative; /* Take up space in the layout when active */
  z-index: 10; /* Bring to front */
  min-height: 70vh; /* Ensure active page maintains container height */
  transition: opacity var(--page-turn-speed) var(--transition-ease),
              visibility 0s linear 0s, /* Become visible instantly */
              transform var(--page-turn-speed) var(--transition-ease);
}

/* Ensure main content area allows scrolling if page content overflows */
main#main-content {
  flex-grow: 1;
  padding: 0; /* Remove padding here as pages have it now */
  position: relative;
  overflow: auto; /* Allow scrolling */
}

/* =========================================
   Notifications
   ========================================= */
.notifications {
  position: fixed;
  top: calc(var(--header-height) + 15px);
  right: 20px;
  width: 90%;
  max-width: 380px;
  padding: 15px 40px 15px 20px;
  border-radius: 5px;
  box-shadow: var(--shadow-md);
  z-index: 2000;
  opacity: 0;
  transform: translateX(100%); /* Start off-screen */
  transition: opacity 0.5s ease, transform 0.5s ease; /* Add transition */
  font-size: 0.95em;
}
/* Animation handled by JS adding/removing class or direct style change */
/* Example using direct style in JS:
@keyframes slideInNotify { to { opacity: 1; transform: translateX(0); } } */

.notifications.error-messages {
  background-color: var(--secondary-light);
  color: var(--secondary-color);
  border-left: 5px solid var(--secondary-color);
}
.notifications.success-message {
  background-color: var(--primary-light);
  color: var(--primary-color);
  border-left: 5px solid var(--primary-color);
}
.notifications ul {
  margin: 5px 0 0 0;
  padding-left: 20px;
  font-size: 0.9em;
}
.notifications strong { font-weight: bold; }

.close-notify {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none; border: none;
  font-size: 1.6em; line-height: 1;
  color: inherit; opacity: 0.6;
  cursor: pointer;
  padding: 5px;
}
.close-notify:hover { opacity: 1; }

/* =========================================
   Buttons & Icons
   ========================================= */
.btn {
  display: inline-block;
  background-image: linear-gradient(to right, var(--primary-color), #2a6f4f);
  color: var(--text-light);
  padding: 12px 25px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  transition: all var(--transition-speed) var(--transition-ease);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  vertical-align: middle; /* Align better with text/icons */
}
.btn:hover {
  background-image: linear-gradient(to right, #2a6f4f, var(--primary-color));
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: white;
}
.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  background-image: none;
  background-color: var(--text-muted);
}
/* Ensure icons inside buttons align well */
.btn i {
    vertical-align: middle;
    margin-right: 6px; /* Space between icon and text */
    line-height: 1; /* Prevent extra vertical space */
}
.btn .loading-spinner {
    margin-right: 6px;
}


.btn-secondary {
  background-image: linear-gradient(to right, var(--accent-color), #82431a);
}
.btn-secondary:hover {
  background-image: linear-gradient(to right, #82431a, var(--accent-color));
}

.btn-danger {
   background-image: linear-gradient(to right, var(--secondary-color), #7a1b1b);
}
.btn-danger:hover {
   background-image: linear-gradient(to right, #7a1b1b, var(--secondary-color));
}

.btn-sm {
  padding: 8px 15px;
  font-size: 0.8em;
}

.btn-icon {
  background: none; border: none; cursor: pointer;
  padding: 8px;
  font-size: 1.4em; /* Icon size */
  color: var(--text-muted);
  transition: color var(--transition-speed) ease, transform var(--transition-speed) ease;
  line-height: 1;
  vertical-align: middle;
}
.btn-icon:hover {
  color: var(--primary-color);
  transform: scale(1.1);
}
.btn-icon:disabled {
  color: var(--border-color);
  cursor: not-allowed;
  transform: none;
}

.btn-wishlist.active,
.btn-wishlist:hover:not(:disabled) { /* Only hover color change if not disabled */
  color: var(--secondary-color); /* Red heart */
}
.btn-wishlist.large { font-size: 1.8em; padding: 10px; }

.btn-remove-item {
  font-size: 1.5em;
  color: var(--secondary-color);
  opacity: 0.7;
}
.btn-remove-item:hover { opacity: 1; }

/* =========================================
   Forms
   ========================================= */
form div {
  margin-bottom: 20px;
}
form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 0.9em;
  color: var(--text-muted);
}
form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="number"],
form input[type="search"],
form textarea,
form select,
#payment-element {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  box-sizing: border-box;
  font-size: 1em;
  font-family: var(--font-body);
  transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
  background-color: var(--bg-color);
}
form input[type="number"] {
  width: 80px;
}
form input[type="search"] {
  padding-left: 35px; /* Space for icon */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%236c757d" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>');
  background-repeat: no-repeat;
  background-position: 10px center;
}

form input:focus,
form textarea:focus,
form select:focus,
#payment-element--focus { /* Stripe uses different class */
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(56, 145, 103, 0.2);
  outline: none;
}

form textarea {
  min-height: 100px;
  resize: vertical;
}

.form-row {
  display: flex;
  gap: 20px;
}
.form-row > div { flex: 1; }

/* Auth Forms Specific */
.auth-form {
  max-width: 450px;
  margin: 40px auto;
  padding: 30px 40px; /* More padding */
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-color);
  box-shadow: var(--shadow-md);
}
.auth-form h2 { text-align: center; margin-top: 0; }
.auth-switch { text-align: center; margin-top: 25px; font-size: 0.9em; }

/* =========================================
   Tables
   ========================================= */
.admin-table, .basket-table, .orders-table {
  width: 100%;
  border-collapse: collapse;
  margin: 25px 0;
  font-size: 0.95em;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  overflow: hidden; /* For radius */
}

.admin-table th, .basket-table th, .orders-table th {
  background-color: var(--bg-soft);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.85em;
  letter-spacing: 0.5px;
  padding: 12px 15px;
  text-align: left;
  border-bottom: 2px solid var(--border-color);
}

.admin-table td, .basket-table td, .orders-table td {
  border-bottom: 1px solid var(--border-color);
  padding: 12px 15px;
  vertical-align: middle;
  background-color: var(--bg-color);
}

.admin-table tbody tr:last-child td,
.basket-table tbody tr:last-child td,
.orders-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:hover td,
.basket-table tbody tr:hover td,
.orders-table tbody tr:hover td {
  background-color: var(--primary-light); /* Subtle hover */
}

.basket-table img { vertical-align: middle; margin-right: 15px; border-radius: 4px; }
.basket-table .item-quantity { text-align: center; }
.basket-table .item-subtotal, .basket-table .item-price { font-weight: bold; }

.status-badge {
  display: inline-block;
  padding: 3px 10px; /* Slightly wider */
  border-radius: 12px; /* More rounded */
  font-size: 0.8em;
  font-weight: bold;
  text-transform: capitalize;
  color: white;
  line-height: 1.5;
}
.status-pending { background-color: var(--text-muted); }
.status-processing { background-color: #0d6efd; } /* Example blue */
.status-shipped { background-color: var(--accent-color); }
.status-completed { background-color: var(--primary-color); }
.status-cancelled, .status-failed { background-color: var(--secondary-color); }

/* =========================================
   Loading States & Spinners
   ========================================= */
.loading-spinner {
  display: inline-block;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-left-color: var(--primary-color);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
  vertical-align: middle;
  margin: 0 5px; /* Centered margin */
}
.loading-spinner.white { border-color: rgba(255,255,255,0.2); border-left-color: white; }
.loading-spinner.large { width: 40px; height: 40px; border-width: 4px; margin: 20px auto; display: block; } /* Centered for block display */

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loading-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(255, 255, 255, 0.85); /* Slightly more opaque */
  display: flex; justify-content: center; align-items: center;
  z-index: 9999;
  opacity: 0; visibility: hidden;
  transition: opacity var(--transition-speed) ease, visibility var(--transition-speed) ease;
}
#loading-overlay.visible {
  opacity: 1; visibility: visible;
}

/* Button loading state */
.btn .loading-spinner {
  width: 1em; height: 1em; border-width: 2px; /* Relative size */
}
.btn span + .loading-spinner { /* Adjust margin if text precedes spinner */
  margin-left: 8px;
}

/* =========================================
   Modal
   ========================================= */
.modal {
  position: fixed; z-index: 1050;
  left: 0; top: 0; width: 100%; height: 100%;
  overflow: hidden;
  background-color: rgba(33, 37, 41, 0.8); /* Darker overlay using bg-dark */
  display: flex; align-items: center; justify-content: center;
  padding: 20px; /* Padding for smaller screens */
  opacity: 0; visibility: hidden;
  transition: opacity var(--transition-speed) ease, visibility var(--transition-speed) ease;
}
.modal.visible {
  opacity: 1; visibility: visible;
}

.modal-content {
  background-color: var(--bg-color);
  padding: 30px 40px; /* More padding */
  border: none;
  width: 100%; /* Full width within padding */
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  border-radius: 8px;
  transform: scale(0.95) translateY(-10px); /* Start slightly smaller and up */
  transition: transform var(--transition-speed) var(--transition-ease);
}
.modal.visible .modal-content {
  transform: scale(1) translateY(0);
}

.close-button {
  color: var(--text-muted);
  position: absolute; top: 15px; right: 20px;
  font-size: 2.5em; font-weight: 300; line-height: 1;
  transition: color var(--transition-speed) ease, transform var(--transition-speed) ease;
  background: none; border: none; cursor: pointer;
}
.close-button:hover { color: var(--secondary-color); transform: rotate(90deg); }

#preview-content-area {
  width: 100%;
  min-height: 400px;
  background-color: var(--bg-soft);
  display: flex; justify-content: center; align-items: center;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  margin-top: 20px;
  position: relative;
  overflow: hidden; /* Ensure content stays inside */
}
#preview-content-area img {
  max-width: 95%; max-height: 500px; /* Adjust */
  object-fit: contain;
  box-shadow: var(--shadow-md);
  transition: opacity 0.3s ease;
}
.preview-controls {
  position: absolute; bottom: 15px; left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.9); /* More opaque */
  padding: 8px 15px; border-radius: 20px;
  box-shadow: var(--shadow-sm);
  display: flex; gap: 15px;
}
.preview-controls button {
  background: none; border: none; font-size: 1.8em;
  cursor: pointer; color: var(--primary-color);
  margin: 0; /* Remove margin */
  transition: color var(--transition-speed);
}
.preview-controls button:hover { color: var(--accent-color); }
.preview-controls button:disabled { color: var(--border-color); cursor: not-allowed; }

/* =========================================
   Home Page Specifics
   ========================================= */
.hero-section {
  position: relative;
  text-align: center;
  padding: 100px 30px;
  background: url('img/hero_banner.jpg') no-repeat center center; /* Add your image */
  background-size: cover;
  color: white;
  border-radius: 8px;
  margin-bottom: 50px;
  overflow: hidden;
}
.hero-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.7));
  z-index: 1;
}
.hero-content {
  position: relative; z-index: 2;
}
.hero-section h1 { color: white; border: none; font-size: 3.5em; margin-bottom: 15px; }
.hero-section p { font-size: 1.3em; max-width: 700px; margin: 0 auto 30px auto; opacity: 0.9; }

.featured-books-section { margin-bottom: 50px; }
.featured-books-section h2 { text-align: center; }
.featured-list {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Smaller featured items */
}
.featured-list .book-item.simple {
  background: none; border: none; box-shadow: none;
  padding: 0;
}
.featured-list .book-item.simple:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); } /* Add subtle hover */
.featured-list .book-item.simple .book-info { padding: 10px 0 0 0; }
.featured-list .book-item.simple .book-title { font-size: 1.1em; }
.featured-list .book-item.simple .book-cover { height: 250px; } /* Adjust height */

.author-intro {
  display: flex; align-items: center; gap: 40px;
  margin-bottom: 50px; padding: 40px;
  background-color: var(--bg-soft); border-radius: 8px;
}
.author-photo-container img {
  max-width: 280px; border-radius: 50%;
  box-shadow: var(--shadow-lg);
  border: 5px solid white;
}
.author-text { flex: 1; }
.author-text h2 { margin-top: 0; }

/* =========================================
   Store Page & Book Items
   ========================================= */
.store-controls {
  margin-bottom: 30px;
}

.book-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

.book-item {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: #fff;
  text-align: center;
  transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.book-item:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
}

.book-cover-link {
  display: block;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-soft); /* Placeholder bg */
}
.book-cover {
  display: block;
  width: 100%;
  height: 320px;
  object-fit: cover; /* Changed to cover for consistent fill */
  transition: transform calc(var(--transition-speed) * 1.5) ease;
  border-bottom: 1px solid var(--border-color);
}
.book-item:hover .book-cover {
  transform: scale(1.05);
}

.book-info {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}
.book-title { font-size: 1.2em; margin: 0 0 10px 0; font-family: var(--font-heading); }
.book-title a { color: inherit; text-decoration: none; }
.book-title a:hover { color: var(--primary-color); }
.book-description { display: none; /* Hide short desc by default */ }
.book-price { font-weight: 700; color: var(--primary-color); font-size: 1.3em; margin-bottom: 15px; }

.book-actions {
  margin-top: auto;
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
  display: flex; justify-content: space-between; align-items: center;
}
.book-actions .btn-add-basket { font-size: 0.85em; padding: 10px 15px; }
/* Icon margin handled globally in .btn i */

.no-results {
  grid-column: 1 / -1; /* Span full width */
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

/* =========================================
   Book Detail Page
   ========================================= */
.book-detail-container {
  display: flex;
  gap: 40px;
}
.book-detail-cover {
  flex-basis: 35%;
  max-width: 400px;
  text-align: center;
}
.book-cover-large {
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 20px;
}
.book-detail-info {
  flex: 1;
}
.book-title-large { margin-top: 0; font-size: 2.5em; border: none; padding: 0; margin-bottom: 5px; }
.book-author { font-size: 1.1em; color: var(--text-muted); margin-bottom: 20px; }
.book-price-large { font-size: 2em; font-weight: bold; color: var(--primary-color); margin-bottom: 30px; }
.book-detail-actions {
  display: flex; align-items: center; gap: 15px;
  margin-bottom: 30px;
}
.book-description-full h2 { font-size: 1.5em; margin-bottom: 10px; }
.book-description-full { margin-top: 30px; padding-top: 30px; border-top: 1px solid var(--border-color); }

/* =========================================
   Client Area
   ========================================= */
.client-nav {
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
}
.client-nav ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.client-nav a {
  padding: 10px 18px; border-radius: 50px;
  font-weight: 700; font-size: 0.9em; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted);
  border: 1px solid transparent;
  transition: all var(--transition-speed) ease;
}
.client-nav a.active,
.client-nav a:hover {
  background-color: var(--primary-light);
  color: var(--primary-color);
  border-color: var(--primary-color);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.client-section {
  padding: 25px 30px; /* More padding */
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: #fff;
  margin-top: 20px;
  box-shadow: var(--shadow-sm);
}

.simple-list { list-style: none; padding-left: 0; }
.simple-list li { margin-bottom: 10px; padding: 12px 15px; background: var(--bg-soft); border-radius: 4px; }
.simple-list li a { font-weight: bold; }

.basket-summary-box {
  margin-top: 20px;
  padding: 20px 30px;
  background-color: var(--bg-soft);
  border-radius: 5px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px;
}
.basket-total { font-size: 1.2em; font-weight: bold; }
.basket-total span { color: var(--primary-color); margin-left: 10px; }

.checkout-form { margin-top: 30px; }

.order-confirmation-box {
  text-align: center;
  padding: 40px;
}
.confirmation-icon {
  font-size: 4em; color: var(--primary-color);
  line-height: 1; margin-bottom: 20px;
  display: inline-block; border: 3px solid var(--primary-color);
  border-radius: 50%; padding: 15px;
}
.order-summary {
  text-align: left; max-width: 500px; margin: 20px auto;
  padding: 20px; background: var(--bg-soft); border-radius: 5px;
  border: 1px solid var(--border-color);
}
.order-summary p { margin-bottom: 10px; }

.order-detail-view { padding: 15px; }
.order-detail-view p { margin-bottom: 10px; }
.order-items-detailed { background: var(--bg-soft); padding: 15px; border-radius: 5px; margin-top: 10px; }

/* =========================================
   Admin Area
   ========================================= */
body.admin-view #app-container { max-width: none; } /* Full width for admin */
body.admin-view main#main-content { padding: 0; }

.admin-area {
  display: flex;
  min-height: calc(100vh - var(--header-height)); /* Full height */
  position: relative; /* Override absolute positioning */
  opacity: 1; visibility: visible; transform: none; /* Ensure visible */
}

.admin-sidebar {
  width: 240px;
  background-color: var(--bg-dark);
  color: var(--text-light);
  padding: 20px;
  flex-shrink: 0;
  transition: width 0.3s ease; /* Add transition for potential collapse */
}
.admin-sidebar h2 {
  color: var(--text-light);
  font-size: 1.4em;
  text-align: center;
  margin-top: 0;
  margin-bottom: 30px;
  border: none;
  padding-bottom: 0;
}

.admin-nav ul { list-style: none; padding: 0; margin: 0; }
.admin-nav li a {
  display: flex; align-items: center; gap: 12px; /* Increased gap */
  padding: 12px 15px;
  color: rgba(255, 255, 255, 0.7);
  border-radius: 5px;
  margin-bottom: 5px;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
  white-space: nowrap; /* Prevent text wrap */
}
.admin-nav li a i { font-size: 1.1em; width: 20px; text-align: center; flex-shrink: 0; }
.admin-nav li a:hover,
.admin-nav li a.active {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  text-decoration: none;
}

.admin-main-content {
  flex-grow: 1;
  padding: 30px 40px;
  overflow-y: auto;
  background-color: var(--bg-color); /* Changed from soft */
}
.admin-main-content h1 { border: none; padding: 0; margin-bottom: 30px; }

.admin-section {
  background: none; border: none; box-shadow: none; padding: 0; margin: 0;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Wider cards */
  gap: 25px;
  margin-bottom: 40px;
}
.stat-card {
  background-color: var(--primary-light);
  color: var(--primary-color);
  padding: 25px;
  border-radius: 8px;
  text-align: center;
  font-weight: bold;
  border: 1px solid var(--primary-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}
.stat-card span {
  display: block;
  font-size: 2.8em;
  font-weight: 700;
  margin-bottom: 5px;
  line-height: 1;
}

.admin-form {
  background-color: var(--bg-soft);
  padding: 30px;
  border-radius: 8px;
  margin-bottom: 30px;
  border: 1px solid var(--border-color);
}
.admin-form h2 { margin-top: 0; }

.admin-table select {
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background-color: white;
}
.admin-table .status-update-spinner { margin-left: 10px; font-size: 0.9em; color: var(--text-muted); }

/* =========================================
   Scroll Animations
   ========================================= */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}
.book-list .animate-on-scroll {
  transition-delay: calc(var(--animation-order, 0) * 80ms);
}

/* =========================================
   Responsiveness
   ========================================= */
@media (max-width: 992px) {
  :root { --container-width: 960px; }
  h1 { font-size: 2.4em; }
  .book-list { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .book-cover { height: 300px; }
  .author-intro { flex-direction: column; text-align: center; }
  .author-photo-container img { margin: 0 auto 20px auto; }
  .book-detail-container { flex-direction: column; }
  .book-detail-cover { max-width: 100%; }

  .admin-sidebar { width: 200px; }
  .admin-main-content { padding: 20px; }
}

@media (max-width: 768px) {
  body { font-size: 15px; }
  main#main-content { padding: 0; /* Remove padding for edge-to-edge pages */ }
  .page-content { padding: 30px 15px; } /* Add padding inside pages */
  .site-header { padding: 0 15px; }
  .site-header .logo a { font-size: 1.5em; }

  /* Mobile Navigation */
  .mobile-nav-toggle { display: block; }
  .main-nav {
    position: fixed; top: 0; right: -300px; /* Start off-screen */
    width: 300px; height: 100vh;
    background-color: var(--bg-dark);
    padding: var(--header-height) 20px 20px 20px;
    flex-direction: column;
    align-items: flex-start;
    box-shadow: -5px 0 15px rgba(0,0,0,0.2);
    transition: right 0.4s var(--transition-ease);
    z-index: 1090;
  }
  .main-nav.active {
    right: 0;
  }
  .main-nav ul { flex-direction: column; align-items: stretch; width: 100%; }
  .main-nav li { margin: 0 0 10px 0; width: 100%; }
  .main-nav a { color: rgba(255, 255, 255, 0.8); display: block; padding: 15px; }
  .main-nav a:hover, .main-nav a.active { color: white; background-color: rgba(255, 255, 255, 0.1); }
  .main-nav a::before { display: none; } /* Hide underline on mobile nav */
  .nav-logout-btn { color: rgba(255, 255, 255, 0.8); padding: 15px; width: 100%; text-align: left; }
  .nav-logout-btn:hover { color: var(--secondary-color); }
  /* End Mobile Nav */

  .header-actions { gap: 15px; }
  .header-actions a { font-size: 1.2em; }

  h1 { font-size: 2em; }
  .book-list { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
  .book-cover { height: 260px; }
  .modal-content { width: 95%; max-height: 85vh; padding: 20px; }
  #preview-content-area { min-height: 350px; }
  .client-nav a { padding: 8px 12px; font-size: 0.8em; }
  .basket-table, .orders-table { font-size: 0.9em; }

  .admin-area { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: sticky; top: var(--header-height); z-index: 900; }
  .admin-sidebar h2 { display: none; }
  .admin-nav ul { display: flex; flex-wrap: wrap; justify-content: center; }
  .admin-nav li { margin-bottom: 0; }
  .admin-nav li a { padding: 10px; font-size: 0.8em; }
  .admin-main-content { padding: 20px 15px; }
}

@media (max-width: 480px) {
  .book-list { grid-template-columns: 1fr; }
  .book-cover { height: 300px; }
  .btn { padding: 10px 20px; font-size: 0.8em; }
  .form-row { flex-direction: column; gap: 0; }
  .hero-section { padding: 60px 20px; }
  .hero-section h1 { font-size: 2.5em; }
  .hero-section p { font-size: 1.1em; }
  .author-intro { padding: 20px; }
  .author-photo-container img { max-width: 200px; }
  .auth-form { padding: 20px; }
  .basket-summary-box { flex-direction: column; align-items: stretch; text-align: center; }
  .basket-total { margin-bottom: 10px; }
  .page-content { padding: 20px 15px; } /* Reduce padding on small screens */
}