:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --bg-dark: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --badge-borrador: #64748b;
  --badge-programada: #f59e0b;
  --badge-publicada: #10b981;
  --badge-pausada: #ef4444;
  --badge-archivada: #94a3b8;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
}

.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-brand span {
  color: #f8fafc;
  font-weight: 400;
  font-size: 0.85rem;
}

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

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
  background-color: rgba(255, 255, 255, 0.08);
  color: #38bdf8;
  border-left: 4px solid #38bdf8;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
}

.user-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info {
  overflow: hidden;
}

.user-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  color: #94a3b8;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.btn-logout {
  color: #ef4444;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Main Content */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.admin-header {
  height: 70px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.admin-content {
  padding: 30px;
  flex: 1;
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.card-body {
  padding: 20px;
}

/* Alerts */
.alert {
  padding: 14px 18px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.alert-success {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-error {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Table */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background-color: #f1f5f9;
  padding: 12px 16px;
  font-weight: 600;
  color: #475569;
  border-bottom: 2px solid var(--border);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:hover {
  background-color: #f8fafc;
}

/* Status Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-borrador   { background: #e2e8f0; color: #475569; }
.badge-programada { background: #fef3c7; color: #b45309; }
.badge-publicada  { background: #d1fae5; color: #065f46; }
.badge-pausada    { background: #fee2e2; color: #b91c1c; }
.badge-archivada  { background: #f1f5f9; color: #94a3b8; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.btn-secondary:hover { background: #e2e8f0; }

.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }

.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }

.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-sm {
  padding: 4px 8px;
  font-size: 0.78rem;
}

.actions-group {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* Modals */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 550px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #334155;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.92rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.form-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.subdomain-input-group {
  display: flex;
  align-items: center;
}

.subdomain-input-group .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.subdomain-suffix {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-left: none;
  padding: 9px 12px;
  font-size: 0.88rem;
  color: #64748b;
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

.validation-feedback {
  font-size: 0.8rem;
  margin-top: 5px;
  font-weight: 500;
}

.validation-feedback.valid { color: #10b981; }
.validation-feedback.invalid { color: #ef4444; }

/* Subdomain badge in table */
.url-subdomain {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
}
