/* ============================
VARIABLES DE COLORES Y ESTILO
============================ */
:root {
  /* Variables modo claro (default) */
  --bg-page: #ffffff;
  --bg-container: #f5f5f5;
  --border: #e0e0e0;
  --radius: 10px;
  --success: #28a745;
  --text-color: #333333;
  --primary: #007bff;
  --header-bg: #ffffff;
  --tab-bg: #eaeaea;
  --tab-active: #007bff;
  --emoji-bar-bg: #0f172a;
  --emoji-bar-border: #1e293b;
  --emoji-bar-text: #ffffff;
  --control-bg: #ffffff;
  --control-border: #e0e0e0;
  --control-text: #333333;
  --dropdown-bg: #ffffff;
  --dropdown-border: #e0e0e0;
  --dropdown-hover: #f5f5f5;
}

/* Variables modo oscuro */
[data-theme="dark"] {
  --bg-page: #121212;
  --bg-container: #1e1e1e;
  --border: #333333;
  --text-color: #f5f5f5;
  --primary: #4dabf7;
  --header-bg: #1e1e1e;
  --tab-bg: #2d2d2d;
  --tab-active: #4dabf7;
  --emoji-bar-bg: #0a0a0a;
  --emoji-bar-border: #333333;
  --emoji-bar-text: #f5f5f5;
  --control-bg: #2d2d2d;
  --control-border: #444444;
  --control-text: #f5f5f5;
  --dropdown-bg: #2d2d2d;
  --dropdown-border: #444444;
  --dropdown-hover: #3d3d3d;
}

/* ============================
RESET BÁSICO
============================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-page);
  color: var(--text-color);
  line-height: 1.5;
  min-height: 100vh;
}

/* ============================
CONTROLES SUPERIORES
============================ */
.controls-bar {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 10000;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: 20px;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.controls-group {
  display: flex;
  gap: 8px;
}

.control-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--control-text);
  transition: background-color 0.2s ease;
}

.control-btn:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .control-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* ============================
DROPDOWN DE TEMA Y ANCHO
============================ */
.dropdown {
  position: fixed;
  top: 70px;
  right: 10px;
  background: var(--dropdown-bg);
  border: 1px solid var(--dropdown-border);
  border-radius: 10px;
  padding: 8px 0;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: none;
  z-index: 10000;
}

.dropdown.show {
  display: block;
}

/* Estilos para las opciones de tema y ancho */
.theme-option,
.width-option {
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--control-text);
  text-align: left;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background-color 0.2s ease;
}

.theme-option:hover,
.width-option:hover {
  background-color: var(--dropdown-hover);
}

.theme-icon,
.width-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

/* ============================
HEADER
============================ */
header {
  text-align: center;
  padding: 60px 20px 20px;
  background: var(--header-bg);
}

header h1 {
  font-size: 2rem;
  margin-bottom: 10px;
}

/* ============================
CONTENEDOR CENTRAL - MODOS DE ANCHO
============================ */
main {
  max-width: 80%; /* CAMBIADO: 100% → 80% */
  margin: 20px auto 60px;
  background: var(--bg-container);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.05);
  transition: max-width 0.3s ease;
}


/* Modo estrecho (80% en desktop) */
body.narrow-mode main {
   max-width: 80%;
  margin: 20px auto 60px;
  border-radius: var(--radius);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* Modo ancho completo (100% en desktop) */
body.full-width-mode main {
  max-width: 100%; /* CAMBIADO: añadido */
  margin: 20px 0 60px; /* CAMBIADO: auto → 0 */
  border-radius: 0;
  border-left: none;
  border-right: none;
}

/* ============================
TABS DE NAVEGACIÓN
============================ */
.tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin: 20px 0;
  gap: 10px;
}

.tabs a {
  text-decoration: none;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--tab-bg);
  color: var(--text-color);
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.tabs a.active,
.tabs a:hover {
  background: var(--primary);
  color: #ffffff;
}

/* ============================
SECCIONES
============================ */
section h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  text-align: center;
}

/* ============================
GRID DE EMOJIS
============================ */
.emoji-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 14px;
}

.emoji-list li {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.emoji-list li:hover {
  background: var(--tab-bg);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}

.emoji-list li.copied {
  border-color: var(--success);
  background: #e6f9ed;
}

/* ============================
TOOLTIP COPIADO
============================ */
.emoji-list li {
  position: relative;
}

.emoji-tooltip {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  animation: showTooltip 0.3s forwards;
  white-space: nowrap;
  z-index: 10;
}

@keyframes showTooltip {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
  50% { opacity: 1; transform: translateX(-50%) translateY(-2px); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============================
POPUP DE EMOJI AMPLIADO
============================ */
.emoji-zoom-popup {
  position: fixed;
  background: var(--bg-container);
  border: 2px solid var(--primary);
  border-radius: 15px;
  padding: 20px;
  font-size: 60px; /* AQUÍ MODIFICAS EL TAMAÑO DEL EMOJI EN EL POPUP */
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 15px 40px rgba(0,0,0,0.3);
  z-index: 10000;
  opacity: 0;
  transform: scale(0.8) translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.emoji-zoom-popup.show {
  opacity: 1;
  transform: scale(1) translateY(0);
}

 

/* ============================
   BARRA INFERIOR DE EMOJIS
============================ */
#emoji-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--emoji-bar-bg);
  border-top: 2px solid var(--emoji-bar-border);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  box-shadow: 0 -4px 12px rgba(0,0,0,.4);
}

#emoji-bar-list {
  flex: 1;
  min-height: 44px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--emoji-bar-border);
  border-radius: 6px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  font-size: 22px;
  color: var(--emoji-bar-text);
}

#emoji-bar-list span {
  cursor: pointer;
  transition: transform .15s ease;
}

#emoji-bar-list span:hover {
  transform: scale(1.2);
}

#copy-all {
  background: #22c55e;
  color: #022c22;
  border: none;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

#copy-all:hover {
  background: #16a34a;
}

#clear-all {
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, transform 0.1s ease;
}

#clear-all:hover {
  background: #dc2626;
}

#clear-all:active {
  transform: scale(0.96);
}

.share-group {
  display: flex;
  gap: 8px;
}

.share-btn {
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  color: #fff;
}

.share-btn.email {
  background: #64748b;
}

.share-btn.email:hover {
  background: #475569;
}

/* ============================
RESPONSIVE
============================ */
@media (max-width: 768px) {
  /* En móviles siempre ancho completo */
  body.narrow-mode main,
  body.full-width-mode main,
  main {
    max-width: 100%;
    margin: 20px 0 40px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 20px 12px;
  }
  
  /* Ocultar botón de ancho en móviles */
  #width-toggle {
    display: none;
  }
  
  .controls-bar {
    top: 5px;
    right: 5px;
  }
  
  .control-btn {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  
  .dropdown {
    top: 60px;
    right: 5px;
  }
  
  header {
    padding: 50px 12px 15px;
  }
  
  header h1 {
    font-size: 1.8rem;
  }
  
  .tabs a {
    padding: 8px 12px;
    font-size: 0.9rem;
  }
  
  section h2 {
    font-size: 1.3rem;
  }
  
  #emoji-bar {
    padding: 8px 10px;
    gap: 8px;
  }
  
  #copy-all,
  #clear-all,
  .share-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  /* Tablets: siempre ancho completo */
  body.narrow-mode main,
  body.full-width-mode main,
  main {
    max-width: 100%;
    margin: 20px 20px 60px;
    border-radius: var(--radius);
  }
  
  /* Ocultar botón de ancho en tablets */
  #width-toggle {
    display: none;
  }
}

@media (min-width: 1025px) {
  /* Desktop: mostrar controles de ancho normalmente */
  #width-toggle {
    display: flex;
  }
}