/* Panel de administración autoadministrable - Super Mascota Lebrija */

:root {
  --admin-bg: #f1f5f9;
  --admin-surface: #ffffff;
  --admin-sidebar: #1e293b;
  --admin-brand: #20a39e;
  --admin-text: #0f172a;
  --admin-muted: #64748b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  color: var(--admin-text);
  background: var(--admin-bg);
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-container {
  width: 100%;
  max-width: 400px;
  background: var(--admin-surface);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  width: 140px;
  height: 140px;
  object-fit: contain;
}

.login-form .form-group {
  margin-bottom: 1rem;
}

.login-form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
}

.login-form input:focus {
  outline: none;
  border-color: var(--admin-brand);
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 400;
  cursor: pointer;
}

.forgot-link {
  font-size: 0.85rem;
  color: var(--admin-brand);
  text-decoration: none;
}

.forgot-link:hover {
  text-decoration: underline;
}

.btn-login {
  width: 100%;
  padding: 0.75rem;
  background: var(--admin-brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-login:hover {
  background: #1b7f7b;
}

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
}

.login-footer a {
  color: var(--admin-muted);
  text-decoration: none;
}

.login-footer a:hover {
  color: var(--admin-brand);
}

/* Panel */
.panel-page {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--admin-sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.25rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.95rem;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.75rem 0;
}

.panel-main {
  flex: 1;
  overflow-y: auto;
}

.panel-header {
  background: var(--admin-surface);
  padding: 1.25rem 2rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h1 {
  margin: 0;
  font-size: 1.4rem;
}

.header-actions {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--admin-muted);
}

.panel-content {
  padding: 2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--admin-surface);
  padding: 1.25rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--admin-brand);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--admin-muted);
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.panel-card {
  background: var(--admin-surface);
  padding: 1.25rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.panel-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.panel-card p {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--admin-muted);
  line-height: 1.5;
}

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

.btn-admin {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border-radius: 6px;
  border: none;
  background: var(--admin-brand);
  color: #fff;
  cursor: pointer;
}

.btn-admin:hover {
  background: #1b7f7b;
}

.btn-admin.btn-outline {
  background: transparent;
  border: 1px solid var(--admin-brand);
  color: var(--admin-brand);
}

.full-width {
  grid-column: 1 / -1;
}

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

.activity-table th,
.activity-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.activity-table th {
  font-size: 0.85rem;
  color: var(--admin-muted);
  font-weight: 600;
}

/* Multiidioma */
.mb {
  margin-bottom: 1.5rem;
}

.muted {
  color: var(--admin-muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.lang-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lang-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.lang-item.lang-inactive {
  opacity: 0.7;
}

.lang-flag {
  font-weight: 700;
  font-size: 0.85rem;
  min-width: 28px;
  color: var(--admin-brand);
}

.lang-name {
  flex: 1;
}

.lang-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: #e2e8f0;
  border-radius: 4px;
  color: var(--admin-muted);
}

.lang-badge.lang-ok {
  background: rgba(32, 163, 158, 0.15);
  color: var(--admin-brand);
}

.btn-small {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.mt {
  margin-top: 1rem;
}

.form-row {
  padding: 0.5rem 0;
}

.lang-ok {
  color: #16a34a;
  font-weight: 600;
}

.lang-warn {
  color: #ca8a04;
  font-weight: 600;
}

/* Formulario de edición */
.edit-form {
  max-width: 720px;
}

.edit-section {
  margin-bottom: 1.5rem;
}

.edit-section label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.edit-section input[type="text"],
.edit-section textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}

.edit-section input:focus,
.edit-section textarea:focus {
  outline: none;
  border-color: var(--admin-brand);
}

.edit-section textarea {
  resize: vertical;
  min-height: 100px;
}

.upload-area {
  border: 2px dashed #e2e8f0;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  background: #f8fafc;
  position: relative;
}

.upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-placeholder p {
  margin: 0.25rem 0;
  color: var(--admin-muted);
  font-size: 0.9rem;
}

.upload-hint {
  font-size: 0.8rem !important;
}

.edit-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

a.btn-admin {
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
}

/* Page Builder */
.builder-page .panel-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.builder-header .header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.builder-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.block-palette {
  width: 200px;
  flex-shrink: 0;
  background: var(--admin-surface);
  border-right: 1px solid #e2e8f0;
  padding: 1rem;
}

.block-palette h3 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}

.palette-hint {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  color: var(--admin-muted);
}

.block-types {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.block-type {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  text-align: left;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.block-type:hover {
  background: rgba(32, 163, 158, 0.08);
  border-color: var(--admin-brand);
}

.builder-canvas {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background: #f8fafc;
}

.blocks-list {
  max-width: 680px;
  margin: 0 auto;
}

.block {
  background: var(--admin-surface);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.block-handle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.block-type-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--admin-muted);
}

.block-actions {
  display: flex;
  gap: 0.25rem;
}

.block-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 0.75rem;
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  cursor: pointer;
}

.block-btn:hover {
  background: #fff;
  border-color: var(--admin-brand);
}

.block-btn-delete:hover {
  border-color: #dc2626;
  color: #dc2626;
}

.block-preview {
  padding: 1rem;
}

.block-field {
  margin-bottom: 0.75rem;
}

.block-field:last-child {
  margin-bottom: 0;
}

.block-field input,
.block-field textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-size: 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-family: inherit;
}

.block-field textarea {
  resize: vertical;
  min-height: 60px;
}

.block-field-image {
  margin-top: 0.5rem;
}

.upload-area.small {
  padding: 1rem;
  border: 2px dashed #e2e8f0;
  border-radius: 8px;
  text-align: center;
  background: #f8fafc;
  position: relative;
}

.upload-area.small span {
  font-size: 0.85rem;
  color: var(--admin-muted);
}

.add-block-trigger {
  padding: 0.5rem 0;
  display: flex;
  justify-content: center;
}

.add-block-btn {
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  background: transparent;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  color: var(--admin-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.add-block-btn:hover {
  border-color: var(--admin-brand);
  color: var(--admin-brand);
}

.block-preview-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.column-preview input,
.column-preview textarea {
  width: 100%;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-family: inherit;
  margin-bottom: 0.5rem;
}

.column-preview textarea {
  resize: vertical;
  min-height: 50px;
}

.block-preview-inline {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.inline-input {
  flex: 1;
  min-width: 120px;
  padding: 0.5rem 0.65rem;
  font-size: 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.gallery-upload span {
  font-size: 0.85rem;
}

@media (max-width: 900px) {
  .builder-layout {
    flex-direction: column;
  }

  .block-palette {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }

  .block-types {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .block-preview-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .panel-page {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}
