/* =========================================
   NotiExpress - Estilos Globales
   Bootstrap 5 + Dark/Light Mode
   ========================================= */

/* ---------- Variables ---------- */
:root {
  --ne-accent:       #e63946;
  --ne-accent-hover: #c1121f;
  --ne-card-radius:  12px;
  --ne-shadow:       0 4px 20px rgba(0,0,0,.12);
  --ne-shadow-dark:  0 4px 20px rgba(0,0,0,.5);
  --ne-transition:   .3s ease;
}

/* ---------- Dark Mode ---------- */
[data-bs-theme="dark"] {
  --bs-body-bg:          #0f1117;
  --bs-body-color:       #e0e0e0;
  --ne-card-bg:          #1a1d27;
  --ne-border:           rgba(255,255,255,.08);
  --ne-navbar-bg:        #12151f;
  --ne-footer-bg:        #0a0c12;
  --ne-input-bg:         #1e2130;
  --ne-sidebar-bg:       #12151f;
  --ne-overlay:          rgba(0,0,0,.65);
}

/* ---------- Light Mode ---------- */
[data-bs-theme="light"] {
  --ne-card-bg:      #ffffff;
  --ne-border:       rgba(0,0,0,.1);
  --ne-navbar-bg:    #ffffff;
  --ne-footer-bg:    #f1f3f5;
  --ne-input-bg:     #fff;
  --ne-sidebar-bg:   #f8f9fa;
  --ne-overlay:      rgba(0,0,0,.4);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  transition: background-color var(--ne-transition), color var(--ne-transition);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1 0 auto;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ne-accent); border-radius: 3px; }

/* ==========================================
   NAVBAR
   ========================================== */
.ne-navbar {
  background: var(--ne-navbar-bg);
  border-bottom: 2px solid var(--ne-accent);
  box-shadow: var(--ne-shadow);
  transition: background-color var(--ne-transition);
  position: sticky;
  top: 0;
  z-index: 1030;
}

.ne-navbar .navbar-brand {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--ne-accent) !important;
}

.ne-navbar .navbar-brand span {
  color: var(--bs-body-color);
}

.ne-navbar .nav-link {
  font-weight: 500;
  padding: .5rem 1rem;
  border-radius: 8px;
  transition: background var(--ne-transition), color var(--ne-transition);
}

.ne-navbar .nav-link:hover,
.ne-navbar .nav-link.active {
  background: var(--ne-accent);
  color: #fff !important;
}

/* ---------- Theme Toggle ---------- */
.theme-toggle {
  background: none;
  border: 2px solid var(--ne-border);
  border-radius: 50px;
  padding: .3rem .8rem;
  cursor: pointer;
  transition: all var(--ne-transition);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .9rem;
  color: var(--bs-body-color);
}

.theme-toggle:hover {
  border-color: var(--ne-accent);
  color: var(--ne-accent);
}

/* ==========================================
   CARDS
   ========================================== */
.ne-card {
  background: var(--ne-card-bg);
  border: 1px solid var(--ne-border);
  border-radius: var(--ne-card-radius);
  overflow: hidden;
  box-shadow: var(--ne-shadow);
  transition: transform var(--ne-transition), box-shadow var(--ne-transition);
}

.ne-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(230,57,70,.2);
}

.ne-card-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.ne-card-body { padding: 1.2rem; }

.ne-card-badge {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: .25rem .6rem;
  border-radius: 20px;
}

.ne-card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  margin: .5rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ne-card-title a {
  color: var(--bs-body-color);
  text-decoration: none;
  transition: color var(--ne-transition);
}

.ne-card-title a:hover { color: var(--ne-accent); }

.ne-card-meta {
  font-size: .78rem;
  opacity: .6;
}

/* ==========================================
   HERO / BREAKING NEWS
   ========================================== */
.ne-hero {
  position: relative;
  border-radius: var(--ne-card-radius);
  overflow: hidden;
  aspect-ratio: 16/7;
  cursor: pointer;
}

.ne-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}

.ne-hero:hover img { transform: scale(1.03); }

.ne-hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 1.5rem 1.5rem;
  background: linear-gradient(to top, rgba(0,0,0,.88) 0%, transparent 100%);
  color: #fff;
}

.ne-hero-title {
  font-size: clamp(1.1rem, 3vw, 1.8rem);
  font-weight: 800;
  line-height: 1.3;
  text-shadow: 0 2px 10px rgba(0,0,0,.5);
}

/* ==========================================
   SECTION HEADERS
   ========================================== */
.ne-section-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -.5px;
  position: relative;
  padding-left: 14px;
  margin-bottom: 1.25rem;
}

.ne-section-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--ne-accent);
  border-radius: 2px;
}

/* ==========================================
   REELS / VIDEO
   ========================================== */
.ne-reel-card {
  position: relative;
  border-radius: var(--ne-card-radius);
  overflow: hidden;
  aspect-ratio: 9/16;
  background: #000;
  cursor: pointer;
}

.ne-reel-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .75;
  transition: opacity var(--ne-transition);
}

.ne-reel-card:hover img { opacity: .55; }

.ne-reel-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem;
  background: linear-gradient(to top, rgba(0,0,0,.75) 30%, transparent 100%);
  color: #fff;
}

.ne-reel-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  width: 56px;
  height: 56px;
  background: rgba(255,255,255,.2);
  border: 2px solid rgba(255,255,255,.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  backdrop-filter: blur(4px);
  transition: all var(--ne-transition);
}

.ne-reel-card:hover .ne-reel-play {
  background: var(--ne-accent);
  border-color: var(--ne-accent);
  transform: translate(-50%,-50%) scale(1.1);
}

/* ==========================================
   GALERÍA
   ========================================== */
.ne-gallery-grid {
  columns: 2;
  column-gap: 1rem;
}

@media (min-width: 576px)  { .ne-gallery-grid { columns: 3; } }
@media (min-width: 992px)  { .ne-gallery-grid { columns: 4; } }

.ne-gallery-item {
  break-inside: avoid;
  margin-bottom: 1rem;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.ne-gallery-item img {
  width: 100%;
  display: block;
  transition: transform var(--ne-transition), filter var(--ne-transition);
}

.ne-gallery-item:hover img {
  transform: scale(1.04);
  filter: brightness(.8);
}

.ne-gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: .6rem;
  background: linear-gradient(to top, rgba(0,0,0,.75), transparent);
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity var(--ne-transition);
}

.ne-gallery-item:hover .ne-gallery-caption { opacity: 1; }

/* ==========================================
   ARTÍCULO (Noticia individual)
   ========================================== */
.ne-article-header { margin-bottom: 2rem; }
.ne-article-title  { font-size: clamp(1.4rem, 4vw, 2.2rem); font-weight: 800; }

.ne-article-img {
  width: 100%;
  border-radius: var(--ne-card-radius);
  aspect-ratio: 16/9;
  object-fit: cover;
  margin-bottom: 1.5rem;
}

.ne-article-body {
  font-size: 1.05rem;
  line-height: 1.9;
}

.ne-article-body p   { margin-bottom: 1.2rem; }
.ne-article-body h2,
.ne-article-body h3  { font-weight: 700; margin-top: 2rem; }

/* ==========================================
   FOOTER
   ========================================== */
.ne-footer {
  background: var(--ne-footer-bg);
  border-top: 2px solid var(--ne-accent);
  padding: 2.5rem 0 1.5rem;
  margin-top: auto;
  flex-shrink: 0;
  transition: background-color var(--ne-transition);
}

.ne-footer .ne-brand {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--ne-accent);
}

/* ==========================================
   ADMIN PANEL
   ========================================== */
.ne-admin-sidebar {
  background: var(--ne-sidebar-bg);
  border-right: 1px solid var(--ne-border);
  min-height: 100vh;
  width: 250px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  overflow-y: auto;
  transition: transform var(--ne-transition), background-color var(--ne-transition);
  padding: 0;
  display: flex;
  flex-direction: column;
}

.ne-admin-content {
  margin-left: 250px;
  min-height: 100vh;
  padding: 1.5rem;
  transition: margin-left var(--ne-transition);
}

@media (max-width: 991.98px) {
  .ne-admin-sidebar {
    transform: translateX(-100%);
  }
  .ne-admin-sidebar.show {
    transform: translateX(0);
  }
  .ne-admin-content {
    margin-left: 0;
  }
}

.ne-sidebar-brand {
  padding: 1.2rem 1.5rem;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ne-accent) !important;
  background: var(--ne-sidebar-bg);
  border-bottom: 1px solid var(--ne-border);
  display: block;
  text-decoration: none;
  letter-spacing: -.5px;
}

.ne-sidebar-nav { padding: .75rem 0; flex: 1; }

.ne-sidebar-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.5rem;
  color: var(--bs-body-color);
  text-decoration: none;
  font-weight: 500;
  font-size: .92rem;
  border-left: 3px solid transparent;
  transition: all var(--ne-transition);
}

.ne-sidebar-item:hover,
.ne-sidebar-item.active {
  background: rgba(230,57,70,.1);
  color: var(--ne-accent);
  border-left-color: var(--ne-accent);
}

.ne-sidebar-separator {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: .4;
  padding: 1rem 1.5rem .25rem;
}

/* Admin Cards Stat */
.ne-stat-card {
  background: var(--ne-card-bg);
  border: 1px solid var(--ne-border);
  border-radius: var(--ne-card-radius);
  padding: 1.5rem;
  box-shadow: var(--ne-shadow);
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.ne-stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.ne-stat-num  { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.ne-stat-label{ font-size: .82rem; opacity: .65; margin-top: .15rem; }

/* Admin Table */
.ne-admin-table {
  background: var(--ne-card-bg);
  border: 1px solid var(--ne-border);
  border-radius: var(--ne-card-radius);
  overflow: hidden;
  box-shadow: var(--ne-shadow);
}

.ne-admin-table table { margin: 0; }
.ne-admin-table th    { font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; opacity: .7; }

/* Admin Form */
.ne-admin-form {
  background: var(--ne-card-bg);
  border: 1px solid var(--ne-border);
  border-radius: var(--ne-card-radius);
  padding: 2rem;
  box-shadow: var(--ne-shadow);
}

.ne-admin-form .form-control,
.ne-admin-form .form-select {
  background-color: var(--ne-input-bg);
  border-color: var(--ne-border);
  border-radius: 8px;
}

/* Upload Preview */
.ne-upload-preview {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px dashed var(--ne-border);
  display: none;
}

.ne-upload-preview.show { display: block; }

/* ==========================================
   BOTONES
   ========================================== */
.btn-ne {
  background: var(--ne-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  transition: background var(--ne-transition), transform var(--ne-transition);
}

.btn-ne:hover {
  background: var(--ne-accent-hover);
  color: #fff;
  transform: translateY(-1px);
}

/* ==========================================
   VIDEO MODAL
   ========================================== */
#videoModal .modal-content {
  background: #000;
  border: none;
}

#videoModal video,
#videoModal iframe {
  width: 100%;
  aspect-ratio: 9/16;
  border-radius: 8px;
  max-height: 80vh;
}

/* ==========================================
   SEARCH BAR
   ========================================== */
.ne-search {
  border-radius: 50px !important;
  border: 2px solid var(--ne-border) !important;
  padding: .5rem 1.2rem !important;
  background: var(--ne-input-bg);
  transition: border-color var(--ne-transition);
}

.ne-search:focus {
  border-color: var(--ne-accent) !important;
  box-shadow: 0 0 0 3px rgba(230,57,70,.15) !important;
}

/* ==========================================
   UTILITIES
   ========================================== */
.cursor-pointer { cursor: pointer; }
.ne-accent-text { color: var(--ne-accent) !important; }
.ne-bg-accent   { background: var(--ne-accent) !important; }
.line-clamp-2   { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3   { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Loading Spinner */
.ne-spinner {
  border: 3px solid var(--ne-border);
  border-top: 3px solid var(--ne-accent);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Shimmer Skeleton */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.ne-skeleton {
  background: linear-gradient(90deg, var(--ne-border) 25%, rgba(128,128,128,.1) 50%, var(--ne-border) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

/* ==========================================
   RESPONSIVE TWEAKS
   ========================================== */

/* XS - móviles pequeños (<576px) */
@media (max-width: 575.98px) {
  .ne-hero { aspect-ratio: 4/3; }
  .ne-reel-card { aspect-ratio: 3/4; }

  /* Navbar: reducir tamaño brand */
  .ne-navbar .navbar-brand { font-size: 1.3rem; }

  /* Artículo: padding lateral */
  .ne-article-body { font-size: 1rem; }

  /* Footer: centrar todo */
  .ne-footer .text-lg-end { text-align: center !important; }
  .ne-footer .justify-content-lg-end { justify-content: center !important; }

  /* Stat cards admin: texto más pequeño */
  .ne-stat-num { font-size: 1.4rem; }

  /* Reel play button más pequeño */
  .ne-reel-play { width: 40px; height: 40px; font-size: 1rem; }

  /* Botones compartir: stack */
  .ne-share-btns { flex-direction: column; align-items: flex-start; }

  /* Galería 2 columnas mínimo */
  .ne-gallery-grid { columns: 2; }
}

/* SM - móviles grandes (576-767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
  .ne-hero { aspect-ratio: 16/9; }
}

/* MD - tablets (768-991px) */
@media (max-width: 991.98px) {
  /* Navbar menu desplegado */
  #navMenu .navbar-nav { max-height: 60vh; overflow-y: auto; padding-bottom: .5rem; }
  #navMenu form { max-width: 100% !important; margin: .5rem 0 !important; }
  #navMenu .ne-search { width: 100%; }

  /* Hero: en tablet ocupar todo el ancho */
  .ne-hero { aspect-ratio: 16/8; }
}

/* Tablas admin con scroll horizontal en todos los móviles */
.ne-admin-table { overflow-x: auto; }

/* Formularios admin en móvil */
@media (max-width: 767.98px) {
  .ne-admin-form { padding: 1.2rem; }
  .ne-stat-card { padding: 1rem; gap: .8rem; }
}

/* ==========================================
   ANUNCIOS / ADS
   ========================================== */

/* Contenedor base */
.ne-ad {
  text-align: center;
  clear: both;
  overflow: hidden;
}

/* Leaderboard — desktop: 728×90 | móvil: 320×50 automático */
.ne-ad--leaderboard {
  max-width: 728px;
  margin-left: auto;
  margin-right: auto;
}

/* Rectángulo — 300×250 (sidebar / entre contenido) */
.ne-ad--rectangle {
  max-width: 336px;
  margin-left: auto;
  margin-right: auto;
}

/* Anuncio en artículo — ancho completo */
.ne-ad--in-article {
  max-width: 100%;
}

/* ── Placeholder visual (mientras no hay AdSense configurado) ── */
.ne-ad-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(
    45deg,
    rgba(128,128,128,.04),
    rgba(128,128,128,.04) 10px,
    transparent 10px,
    transparent 20px
  );
  border: 2px dashed var(--ne-border);
  border-radius: 8px;
  padding: 1rem;
  color: var(--bs-body-color);
  opacity: .6;
  min-height: 60px;
}

.ne-ad-label {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  opacity: .6;
  display: block;
  margin-bottom: .25rem;
}

.ne-ad-ph-size {
  font-size: .85rem;
  font-weight: 600;
}

/* Mostrar tamaño desktop en pantalla grande */
.ne-ad-ph-desktop { display: block; }
.ne-ad-ph-mobile  { display: none;  }

/* Placeholder cuadrado para rectángulo */
.ne-ad-ph--rect {
  min-height: 250px;
  min-width: 260px;
}

/* Placeholder anuncio en artículo */
.ne-ad-ph--article {
  min-height: 90px;
  width: 100%;
}

/* ── Responsive: móviles ── */
@media (max-width: 575.98px) {
  /* Leaderboard ocupa todo el ancho en móvil */
  .ne-ad--leaderboard { max-width: 100%; }

  /* Mostrar tamaño móvil, ocultar desktop */
  .ne-ad-ph-desktop { display: none;  }
  .ne-ad-ph-mobile  { display: block; }

  /* Rectángulo centrado en tiny */
  .ne-ad--rectangle { max-width: 300px; }
}
