/* =====================================================
   CSS VARIABLES - LIGHT MODE (DEFAULT)
===================================================== */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-header: #ffffff;
  --bg-header-bottom: #f8f9fa;

  --text-primary: #333333;
  --text-light: #666666;
  --text-muted: #999999;
  --text-header-nav: #333333;

  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --header-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);

  --accent-color: #4a9eff;
  --hover-color: #2b7ee6;
  --accent-light: #6fb1ff;

  --blue-shadow-light: rgba(74, 158, 255, 0.3);
  --blue-shadow-medium: rgba(74, 158, 255, 0.4);
  --blue-shadow-strong: rgba(74, 158, 255, 0.5);
}

/* =====================================================
   CSS VARIABLES - DARK MODE
===================================================== */
body.dark-mode {
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-header: #1a1a1a;
  --bg-header-bottom: #1a1a1a;

  --text-primary: #e0e0e0;
  --text-light: #ffffff;
  --text-muted: #999999;
  --text-header-nav: #e0e0e0;

  --border-color: #333333;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  --header-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);

  --blue-shadow-light: rgba(74, 158, 255, 0.4);
  --blue-shadow-medium: rgba(74, 158, 255, 0.5);
  --blue-shadow-strong: rgba(74, 158, 255, 0.6);
}

/* =====================================================
   GLOBAL DARK MODE STYLES
===================================================== */
body.dark-mode {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s ease;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

ul {
  list-style: none;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.desktop-only {
  display: block;
}

.mobile-tablet-only {
  display: none;
}

/* =====================================================
   SITE HEADER
===================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--bg-header);
  box-shadow: var(--header-shadow);
  transition:
    background-color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.3s ease;
}

/* =====================================================
   HEADER TOP
===================================================== */
.header-top {
  background-color: var(--bg-header);
  padding: 15px 0;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  z-index: 1002;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease;
}

.header-top .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: relative;
}

/* =====================================================
   LOGO
===================================================== */
.header-logo {
  display: flex;
  align-items: center;
}

.header-logo a {
  display: flex;
  align-items: center;
}

.header-logo img {
  height: 40px;
  width: auto;
  transition: opacity 0.3s ease;
}

.header-logo a:hover img {
  opacity: 0.85;
}

.logo-mobile {
  display: none;
}

/* =====================================================
   DARK MODE TOGGLE BUTTON - ENHANCED BLUE THEME
===================================================== */
.dark-mode-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(74, 158, 255, 0.15) 0%,
    rgba(43, 126, 230, 0.15) 100%
  );
  color: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  margin-left: 15px;
  flex-shrink: 0;
  border: 1px solid rgba(74, 158, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.dark-mode-toggle::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(74, 158, 255, 0.2),
    transparent
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dark-mode-toggle:hover::before {
  opacity: 1;
}

body.dark-mode .dark-mode-toggle {
  background: linear-gradient(
    135deg,
    rgba(74, 158, 255, 0.25) 0%,
    rgba(43, 126, 230, 0.25) 100%
  );
  border-color: rgba(74, 158, 255, 0.3);
  box-shadow: 0 0 15px rgba(74, 158, 255, 0.2);
  color: #ffd93d;
}

.dark-mode-toggle:hover {
  background: linear-gradient(
    135deg,
    var(--accent-color) 0%,
    var(--hover-color) 100%
  );
  color: white;
  transform: rotate(180deg) scale(1.1);
  box-shadow: 0 4px 12px var(--blue-shadow-medium);
}

.dark-mode-toggle i {
  font-size: 20px;
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease;
}

.dark-mode-toggle:hover i {
  transform: scale(1.1);
}

/* =====================================================
   HEADER ACTIONS
===================================================== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-left: auto;
}

/* =====================================================
   AUTH BUTTONS - BLUE THEME
===================================================== */
.auth-buttons {
  display: flex;
  gap: 10px;
}

.btn-register,
.btn-login {
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-register {
  background-color: transparent;
  border: 2px solid var(--accent-color);
  color: var(--accent-color);
}

.btn-register::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent-color);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
  z-index: -1;
}

.btn-register:hover {
  color: white;
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px var(--blue-shadow-light);
}

.btn-register:hover::before {
  transform: scaleX(1);
}

.btn-login {
  background: linear-gradient(
    135deg,
    var(--accent-color) 0%,
    var(--hover-color) 100%
  );
  color: white;
  border: 2px solid transparent;
  box-shadow: 0 2px 8px var(--blue-shadow-light);
}

.btn-login:hover {
  background: linear-gradient(
    135deg,
    var(--hover-color) 0%,
    var(--accent-color) 100%
  );
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--blue-shadow-medium);
}

/* =====================================================
   SEARCH ICON BUTTON
===================================================== */
.search-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(74, 158, 255, 0.15) 0%,
    rgba(43, 126, 230, 0.15) 100%
  );
  color: var(--text-primary);
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
  border: 1px solid rgba(74, 158, 255, 0.2);
}

body.dark-mode .search-icon-btn {
  background: linear-gradient(
    135deg,
    rgba(74, 158, 255, 0.25) 0%,
    rgba(43, 126, 230, 0.25) 100%
  );
  border-color: rgba(74, 158, 255, 0.3);
  color: var(--text-primary);
}

.search-icon-btn:hover {
  background: linear-gradient(
    135deg,
    var(--accent-color) 0%,
    var(--hover-color) 100%
  );
  color: white;
  transform: scale(1.1);
  box-shadow: 0 4px 12px var(--blue-shadow-light);
}

.search-icon-btn i {
  font-size: 18px;
}

/* =====================================================
   SEARCH FORM
===================================================== */
.search-form {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
}

.search-input {
  width: 100%;
  padding: 12px 50px 12px 20px;
  border: none;
  border-radius: 25px;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

body.dark-mode .search-input {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(74, 158, 255, 0.2);
  color: var(--text-primary);
}

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

body.dark-mode .search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.search-input:focus {
  outline: none;
  background-color: var(--bg-primary);
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

body.dark-mode .search-input:focus {
  background-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.2);
}

.search-submit {
  position: absolute;
  right: 0px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--accent-color) 0%,
    var(--hover-color) 100%
  );
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px var(--blue-shadow-light);
}

.search-submit:hover {
  background: linear-gradient(
    135deg,
    var(--hover-color) 0%,
    var(--accent-color) 100%
  );
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 12px var(--blue-shadow-medium);
}

/* =====================================================
   SEARCH RESULTS
===================================================== */
.search-results {
  margin-top: 5px;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  background-color: var(--bg-secondary);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  z-index: 1003;
  color: var(--text-primary);
}

body.dark-mode .search-results {
  background-color: #1a1a1a;
  border-color: rgba(74, 158, 255, 0.2);
}

.search-results.active {
  max-height: 550px;
  overflow-y: auto;
}

.search-results::-webkit-scrollbar {
  width: 8px;
}

.search-results::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.search-results::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb:hover {
  background: var(--hover-color);
}

.search-results-list {
  padding: 10px;
}

.search-result-item {
  display: flex;
  gap: 15px;
  padding: 12px;
  border-radius: 8px;
  transition: background-color 0.3s ease;
  cursor: pointer;
}

.search-result-item:hover {
  background-color: rgba(74, 158, 255, 0.1);
}

.search-result-avatar {
  width: 60px;
  height: 80px;
  border-radius: 5px;
  overflow: hidden;
  flex-shrink: 0;
  background-color: rgba(0, 0, 0, 0.1);
}

body.dark-mode .search-result-avatar {
  background-color: rgba(255, 255, 255, 0.05);
}

.search-result-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-result-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}

.search-result-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-alt-title {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-chapter {
  font-size: 13px;
  color: var(--accent-color);
  font-weight: 500;
}

.search-loading,
.search-no-results {
  padding: 30px;
  text-align: center;
  color: var(--text-muted);
}

.search-loading i {
  font-size: 30px;
  animation: spin 1s linear infinite;
  color: var(--accent-color);
}

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

/* =====================================================
   HEADER BOTTOM - NAVIGATION
===================================================== */
.header-bottom {
  background-color: var(--bg-header-bottom);
  padding: 0;
  position: relative;
  z-index: 999;
  transition: background-color 0.3s ease;
  border-top: 1px solid var(--border-color);
}

body.dark-mode .header-bottom {
  border-top-color: #333;
}

.main-navigation {
  position: relative;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 5px;
}

.nav-menu > li {
  position: relative;
}

.nav-menu > li > a {
  display: block;
  padding: 15px 18px;
  color: var(--text-header-nav);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
}

.nav-menu > li > a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 80%;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--accent-color) 0%,
    var(--hover-color) 100%
  );
  transition: transform 0.3s ease;
}

.nav-menu > li > a:hover {
  color: var(--accent-color);
}

.nav-menu > li > a:hover::after {
  transform: translateX(-50%) scaleX(1);
}

.dropdown-toggle i {
  margin-left: 5px;
  font-size: 12px;
  transition: transform 0.3s ease;
}

.has-dropdown.active .dropdown-toggle i {
  transform: rotate(180deg);
}

/* =====================================================
   DROPDOWN & MEGA MENU
===================================================== */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background-color: var(--bg-secondary);
  border-radius: 5px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 100;
  border: 1px solid var(--border-color);
}

body.dark-mode .dropdown-menu {
  background-color: #1a1a1a;
  border-color: rgba(74, 158, 255, 0.2);
}

.has-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu a {
  display: block;
  padding: 12px 20px;
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.3s ease;
}

.dropdown-menu a:hover {
  background-color: rgba(74, 158, 255, 0.1);
  color: var(--accent-color);
  padding-left: 25px;
}

.mega-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 600px;
  max-width: 800px;
  background-color: var(--bg-secondary);
  border-radius: 5px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 100;
  border: 1px solid var(--border-color);
}

body.dark-mode .mega-menu {
  background-color: #1a1a1a;
  border-color: rgba(74, 158, 255, 0.2);
}

.has-dropdown:hover .mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mega-menu-content {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  padding: 15px;
}

.mega-menu-content a {
  padding: 10px 15px;
  color: var(--text-primary);
  font-size: 14px;
  border-radius: 5px;
  transition: all 0.3s ease;
}

.mega-menu-content a:hover {
  background-color: rgba(74, 158, 255, 0.1);
  color: var(--accent-color);
}

.loading-genres {
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
}

.loading-genres i {
  margin-right: 8px;
  color: var(--accent-color);
}

/* =====================================================
   USER MENU & NOTIFICATION - BLUE THEME
===================================================== */
.user-menu {
  display: flex;
  align-items: center;
}

.user-menu-list {
  display: flex;
  align-items: center;
  gap: 15px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.notification-bell {
  position: relative;
}

.icon-notification {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    rgba(74, 158, 255, 0.15) 0%,
    rgba(43, 126, 230, 0.15) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  border: 1px solid rgba(74, 158, 255, 0.2);
}

body.dark-mode .icon-notification {
  background: linear-gradient(
    135deg,
    rgba(74, 158, 255, 0.25) 0%,
    rgba(43, 126, 230, 0.25) 100%
  );
  border-color: rgba(74, 158, 255, 0.3);
}

.icon-notification:hover {
  background: linear-gradient(
    135deg,
    var(--accent-color) 0%,
    var(--hover-color) 100%
  );
  transform: scale(1.1);
  box-shadow: 0 4px 12px var(--blue-shadow-light);
}

.icon-notification i {
  font-size: 18px;
  color: var(--text-primary);
  transition: color 0.3s ease;
}

.icon-notification:hover i {
  color: white;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: linear-gradient(135deg, #ff4757 0%, #ff6b6b 100%);
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 15px);
  right: 0;
  width: 320px;
  max-height: 400px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1005;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

body.dark-mode .notification-dropdown {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  background-color: #1a1a1a;
  border-color: rgba(74, 158, 255, 0.2);
}

@media (min-width: 1025px) {
  .notification-bell:hover .notification-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

.notification-bell.active .notification-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.notification-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-primary);
}

.notification-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.notification-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 340px;
  overflow-y: auto;
}

.notification-list::-webkit-scrollbar {
  width: 6px;
}

.notification-list::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.notification-list::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 3px;
}

.notification-list::-webkit-scrollbar-thumb:hover {
  background: var(--hover-color);
}

.notification-list li {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.3s ease;
  cursor: pointer;
}

.notification-list li:last-child {
  border-bottom: none;
}

.notification-list li:hover {
  background-color: rgba(74, 158, 255, 0.1);
}

.notification-list li.no-notification {
  text-align: center;
  color: var(--text-muted);
  cursor: default;
  padding: 30px 20px;
}

.notification-list li.no-notification:hover {
  background-color: transparent;
}

.notification-item {
  display: block;
  color: var(--text-primary);
}

.notification-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 5px;
  line-height: 1.4;
  color: var(--text-primary);
}

.notification-time {
  font-size: 12px;
  color: var(--text-muted);
}

.notification-item.unread .notification-title {
  font-weight: 600;
  color: var(--accent-color);
}

/* =====================================================
   USER PROFILE & DROPDOWN
===================================================== */
.user-profile {
  position: relative;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid rgba(74, 158, 255, 0.2);
  transition: all 0.3s ease;
  background-color: var(--bg-secondary);
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.1);
}

body.dark-mode .user-avatar {
  background-color: #1a1a1a;
  border-color: rgba(74, 158, 255, 0.4);
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.user-avatar:hover {
  border-color: var(--accent-color);
  transform: scale(1.1);
  box-shadow:
    0 0 0 4px rgba(74, 158, 255, 0.2),
    0 4px 12px rgba(74, 158, 255, 0.3);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 15px);
  right: 0;
  width: 280px;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1005;
  overflow: hidden;
  border: 1px solid rgba(74, 158, 255, 0.1);
}

body.dark-mode .user-dropdown {
  background-color: #1a1a1a;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  border-color: rgba(74, 158, 255, 0.2);
}

@media (min-width: 1025px) {
  .user-profile:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

.user-profile.active .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-info {
  padding: 20px;
  background: linear-gradient(
    135deg,
    var(--accent-color) 0%,
    var(--hover-color) 100%
  );
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-info img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid white;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

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

.user-name {
  font-size: 15px;
  font-weight: 600;
  color: white;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-email {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-links {
  list-style: none;
  margin: 0;
  padding: 10px 0;
}

.user-menu-links li {
  border-bottom: 1px solid var(--border-color);
}

body.dark-mode .user-menu-links li {
  border-bottom-color: #333;
}

.user-menu-links li:last-child {
  border-bottom: none;
}

.user-menu-links a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.3s ease;
}

body.dark-mode .user-menu-links a {
  color: #e0e0e0;
}

.user-menu-links a:hover {
  background-color: rgba(74, 158, 255, 0.1);
  color: var(--accent-color);
  padding-left: 25px;
}

.user-menu-links a i {
  width: 18px;
  text-align: center;
  font-size: 16px;
  color: var(--accent-color);
}

.user-menu-links li:last-child a:hover {
  color: #ff4757;
}

.user-menu-links li:last-child a:hover i {
  color: #ff4757;
}

.mobile-menu-toggle {
  display: none;
  width: 40px;
  height: 40px;

  font-size: 20px;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  transition: all 0.3s ease;
  border: none;
  outline: none;
}

body.dark-mode .mobile-menu-toggle {
  color: white;
}

.mobile-menu-toggle:hover {
  color: var(--accent-color);
}

.mobile-menu-toggle:focus {
  outline: none;
  border: none;
}

.mobile-menu-toggle i {
  transition: all 0.3s ease;
}

.search-mobile-expand {
  display: none;
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.3s ease;
}

.search-mobile-expand.active {
  max-height: 100vh;
  opacity: 1;
  padding: 15px 0;
}

.search-mobile-expand .container {
  position: relative;
}

.search-results-fullscreen {
  position: fixed;
  top: 160px;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-primary);
  z-index: 1004;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.search-results-fullscreen.active {
  opacity: 1;
  pointer-events: auto;
}

.search-results-fullscreen .search-results-list {
  padding: 20px;
}

/* =====================================================
   RESPONSIVE - TABLET (≤1024px)
===================================================== */
@media (max-width: 1024px) {
  .header-top .container {
    flex-wrap: wrap;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-tablet-only {
    display: flex !important;
  }

  .search-mobile-expand {
    display: block;
  }

  .header-logo {
    order: 1;
  }

  .dark-mode-toggle {
    order: 2;
    margin-left: 15px;
  }

  .header-actions {
    order: 3;
    margin-left: auto;
  }

  .header-bottom {
    position: relative;
    background-color: transparent;
  }

  .header-bottom .container {
    padding: 0 20px;
    width: 100%;
  }

  .main-navigation {
    width: 100%;
    position: relative;
  }

  .nav-menu {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0;
    background: transparent;
    padding: 0;
    overflow: visible;
    transition: all 0.3s ease;
    align-items: stretch;
  }

  .nav-menu > li {
    display: none;
    border-bottom: 1px solid var(--border-color);
  }

  .nav-menu > li:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: none;
    padding: 15px 0;
    width: 100%;
    overflow: visible;
  }

  .nav-menu > li:first-child > a {
    display: block;
  }

  .mobile-menu-toggle {
    display: flex;
    position: relative;
    z-index: 1001;
    margin-left: auto;
    flex-shrink: 0;
    min-width: 40px;
    width: 40px;
    height: 40px;
  }

  .nav-menu.active {
    background-color: var(--bg-primary);
    width: calc(100% + 40px);
    margin-left: -20px;
    margin-right: -20px;
    padding: 0 0 20px 0;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  }

  .nav-menu.active > li {
    display: block;
    text-align: left !important;
  }

  .nav-menu.active > li:first-child {
    display: flex;
    justify-content: space-between;
    overflow: visible;

    padding: 15px 20px;

    align-items: center;
    border-bottom: 1px solid var(--border-color);
  }

  .nav-menu.active > li:first-child > a {
    display: block;
    padding: 0;
    text-align: left;

    font-weight: bold;
  }

  .nav-menu.active .mobile-menu-toggle {
    background-color: #ffffff;
    color: #000000;
    width: 25px;
    height: 25px;
    border-radius: 2px;
  }

  .nav-menu.active .mobile-menu-toggle i {
    font-size: 14px;
    font-weight: bold;
  }

  .nav-menu.active > li > a,
  .nav-menu.active > li > p {
    display: block;
    padding: 15px 20px;
    font-size: 15px;
    color: var(--text-primary);
    text-align: left !important;
    width: 100%;
  }

  .nav-menu.active .dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-align: left;
    cursor: pointer;
  }

  .mega-menu,
  .dropdown-menu {
    position: static;
    width: 100%;
    min-width: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border-radius: 0;
    background-color: transparent;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    border: none;
  }

  .has-dropdown.active .mega-menu,
  .has-dropdown.active .dropdown-menu {
    max-height: 1500px;
  }

  .mega-menu-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding: 10px 20px;
    gap: 10px 20px;
    background-color: var(--bg-secondary);
    border-radius: 0;
  }

  .mega-menu-content a {
    display: block;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: none;
    text-align: left;
  }

  .mega-menu-content a:hover {
    color: var(--accent-color);
  }

  .notification-dropdown,
  .user-dropdown {
    position: fixed;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: 400px;
    margin: 0 auto;
    top: 115px;
  }
}

/* =====================================================
   RESPONSIVE - MOBILE (≤767px)
===================================================== */
@media (max-width: 767px) {
  .header-top {
    padding: 12px 0;
  }

  .header-logo img {
    height: 35px;
  }

  .logo-desktop {
    display: none;
  }

  .logo-mobile {
    display: block;
  }

  .auth-buttons {
    gap: 8px;
  }

  .btn-register,
  .btn-login {
    padding: 6px 12px;
    font-size: 12px;
  }

  .search-icon-btn,
  .dark-mode-toggle {
    width: 35px;
    height: 35px;
  }

  .dark-mode-toggle i {
    font-size: 18px;
  }

  .header-bottom .container {
    padding: 0 15px;
  }

  .nav-menu > li:first-child {
    padding: 12px 0;
  }

  .nav-menu.active {
    width: calc(100% + 30px);
    margin-left: -15px;
    margin-right: -15px;
  }

  .nav-menu.active > li > a,
  .nav-menu.active > li > p {
    font-size: 14px;
    padding: 12px 15px;
  }

  .nav-menu.active > li:first-child {
    padding: 12px 15px;
  }

  .mega-menu-content {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 15px;
    padding: 10px 15px;
  }

  .mega-menu-content a {
    font-size: 13px;
    padding: 6px 0;
  }

  .search-result-item {
    padding: 10px;
  }

  .search-result-avatar {
    width: 50px;
    height: 70px;
  }

  .search-result-title {
    font-size: 14px;
  }

  .search-result-alt-title,
  .search-result-chapter {
    font-size: 12px;
  }

  .user-menu-list {
    gap: 10px;
  }

  .icon-notification,
  .user-avatar {
    width: 35px;
    height: 35px;
  }

  .icon-notification i {
    font-size: 16px;
  }

  .notification-badge {
    font-size: 9px;
    padding: 1px 5px;
    min-width: 16px;
    top: -3px;
    right: -3px;
  }

  .notification-dropdown,
  .user-dropdown {
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
    top: 100px;
  }

  .user-info {
    padding: 15px;
  }

  .user-info img {
    width: 45px;
    height: 45px;
    border-width: 2px;
  }

  .user-name {
    font-size: 14px;
  }

  .user-email {
    font-size: 11px;
  }

  .user-menu-links a {
    padding: 10px 15px;
    font-size: 13px;
  }

  .user-menu-links a:hover {
    padding-left: 20px;
  }

  .notification-header {
    padding: 12px 15px;
  }

  .notification-header h4 {
    font-size: 15px;
  }

  .notification-list li {
    padding: 12px 15px;
  }

  .notification-title {
    font-size: 13px;
  }

  .notification-time {
    font-size: 11px;
  }
}

/* =====================================================
   RESPONSIVE - SMALL MOBILE (≤480px)
===================================================== */
@media (max-width: 480px) {
  .search-submit {
    right: 20px !important;
  }

  .container {
    padding: 0 15px;
  }

  .header-actions {
    gap: 10px;
  }

  .btn-register,
  .btn-login {
    padding: 5px 10px;
    font-size: 11px;
  }

  .user-menu-list {
    gap: 8px;
  }

  .icon-notification,
  .user-avatar {
    width: 32px;
    height: 32px;
  }

  .notification-dropdown,
  .user-dropdown {
    right: 5px;
    left: 5px;
  }
}

/* =====================================================
   UTILITY CLASSES
===================================================== */
.user-menu.loading .user-avatar img {
  opacity: 0.5;
  animation: pulse 1.5s infinite;
}

.user-menu.loading .icon-notification {
  opacity: 0.5;
  pointer-events: none;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.3;
  }
}

.notification-dropdown,
.user-dropdown {
  animation-duration: 0.3s;
  animation-fill-mode: both;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notification-bell:hover .notification-dropdown,
.user-profile:hover .user-dropdown {
  animation-name: fadeInDown;
}

.user-avatar:focus,
.icon-notification:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.user-menu-links a:focus,
.notification-item:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: -2px;
}

body.dark-mode .notification-dropdown::before,
body.dark-mode .user-dropdown::before {
  content: "";
  position: absolute;
  top: -8px;
  right: 15px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid rgba(74, 158, 255, 0.2);
}

@media print {
  .user-menu,
  .auth-buttons {
    display: none !important;
  }
}

/* =====================================================
   SEARCH RESULTS - UPDATED WITH COMIC STATS
===================================================== */

.search-results.active {
  max-height: 550px;
  overflow-y: auto;
}

.search-result-item {
  min-height: 110px;
}

.search-result-info {
  gap: 6px;
}

.search-result-info .comic-stats {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 12px;
  color: var(--text-secondary, #666);
}

body.dark-mode .search-result-info .comic-stats {
  color: var(--text-secondary-dark, #999);
}

.search-result-info .stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.search-result-info .stat-item i {
  font-size: 11px;
  color: var(--accent-color);
}

@media (max-width: 767px) {
  .search-result-item {
    min-height: 95px;
  }

  .search-result-info .comic-stats {
    font-size: 11px;
    gap: 10px;
  }
}
