/* ============================================================================
   ESTILOS PERSONALIZADOS - ADMINISTRADOR DE THEMES
   ============================================================================ */

:root {
  --form-element-valid-border-color: #4caf50;
  --form-element-invalid-border-color: #f44336;
}

/* LAYOUT GENERAL */
body {
  padding: 0;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
}

/* NAVBAR */
.navbar {
  background: var(--form-element-background-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem;
}

.navbar h2 {
  margin: 0;
}

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

.cache-status {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  background: var(--card-background-color);
  border-radius: var(--border-radius);
}

.btn-logout {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  text-decoration: none;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: var(--card-background-color);
}

/* LOGIN */
.login-card {
  max-width: 400px;
  margin: 5rem auto;
  padding: 2rem;
}

.login-card h1 {
  text-align: center;
  margin-bottom: 0.5rem;
}

.login-card p {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--muted-color);
}

.login-card button {
  width: 100%;
}

.alert {
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
}

.alert.error {
  background: #ffebee;
  color: #c62828;
  border-left: 4px solid #f44336;
}

/* SEARCH SECTION */
.search-section {
  margin-bottom: 2rem;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: end;
}

#search-input,
#category-filter {
  width: 100%;
}

.btn-secondary {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .search-row {
    grid-template-columns: 1fr;
  }
}

/* THEMES SECTION */
.themes-section {
  margin-bottom: 2rem;
}

.themes-loading {
  text-align: center;
  padding: 2rem;
  color: var(--muted-color);
}

.themes-table {
  width: 100%;
  border-collapse: collapse;
}

.themes-table th {
  text-align: left;
  padding: 1rem;
  border-bottom: 2px solid var(--border-color);
  font-weight: 600;
}

.themes-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.themes-table tr:hover {
  background: var(--card-background-color);
}

.theme-name {
  font-weight: 500;
  cursor: pointer;
  color: var(--link-color);
}

.theme-name:hover {
  text-decoration: underline;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--border-color);
  border-radius: 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
}

.badge.wordpress { background: #0073aa; color: white; }
.badge.bootstrap { background: #7c3aed; color: white; }
.badge.tailwind { background: #06b6d4; color: white; }
.badge.custom { background: #64748b; color: white; }
.badge.otros { background: #94a3b8; color: white; }

.theme-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-small {
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  border: 1px solid var(--border-color);
  background: transparent;
  cursor: pointer;
  border-radius: var(--border-radius);
  transition: all 0.2s;
}

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

/* PUBLIC SHARE */
.public-share {
  max-width: 600px;
  margin: 2rem auto;
  padding: 2rem;
}

.public-share h1 {
  text-align: center;
  margin-bottom: 2rem;
}

.themes-list {
  display: grid;
  gap: 1.5rem;
  margin: 2rem 0;
}

.theme-item {
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  transition: all 0.2s;
}

.theme-item:hover {
  border-color: var(--link-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.theme-item h4 {
  margin: 0 0 1rem 0;
  word-break: break-word;
}

.theme-info {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.size {
  font-size: 0.875rem;
  color: var(--muted-color);
}

.theme-description {
  font-size: 0.875rem;
  margin: 1rem 0;
  color: var(--muted-color);
}

.theme-description em {
  display: block;
  font-style: normal;
}

.btn-download {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--link-color);
  color: white;
  text-decoration: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn-download:hover {
  opacity: 0.9;
  text-decoration: none;
}

.footer-note {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.875rem;
  color: var(--muted-color);
}

/* ERROR CARD */
.error-card {
  max-width: 400px;
  margin: 5rem auto;
  text-align: center;
  padding: 2rem;
}

.error-card h1 {
  color: #f44336;
  margin-bottom: 1rem;
}

/* MODALES */
dialog {
  padding: 1rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  max-width: 600px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

dialog article {
  margin: 0;
}

dialog header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

dialog button[rel="prev"] {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
}

dialog footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

dialog footer button {
  margin: 0;
}

/* DETALLE MODAL */
#modal-content {
  display: grid;
  gap: 1rem;
}

.detail-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: 600;
  color: var(--muted-color);
}

.detail-value {
  word-break: break-word;
}

/* LINK MODAL */
#link-content {
  display: grid;
  gap: 1rem;
}

.link-box {
  background: var(--card-background-color);
  padding: 1rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  display: flex;
  gap: 0.5rem;
}

.link-box input {
  flex: 1;
}

.btn-copy {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--link-color);
  color: white;
  border: none;
}

.btn-primary:hover {
  opacity: 0.9;
}

.success-message {
  background: #e8f5e9;
  color: #2e7d32;
  padding: 1rem;
  border-radius: var(--border-radius);
  border-left: 4px solid #4caf50;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .themes-table {
    font-size: 0.875rem;
  }

  .themes-table th,
  .themes-table td {
    padding: 0.75rem;
  }

  .navbar .container {
    flex-direction: column;
    gap: 0.5rem;
  }

  .nav-right {
    width: 100%;
    flex-direction: column;
  }

  .search-row {
    grid-template-columns: 1fr;
  }
}

/* ANIMATIONS */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.themes-loading {
  animation: fadeIn 0.3s ease-in;
}

/* UTILITIES */
.text-center {
  text-align: center;
}

.mt-2 {
  margin-top: 2rem;
}

.mb-2 {
  margin-bottom: 2rem;
}

.hidden {
  display: none;
}

/* ESTADÍSTICAS */
.stats-section {
  margin-bottom: 2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.stat-box {
  background: var(--card-background-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  text-align: center;
  transition: all 0.2s;
}

.stat-box:hover {
  border-color: var(--link-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--link-color);
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--muted-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* CATEGORÍAS */
.categories-section {
  margin-bottom: 2rem;
}

.categories-loading {
  text-align: center;
  padding: 2rem;
  color: var(--muted-color);
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.category-card {
  background: var(--card-background-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.category-card:hover {
  border-color: var(--link-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.category-header {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--link-color);
  margin-bottom: 0.25rem;
}

.category-size {
  font-size: 0.75rem;
  color: var(--muted-color);
  margin-bottom: 0.5rem;
}

.category-bar {
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  margin: 0.5rem 0;
  overflow: hidden;
}

.category-bar-fill {
  height: 100%;
  background: var(--link-color);
  transition: width 0.3s;
}

.category-percent {
  font-size: 0.75rem;
  color: var(--muted-color);
}

/* BADGES PARA TODAS LAS CATEGORÍAS */
.badge.AGRICULTURE { background: #558b2f; color: white; }
.badge.AUTOMOTIVE { background: #d32f2f; color: white; }
.badge.BEAUTY { background: #e91e63; color: white; }
.badge.BLOG { background: #1976d2; color: white; }
.badge.BUSINESS { background: #1565c0; color: white; }
.badge.CONSTRUCTION { background: #f57c00; color: white; }
.badge.CREATIVE { background: #7b1fa2; color: white; }
.badge.CULTURE { background: #00796b; color: white; }
.badge.ECOMMERCE { background: #2e7d32; color: white; }
.badge.EDUCATION { background: #0277bd; color: white; }
.badge.ENTERTAINMENT { background: #c2185b; color: white; }
.badge.FASHION { background: #d81b60; color: white; }
.badge.FINANCE { background: #1b5e20; color: white; }
.badge.HEALTH { background: #0097a7; color: white; }
.badge.INTERIOR { background: #795548; color: white; }
.badge.JEWELRY { background: #ffd600; color: #000; }
.badge.MANUFACTURING { background: #5d4037; color: white; }
.badge.MINIMAL { background: #9e9e9e; color: white; }
.badge.MODERN { background: #455a64; color: white; }
.badge.MULTIPURPOSE { background: #616161; color: white; }
.badge.NONPROFIT { background: #3f51b5; color: white; }
.badge.OTROS { background: #757575; color: white; }
.badge.PERSONAL { background: #512da8; color: white; }
.badge.PHARMACY { background: #00838f; color: white; }
.badge.PODCAST { background: #4527a0; color: white; }
.badge.PREMIUM { background: #fbc02d; color: #000; }
.badge.RELIGION { background: #827717; color: white; }
.badge.REALESTATE { background: #e65100; color: white; }
.badge.RESTAURANT { background: #bf360c; color: white; }
.badge.SAAS { background: #0d47a1; color: white; }
.badge.SPORTS { background: #1a237e; color: white; }
.badge.TECH { background: #004d40; color: white; }
.badge.TRANSPORTATION { background: #ff6f00; color: white; }
.badge.TRAVEL { background: #01579b; color: white; }
.badge.WAREHOUSE { background: #37474f; color: white; }
