/*
Theme Name: Manga Reader Theme
Theme URI: https://example.com/manga-reader
Author: Your Name
Author URI: https://example.com
Description: Professional manga reading theme compatible with Auto Update Manga plugin. Dark purple MangaDex-style design with vertical scrolling reader.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: manga-theme
Tags: manga, comics, dark, purple, reading, responsive
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4

This theme is designed to work with the "Auto Update Manga" plugin.
*/

/* ==========================================
   GLOBAL STYLES
   ========================================== */

:root {
  --bg-primary: #1a1625;
  --bg-secondary: #0f0d15;
  --bg-card: #201c2e;
  --text-primary: #ffffff;
  --text-secondary: #b8b8d1;
  --accent-orange: #ff6740;
  --accent-purple: #8b5cf6;
  --border-color: rgba(255, 255, 255, 0.1);
  --hover-overlay: rgba(255, 103, 64, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==========================================
   HEADER & NAVIGATION
   ========================================== */

.site-header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--accent-orange);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-orange), var(--accent-purple));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.nav-search {
  flex: 1;
  max-width: 500px;
  position: relative;
}

@media (max-width: 768px) {
  .nav-search {
    flex: 1 1 100%;
    max-width: 100%;
  }
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.3s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-orange);
  background: var(--bg-card);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.nav-menu {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-menu a {
  color: var(--text-secondary);
  transition: color 0.3s;
  font-weight: 500;
}

.nav-menu a:hover,
.nav-menu a.active {
  color: var(--accent-orange);
}

/* ==========================================
   HERO SECTION
   ========================================== */

.hero-section {
  position: relative;
  padding: 3rem 0 4rem 0;
  min-height: 500px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--bg-primary);
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50px;
  left: -50px;
  right: -50px;
  bottom: -50px;
  background-image: var(--manga-cover-bg);
  background-size: cover;
  background-position: center;
  filter: blur(60px) brightness(0.3) saturate(1.2);
  transform: scale(1.2);
  z-index: 0;
  opacity: 0.8;
}

.hero-section::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(26, 22, 37, 0.98) 0%,
    rgba(26, 22, 37, 0.92) 30%,
    rgba(26, 22, 37, 0.85) 60%,
    rgba(26, 22, 37, 0.95) 100%
  );
  z-index: 1;
}

.hero-content {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 3rem;
  align-items: center;
  position: relative;
  z-index: 2;
}

.manga-cover {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8),
              0 0 100px rgba(255, 103, 64, 0.25),
              0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(0);
  z-index: 3;
}

.manga-cover:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.9),
              0 0 120px rgba(255, 103, 64, 0.35),
              0 0 0 1px rgba(255, 255, 255, 0.2);
}

.manga-cover img {
  width: 100%;
  height: auto;
  display: block;
}

.cover-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.7));
  opacity: 0;
  transition: opacity 0.3s;
}

.manga-cover:hover .cover-overlay {
  opacity: 1;
}

.manga-info h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.manga-meta {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.meta-label {
  font-weight: 700;
  color: var(--accent-orange);
  font-size: 1.1rem;
}

.genres-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.genre-tag {
  background: rgba(75, 60, 120, 0.4);
  border: 1.5px solid rgba(120, 100, 180, 0.5);
  padding: 0.5rem 1.1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  backdrop-filter: blur(10px);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.genre-tag:hover {
  background: rgba(100, 80, 160, 0.5);
  border-color: rgba(150, 120, 220, 0.7);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(100, 80, 160, 0.4);
}

.manga-description {
  line-height: 1.8;
  margin-bottom: 2rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
  max-width: 700px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
  padding: 0.4rem 0.8rem;
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 6px;
  font-size: 0.85rem;
  color: #a78bfa;
  transition: all 0.3s;
}

.genre-tag:hover {
  background: rgba(139, 92, 246, 0.3);
  border-color: rgba(139, 92, 246, 0.5);
}

.manga-description {
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.read-button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, #ff6740 0%, #ff8560 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(255, 103, 64, 0.4),
              0 0 0 1px rgba(255, 255, 255, 0.1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.read-button:hover {
  background: linear-gradient(135deg, #ff7858 0%, #ff9670 100%);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(255, 103, 64, 0.5),
              0 0 0 1px rgba(255, 255, 255, 0.2);
}

/* ==========================================
   CHAPTERS SECTION
   ========================================== */

.chapters-section {
  padding: 3rem 0;
}

.chapters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.chapters-header h2 {
  font-size: 1.8rem;
  color: var(--text-primary);
}

.chapters-count {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.chapter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chapter-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-orange), var(--accent-purple));
  transform: scaleX(0);
  transition: transform 0.3s;
}

.chapter-card:hover {
  border-color: var(--accent-orange);
  background: rgba(255, 103, 64, 0.05);
  transform: translateY(-2px);
}

.chapter-card:hover::before {
  transform: scaleX(1);
}

.chapter-card-content {
  flex: 1;
}

.chapter-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chapter-arrow {
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.4);
  transition: all 0.3s;
}

.chapter-card:hover .chapter-arrow {
  color: var(--accent-orange);
  transform: translateX(5px);
}

/* ==========================================
   CHAPTER READER PAGE
   ========================================== */

.reader-page {
  background: var(--bg-secondary);
  min-height: 100vh;
}

.reader-header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.reader-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.back-to-home {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  transition: color 0.3s;
}

.back-to-home:hover {
  color: var(--accent-orange);
}

.chapter-title-header {
  flex: 1;
  text-align: center;
}

.chapter-title-header h1 {
  font-size: 1.3rem;
  color: var(--text-primary);
  font-weight: 600;
}

.reader-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.zoom-btn {
  width: 36px;
  height: 36px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.zoom-btn:hover {
  background: var(--bg-card);
  border-color: var(--accent-orange);
  color: var(--accent-orange);
}

.zoom-level {
  min-width: 60px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ==========================================
   TOP NAVIGATION
   ========================================== */

.reader-top-nav {
  background: rgba(15, 13, 21, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
}

.top-nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* ==========================================
   READER CONTENT
   ========================================== */

.reader-content {
  padding: 2rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pages-container {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: all 0.3s;
}

.page-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 0;
}

.page-image {
  width: 100%;
  height: auto;
  display: block;
  background: var(--bg-primary);
}

.page-number {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.8);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.reader-footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 0;
  position: sticky;
  bottom: 0;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.footer-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.chapter-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}

.chapter-nav-btn:hover:not(:disabled) {
  background: var(--accent-orange);
  border-color: var(--accent-orange);
  transform: translateY(-2px);
}

.chapter-nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.scroll-to-top-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--accent-purple);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}

.scroll-to-top-btn:hover {
  background: #a78bfa;
  transform: translateY(-2px);
}

/* ==========================================
   FOOTER
   ========================================== */

.site-footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: 3rem;
  text-align: center;
  color: var(--text-secondary);
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 768px) {
  /* Container */
  .container {
    padding: 0 1rem;
  }

  /* Header & Navigation */
  .site-header {
    padding: 0.75rem 0;
  }

  .navbar {
    gap: 0.75rem;
  }

  .site-logo {
    font-size: 1.1rem;
    order: 1;
    flex: 0 0 auto;
    letter-spacing: -0.3px;
  }

  .logo-icon {
    width: 30px;
    height: 30px;
    font-size: 1.1rem;
  }

  .nav-menu {
    order: 2;
    margin-left: auto;
    gap: 1.5rem;
    font-size: 0.9rem;
    flex: 0 0 auto;
  }

  .nav-search {
    order: 3;
    flex: 1 1 100% !important;
    max-width: 100% !important;
    margin: 0.5rem 0 0 0;
  }

  .search-input {
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    font-size: 0.88rem;
  }

  .search-icon {
    left: 0.65rem;
  }

  /* Hero Section */
  .hero-section {
    padding: 2rem 0 3rem 0;
    min-height: auto;
  }

  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }

  .manga-cover {
    max-width: 240px;
    margin: 0 auto;
  }

  .manga-info h1 {
    font-size: 2rem;
    margin-bottom: 0.875rem;
  }

  .manga-meta {
    justify-content: center;
    font-size: 0.9rem;
    gap: 1rem;
  }

  .meta-item {
    font-size: 0.9rem;
  }

  .meta-label {
    font-size: 1rem;
  }

  .manga-description {
    text-align: left;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
  }

  .genres-list {
    justify-content: center;
    gap: 0.5rem;
  }

  .genre-tag {
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
  }

  .read-button {
    padding: 0.875rem 1.75rem;
    font-size: 0.95rem;
    width: 100%;
    max-width: 300px;
    justify-content: center;
  }

  /* Chapters Section */
  .chapters-section {
    padding: 2rem 0;
  }

  .chapters-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .chapters-header h2 {
    font-size: 1.5rem;
  }

  .chapters-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .chapter-card {
    padding: 1rem;
  }

  .chapter-title {
    font-size: 1rem;
  }

  /* Reader Page */
  .reader-header {
    padding: 0.75rem 0;
  }

  .reader-nav {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }

  .chapter-title-header {
    order: 1;
  }

  .chapter-title-header h1 {
    font-size: 1.1rem;
  }

  .back-to-home {
    order: 2;
    justify-content: center;
    padding: 0.5rem;
  }

  .reader-controls {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .zoom-controls {
    gap: 0.75rem;
  }

  .zoom-btn {
    width: 40px;
    height: 40px;
  }

  .zoom-level {
    display: none;
  }

  /* Reader Content */
  .reader-content {
    padding: 1rem 0;
  }

  .pages-container {
    max-width: 100%;
    width: 100% !important;
  }

  .page-wrapper {
    margin-bottom: 0;
  }

  /* Reader Top Navigation - Remove it */
  .reader-top-nav {
    display: none;
  }

  /* Reader Footer */
  .reader-footer {
    padding: 1rem 0;
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(26, 22, 37, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.5);
  }

  .footer-nav {
    flex-direction: row;
    gap: 0.5rem;
    justify-content: space-between;
  }

  .chapter-nav-btn {
    flex: 1;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
    min-height: 44px;
  }

  .scroll-to-top-btn {
    flex: 1;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
    min-height: 44px;
  }

  /* Footer */
  .site-footer {
    padding: 1.5rem 0;
    font-size: 0.9rem;
  }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
  .site-logo {
    font-size: 1rem;
  }

  .manga-info h1 {
    font-size: 1.75rem;
  }

  .manga-cover {
    max-width: 200px;
  }

  .chapter-nav-btn,
  .scroll-to-top-btn {
    padding: 0.65rem 0.35rem;
    font-size: 0.8rem;
  }

  .read-button {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
  }
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */

.text-center {
  text-align: center;
}

.mb-1 {
  margin-bottom: 1rem;
}

.mb-2 {
  margin-bottom: 2rem;
}

.mt-2 {
  margin-top: 2rem;
}

.hidden {
  display: none;
}
