/* ============================================================
   ComicVerse — Mobile-First Redesign
   Target: Teens & Youth | Bold Comic Aesthetic
   ============================================================ */

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

:root {
  --bg:           #0a0a0f;
  --surface:      #12121a;
  --surface2:     #1a1a28;
  --accent:       #ff3d6b;
  --accent2:      #7c3aed;
  --accent3:      #00d4ff;
  --accent-glow:  rgba(255,61,107,0.35);
  --accent2-glow: rgba(124,58,237,0.35);
  --text:         #f0f0ff;
  --text-muted:   #8888aa;
  --card-bg:      #16161f;
  --border:       #2a2a40;
  --radius:       14px;
  --radius-sm:    8px;
  --radius-lg:    20px;
  --font:         'Segoe UI', system-ui, -apple-system, sans-serif;
  --transition:   0.2s ease;
}

html { scroll-behavior: smooth; }

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

a { color: var(--accent3); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--text); }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent2); border-radius: 99px; }

/* HEADER */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  gap: 0.75rem;
}

.logo {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  flex-shrink: 0;
}

.logo a {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

nav {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

nav a {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  white-space: nowrap;
}

nav a:hover { color: var(--text); background: var(--surface2); }

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

#author-email {
  color: var(--text-muted);
  font-size: 0.8rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* HERO */
.hero {
  text-align: center;
  padding: 3.5rem 1.25rem 2.5rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(124,58,237,0.18) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(255,61,107,0.12) 0%, transparent 60%);
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(1.9rem, 6vw, 3.2rem);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #fff 30%, var(--accent3) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}

.hero p {
  color: var(--text-muted);
  font-size: clamp(0.95rem, 3vw, 1.15rem);
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* COMICS GRID */
.comics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  padding: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
}

@media (min-width: 480px) {
  .comics-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1.25rem; }
}

@media (min-width: 768px) {
  .comics-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.5rem; padding: 2rem; }
}

.comic-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.comic-card:hover,
.comic-card:active {
  transform: translateY(-5px) scale(1.02);
  border-color: var(--accent);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.comic-card img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
}

.comic-card-info { padding: 0.65rem 0.75rem 0.75rem; }

.comic-card-info h3 {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comic-card-info .genre {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.comic-card-info .author {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* BUTTONS */
.btn, button.btn-primary, .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
  color: #fff;
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); color: var(--text); }

.btn-danger {
  background: rgba(220,38,38,0.15);
  color: #f87171;
  border: 1px solid rgba(220,38,38,0.3);
}

.btn-danger:hover { background: rgba(220,38,38,0.3); color: #fff; }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; border-radius: 6px; }

/* READER */
.comic-info { text-align: center; padding: 1rem 1.25rem 0.5rem; }
.comic-info h2 { font-size: clamp(1.1rem, 4vw, 1.5rem); font-weight: 800; }
.comic-info p { color: var(--text-muted); font-size: 0.88rem; margin-top: 0.25rem; }

#chapter-nav { display: flex; gap: 0.5rem; align-items: center; flex-wrap: nowrap; }

#chapter-nav button {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}

#chapter-nav button:hover { background: var(--accent2); border-color: var(--accent2); color: #fff; }

#chapter-select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  flex: 1;
  min-width: 0;
  max-width: 160px;
}

.reader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0.75rem 0.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.reader-container img { width: 100%; height: auto; display: block; border-radius: 4px; }

/* AUTH */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 85vh;
  padding: 1.5rem 1rem;
}

.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.auth-card h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 0.4rem; }

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: var(--surface);
  padding: 0.3rem;
  border-radius: var(--radius-sm);
}

.tab {
  flex: 1;
  padding: 0.55rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition);
}

.tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  box-shadow: 0 2px 10px var(--accent-glow);
}

.auth-card form { display: flex; flex-direction: column; gap: 0.9rem; }

.auth-card input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
  width: 100%;
  transition: border-color var(--transition);
}

.auth-card input:focus { border-color: var(--accent2); }
.error-msg { color: #f87171; font-size: 0.83rem; min-height: 1rem; }

/* AUTHOR PAGES */
.container { max-width: 900px; margin: 0 auto; padding: 1.25rem; }

@media (min-width: 768px) { .container { padding: 2rem 1.5rem; } }

.container h1 {
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 900;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, var(--text) 50%, var(--accent3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 1rem; color: var(--accent3); }

/* AUTHOR FORM */
.author-form { display: flex; flex-direction: column; gap: 1rem; }

.author-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.author-form input,
.author-form select,
.author-form textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
  width: 100%;
  transition: border-color var(--transition);
  font-family: var(--font);
  -webkit-appearance: none;
  appearance: none;
}

.author-form input:focus,
.author-form select:focus,
.author-form textarea:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px var(--accent2-glow);
}

.author-form select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238888aa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

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

.author-form input[type="file"] {
  padding: 0.6rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.author-form input[type="file"]::file-selector-button {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  margin-right: 0.75rem;
  transition: all var(--transition);
}

.author-form input[type="file"]::file-selector-button:hover {
  background: var(--accent2);
  border-color: var(--accent2);
  color: #fff;
}

#cover-preview { border-radius: var(--radius-sm); border: 2px solid var(--border); max-width: 160px; margin-top: 0.5rem; }
#status-msg { font-size: 0.88rem; color: var(--accent3); min-height: 1.2rem; font-weight: 600; }

.inline-form { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: flex-end; }
.inline-form input { flex: 1; min-width: 100px; }
.inline-form button { flex-shrink: 0; }

/* CHAPTERS */
.chapter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.chapter-row:last-child { border-bottom: none; }
.chapter-row span { font-size: 0.9rem; color: var(--text); flex: 1; min-width: 0; }

/* DASHBOARD CARD ACTIONS */
.comics-grid .comic-card .comic-info { padding: 0.65rem 0.75rem 0.75rem; text-align: left; }
.comics-grid .comic-card .comic-info h3 { font-size: 0.88rem; font-weight: 700; margin-bottom: 0.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comics-grid .comic-card .comic-info p { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.6rem; }
.card-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.5rem; }

/* UPLOAD PROGRESS */
#upload-progress { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.3rem; }
#upload-progress p { font-size: 0.85rem; color: var(--text-muted); padding: 0.3rem 0.6rem; background: var(--surface); border-radius: 6px; border-left: 3px solid var(--accent2); }
#upload-progress p:last-child { color: var(--accent3); border-left-color: var(--accent3); }

#page-upload { border: 2px dashed var(--border); background: var(--surface); transition: border-color var(--transition); }
#page-upload:hover { border-color: var(--accent2); }
#page-upload h2 { color: var(--accent); }
#page-files { background: transparent; border: none; padding: 0.5rem 0; color: var(--text-muted); font-size: 0.88rem; width: 100%; margin-bottom: 0.75rem; }

/* LOADING */
.loading { color: var(--text-muted); text-align: center; padding: 3rem 1rem; width: 100%; font-size: 0.95rem; grid-column: 1 / -1; }

/* FOOTER */
footer { text-align: center; padding: 2rem 1rem; color: var(--text-muted); font-size: 0.82rem; border-top: 1px solid var(--border); margin-top: 3rem; }

/* RESPONSIVE */
@media (max-width: 360px) {
  .logo { font-size: 1.2rem; }
  .btn, .btn-primary { padding: 0.55rem 0.9rem; font-size: 0.82rem; }
  .auth-card { padding: 1.5rem 1rem; }
}

@media (min-width: 640px) {
  header { padding: 0.9rem 2rem; }
  .navbar { padding: 0.9rem 2rem; }
  .hero { padding: 5rem 2rem 3rem; }
  .container { padding: 2rem; }
  .card { padding: 1.5rem; }
  .inline-form { flex-wrap: nowrap; }
}

@media (min-width: 1024px) {
  .hero { padding: 6rem 2rem 4rem; }
  #cover-preview { max-width: 200px; }
}
.forgot-link{text-align:right;margin-top:-0.25rem;margin-bottom:0.5rem;font-size:0.82rem;}.forgot-link a{color:var(--text-muted);}.forgot-link a:hover{color:var(--accent3);}
