/* Titchybooks.hu Base Styles */
/* Design System for A7 Booklet Theme */

/* ========================================
   1. CSS Custom Properties (Variables)
   ======================================== */
:root {
  /* Colors */
  --color-bg: #FFFFFF;
  --color-surface: #F5F5F5;
  --color-border: #E0E0E0;
  --color-text: #333333;
  --color-text-muted: #666666;
  --color-accent: #2563EB;
  --color-accent-hover: #1D4ED8;
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-error: #EF4444;
  
  /* Typography */
  --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-family-heading: 'Cardo', Georgia, serif;
  --font-size-base: 16px;
  
  /* Spacing (8px baseline grid) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  /* Shadows */
  --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-strong: 0 8px 24px rgba(0, 0, 0, 0.16);
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  /* Transitions */
  --transition-default: all 0.2s ease-in-out;
  --transition-quick: all 0.15s ease-out;
  
  /* A7 Aspect Ratio */
  --aspect-ratio-a7: 0.705;
}

/* ========================================
   2. Reset and Base Styles
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-size-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family-primary);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
}

/* ========================================
   3. Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-heading);
  line-height: 1.2;
  margin-bottom: var(--space-md);
  color: var(--color-text);
}

h1 {
  font-size: 2rem;
  font-weight: 700;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
}

p {
  margin-bottom: var(--space-md);
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: var(--transition-quick);
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

small {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* ========================================
   4. Layout Utilities
   ======================================== */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.gap-sm {
  gap: var(--space-sm);
}

.gap-md {
  gap: var(--space-md);
}

.gap-lg {
  gap: var(--space-lg);
}

.grid {
  display: grid;
  gap: var(--space-md);
}

/* Responsive grid for gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

@media (min-width: 640px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
  }
}

@media (min-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
  }
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ========================================
   5. Component Styles
   ======================================== */

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-family: var(--font-family-primary);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-default);
  text-decoration: none;
  gap: var(--space-sm);
}

.btn-primary {
  background-color: var(--color-accent);
  color: white;
}

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

.btn-secondary {
  background-color: white;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}

.btn-secondary:hover {
  background-color: var(--color-surface);
  text-decoration: none;
}

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

.btn-danger:hover {
  background-color: #DC2626;
  text-decoration: none;
}

.btn:disabled,
.btn[disabled] {
  background-color: var(--color-border);
  color: var(--color-text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
  height: 32px;
}

.btn-md {
  height: 40px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  height: 48px;
}

/* --- Forms --- */
.form-group {
  margin-bottom: var(--space-lg);
}

label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 500;
  color: var(--color-text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-family-primary);
  font-size: 1rem;
  color: var(--color-text);
  background-color: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: var(--transition-default);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input.error,
textarea.error,
select.error {
  border-color: var(--color-error);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.error-message {
  color: var(--color-error);
  font-size: 0.875rem;
  margin-top: var(--space-xs);
}

.char-counter {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
  text-align: right;
}

.char-counter.warning {
  color: var(--color-warning);
}

.char-counter.error {
  color: var(--color-error);
}

/* --- Cards --- */
.card {
  background-color: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-light);
  padding: var(--space-md);
  transition: var(--transition-default);
}

@media (min-width: 1024px) {
  .card {
    padding: var(--space-lg);
  }
}

.card:hover {
  box-shadow: var(--shadow-medium);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  transform: translateY(-2px);
}

/* --- Book Card --- */
.book-card {
  background-color: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-light);
  overflow: hidden;
  transition: var(--transition-default);
  cursor: pointer;
}

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

.book-cover {
  width: 100%;
  aspect-ratio: var(--aspect-ratio-a7);
  object-fit: cover;
  background-color: var(--color-surface);
}

.book-info {
  padding: var(--space-md);
}

.book-title {
  font-family: var(--font-family-heading);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
}

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  line-height: 1;
}

.badge-draft {
  background-color: #E5E7EB;
  color: #374151;
}

.badge-pending {
  background-color: #DBEAFE;
  color: #1E40AF;
}

.badge-approved {
  background-color: #D1FAE5;
  color: #065F46;
}

.badge-rejected {
  background-color: #FEE2E2;
  color: #991B1B;
}

.badge-category {
  background-color: var(--color-surface);
  color: var(--color-text);
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-md);
}

.modal {
  background-color: white;
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-strong);
  position: relative;
}

.modal-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-md);
  justify-content: flex-end;
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-width: 320px;
}

.toast {
  background-color: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-strong);
  padding: var(--space-md);
  display: flex;
  align-items: start;
  gap: var(--space-md);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-success {
  border-left: 4px solid var(--color-success);
}

.toast-error {
  border-left: 4px solid var(--color-error);
}

.toast-warning {
  border-left: 4px solid var(--color-warning);
}

.toast-info {
  border-left: 4px solid var(--color-accent);
}

.toast-message {
  flex: 1;
  font-size: 0.875rem;
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 1.25rem;
  padding: 0;
  line-height: 1;
}

/* --- Navigation --- */
.navbar {
  background-color: white;
  box-shadow: var(--shadow-light);
  padding: var(--space-md) 0;
  margin-bottom: var(--space-xl);
}

.navbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.navbar-brand {
  font-family: var(--font-family-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
}

.navbar-brand:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* --- Tables --- */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: var(--space-md);
  background-color: var(--color-surface);
  font-weight: 600;
  border-bottom: 2px solid var(--color-border);
}

td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

tr:hover {
  background-color: var(--color-surface);
}

/* --- Category Filter Chips --- */
.category-chips {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

.chip {
  padding: 8px 16px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition-default);
}

.chip:hover {
  background-color: var(--color-border);
}

.chip.active {
  background-color: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

/* --- Upload Area --- */
.upload-area {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  text-align: center;
  cursor: pointer;
  transition: var(--transition-default);
  background-color: var(--color-surface);
}

.upload-area:hover {
  border-color: var(--color-accent);
  background-color: white;
}

.upload-area.has-file {
  border-style: solid;
  border-color: var(--color-success);
}

.upload-preview {
  width: 100%;
  aspect-ratio: var(--aspect-ratio-a7);
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-top: var(--space-md);
}

/* --- Loading Spinner --- */
.spinner {
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255,  flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

/* ========================================
   6. Page-Specific Styles
   ======================================== */

/* --- Auth Pages (Login/Register) --- */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  background-color: var(--color-surface);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background-color: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-medium);
  padding: var(--space-2xl);
}

.auth-title {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-lg);
  color: var(--color-text-muted);
}

/* --- Dashboard Sections --- */
.dashboard-section {
  margin-bottom: var(--space-2xl);
}

.dashboard-section-title {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 2px solid var(--color-border);
}

.book-list-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  background-color: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-light);
  margin-bottom: var(--space-md);
}

.book-list-item:hover {
  box-shadow: var(--shadow-medium);
}

.book-thumbnail {
  width: 80px;
  aspect-ratio: var(--aspect-ratio-a7);
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.book-details {
  flex: 1;
  min-width: 0;
}

.book-actions {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

/* --- Create Page --- */
.create-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-2xl);
  position: relative;
}

.create-step {
  flex: 1;
  text-align: center;
  position: relative;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--color-border);
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.create-step.active .step-number {
  background-color: var(--color-accent);
  color: white;
}

.create-step.complete .step-number {
  background-color: var(--color-success);
  color: white;
}

.mode-selector {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

@media (min-width: 640px) {
  .mode-selector {
    grid-template-columns: 1fr 1fr;
  }
}

.mode-card {
  padding: var(--space-xl);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-align: center;
  cursor: pointer;
  transition: var(--transition-default);
}

.mode-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-medium);
}

.mode-card.selected {
  border-color: var(--color-accent);
  background-color: rgba(37, 99, 235, 0.05);
}

.ai-toolbar {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.ai-toolbar .btn {
  flex: 1;
  min-width: 120px;
}

/* ========================================
   7. Responsive Media Queries
   ======================================== */
@media (max-width: 640px) {
  .container {
    padding: 0 var(--space-sm);
  }
  
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1.25rem;
  }
  
  .navbar-links {
    flex-direction: column;
    align-items: stretch;
  }
  
  .modal {
    max-width: 100%;
  }
  
  .toast-container {
    left: var(--space-md);
    right: var(--space-md);
    max-width: none;
  }
}

/* ========================================
   8. Utility Classes
   ======================================== */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-muted {
  color: var(--color-text-muted);
}

.text-error {
  color: var(--color-error);
}

.text-success {
  color: var(--color-success);
}

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.w-full { width: 100%; }

.block { display: block; }
.inline-block { display: inline-block; }
