/* =========================================================
   admin.css — Panel de Avisos · Servicios DEMO
   ========================================================= */

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

:root {
  --av-primary:  #4146A6;
  --av-dark:     #2f3374;
  --av-accent:   #62D9D9;
  --av-bg:       #f5f6fa;
  --av-sidebar:  #2f3374;
  --av-stext:    #cbd0f0;
  --av-white:    #fff;
  --av-border:   #e0e3f5;
  --av-text:     #2f3374;
  --av-muted:    #6b6f93;
  --av-danger:   #dc3545;
  --av-success:  #198754;
  --av-warning:  #ffc107;
  --av-radius:   6px;
  --av-shadow:   0 2px 12px rgba(65,70,166,.10);
}

html { font-size: 15px; }

body {
  font-family: 'Segoe UI', 'Source Sans 3', sans-serif;
  background: var(--av-bg);
  color: var(--av-text);
  min-height: 100vh;
  line-height: 1.55;
}

a { color: var(--av-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }

/* ── Layout ── */
.av-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.av-sidebar {
  width: 230px;
  background: var(--av-sidebar);
  color: var(--av-stext);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  flex-shrink: 0;
}

.av-sidebar-brand {
  padding: 1.4rem 1.2rem .9rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.av-sidebar-logo { font-size: 1rem; font-weight: 700; color: #fff; letter-spacing: .02em; }
.av-sidebar-logo img { max-height: 40px; margin-bottom: .4rem; }
.av-sidebar-sub  { font-size: .7rem; color: var(--av-accent); margin-top: .15rem; letter-spacing: .05em; text-transform: uppercase; }

.av-sidebar-nav { padding: .8rem 0; flex: 1; }
.av-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem 1.2rem;
  color: var(--av-stext);
  font-size: .85rem;
  transition: background .15s, color .15s;
}
.av-sidebar-nav a:hover,
.av-sidebar-nav a.active { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.av-sidebar-nav a.active { border-left: 3px solid var(--av-accent); padding-left: calc(1.2rem - 3px); }

.av-sidebar-footer { padding: .9rem 1.2rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .78rem; }
.av-sidebar-footer a { color: #f99; }
.av-sidebar-footer a:hover { color: #fbb; }

/* ── Main area ── */
.av-main { margin-left: 230px; flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ── Top bar ── */
.av-topbar {
  background: var(--av-white);
  border-bottom: 1px solid var(--av-border);
  padding: .7rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 1rem;
}
.av-topbar-title { font-size: 1rem; font-weight: 600; color: var(--av-dark); }
.av-topbar-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

/* ── Page content ── */
.av-content { padding: 1.75rem 2rem; flex: 1; }

/* ── Stat cards ── */
.av-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.av-stat-card {
  background: var(--av-white);
  border: 1px solid var(--av-border);
  border-radius: var(--av-radius);
  padding: 1.1rem 1.4rem;
  box-shadow: var(--av-shadow);
}
.av-stat-num   { font-size: 1.8rem; font-weight: 700; color: var(--av-primary); }
.av-stat-label { font-size: .76rem; color: var(--av-muted); margin-top: .15rem; }

/* ── Generic card ── */
.av-card {
  background: var(--av-white);
  border: 1px solid var(--av-border);
  border-radius: var(--av-radius);
  box-shadow: var(--av-shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.av-card-header {
  padding: .85rem 1.4rem;
  border-bottom: 1px solid var(--av-border);
  background: #fafbff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.av-card-header h2 { font-size: .95rem; font-weight: 700; color: var(--av-dark); }
.av-card-body { padding: 1.4rem; }

/* ── Table ── */
.av-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.av-table th {
  background: #fafbff;
  font-weight: 700;
  font-size: .72rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--av-muted);
  padding: .65rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--av-border);
}
.av-table td { padding: .7rem 1rem; border-bottom: 1px solid var(--av-border); vertical-align: middle; }
.av-table tr:last-child td { border-bottom: none; }
.av-table tr:hover td { background: #fafbff; }
.av-table .av-td-title { font-weight: 600; color: var(--av-dark); }

/* ── Badges ── */
.av-badge {
  display: inline-block;
  padding: .18rem .55rem;
  border-radius: 20px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.av-badge--borrador  { background: #fff3cd; color: #856404; }
.av-badge--publicado { background: #d1e7dd; color: #0a3622; }
.av-badge--archivado { background: #e2e3e5; color: #495057; }
.av-badge--texto     { background: #cfe2ff; color: #084298; }
.av-badge--imagen    { background: #e8d5fb; color: #5a2d82; }
.av-badge--video     { background: #ffe5d0; color: #8b3a00; }
.av-badge--pdf       { background: #ffd6d6; color: #842029; }
.av-badge--excel     { background: #d1f5d3; color: #0a3d20; }
.av-badge--archivo   { background: #e2e3e5; color: #495057; }

/* ── Buttons ── */
.av-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .35rem .85rem;
  border-radius: 4px;
  font-size: .8rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none !important;
  transition: all .15s;
  white-space: nowrap;
  line-height: 1.4;
}
.av-btn--primary   { background: var(--av-primary); color: #fff; border-color: var(--av-primary); }
.av-btn--primary:hover { background: var(--av-dark); border-color: var(--av-dark); color: #fff; }
.av-btn--success   { background: var(--av-success); color: #fff; border-color: var(--av-success); }
.av-btn--success:hover { background: #146c43; border-color: #146c43; color: #fff; }
.av-btn--danger    { background: var(--av-danger);  color: #fff; border-color: var(--av-danger); }
.av-btn--danger:hover  { background: #b02a37; border-color: #b02a37; color: #fff; }
.av-btn--warning   { background: var(--av-warning); color: #333; border-color: var(--av-warning); }
.av-btn--warning:hover { background: #d39e00; color: #333; }
.av-btn--secondary { background: #6c757d; color: #fff; border-color: #6c757d; }
.av-btn--secondary:hover { background: #5a6268; color: #fff; }
.av-btn--outline   { background: transparent; border-color: var(--av-border); color: var(--av-text); }
.av-btn--outline:hover { border-color: var(--av-primary); color: var(--av-primary); }
.av-btn--sm  { padding: .22rem .55rem; font-size: .74rem; }
.av-btn--lg  { padding: .6rem 1.6rem; font-size: .92rem; }
.av-btn--icon { padding: .28rem .45rem; }

/* ── Forms ── */
.av-form-group { margin-bottom: 1.1rem; }
.av-label {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  color: var(--av-dark);
  margin-bottom: .3rem;
}
.av-label span { font-weight: 400; color: var(--av-muted); }

.av-input,
.av-select,
.av-textarea {
  width: 100%;
  padding: .48rem .75rem;
  border: 1px solid var(--av-border);
  border-radius: var(--av-radius);
  font-family: inherit;
  font-size: .88rem;
  color: var(--av-text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.av-input:focus,
.av-select:focus,
.av-textarea:focus {
  outline: none;
  border-color: var(--av-primary);
  box-shadow: 0 0 0 3px rgba(65,70,166,.1);
}
.av-textarea { min-height: 150px; resize: vertical; font-family: 'Courier New', monospace; font-size: .82rem; }
.av-hint { font-size: .73rem; color: var(--av-muted); margin-top: .3rem; }

.av-form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.av-form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ── Block list ── */
.av-blocks { display: flex; flex-direction: column; gap: .6rem; }
.av-block {
  background: var(--av-white);
  border: 1px solid var(--av-border);
  border-radius: var(--av-radius);
  overflow: hidden;
}
.av-block-header {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .9rem;
  background: #fafbff;
  border-bottom: 1px solid transparent;
  flex-wrap: wrap;
}
.av-block-header.is-editing {
  background: #eef0ff;
  border-bottom-color: var(--av-primary);
}
.av-block-num     { font-size: .68rem; font-weight: 700; color: var(--av-muted); min-width: 18px; }
.av-block-preview { flex: 1; font-size: .8rem; color: var(--av-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.av-block-actions { display: flex; gap: .25rem; align-items: center; flex-shrink: 0; }
.av-block-form    { padding: 1.1rem 1.3rem; border-top: 1px solid var(--av-border); }

/* ── Rich text editor ── */
.av-editor-toolbar {
  display: flex;
  align-items: center;
  gap: .1rem;
  padding: .3rem .5rem;
  background: #f0f1f9;
  border: 1px solid var(--av-border);
  border-bottom: none;
  border-radius: var(--av-radius) var(--av-radius) 0 0;
  flex-wrap: wrap;
}
.av-editor-toolbar button {
  padding: .22rem .42rem;
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 700;
  color: var(--av-text);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
}
.av-editor-toolbar button:hover { background: var(--av-white); border-color: var(--av-border); }
.av-editor-toolbar select {
  font-size: .75rem;
  padding: .18rem .35rem;
  border: 1px solid var(--av-border);
  border-radius: 4px;
  background: #fff;
  color: var(--av-text);
  cursor: pointer;
  font-family: inherit;
}
.av-editor-toolbar select:focus { outline: none; border-color: var(--av-primary); }
.av-tb-sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: var(--av-border);
  margin: 0 .25rem;
  vertical-align: middle;
  flex-shrink: 0;
}
.av-tb-group {
  display: inline-flex;
  align-items: center;
  gap: .05rem;
}

.av-editor-area {
  min-height: 160px;
  padding: .6rem .75rem;
  border: 1px solid var(--av-border);
  border-radius: 0 0 var(--av-radius) var(--av-radius);
  background: #fff;
  outline: none;
  font-family: inherit;
  font-size: .88rem;
  line-height: 1.65;
}
.av-editor-area:focus { border-color: var(--av-primary); }

/* ── Alerts ── */
.av-alert {
  padding: .7rem 1rem;
  border-radius: var(--av-radius);
  font-size: .85rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.av-alert--success { background: #d1e7dd; border-color: #a3cfbb; color: #0a3622; }
.av-alert--danger  { background: #f8d7da; border-color: #f1aeb5; color: #842029; }
.av-alert--info    { background: #cff4fc; border-color: #9eeaf9; color: #055160; }

/* ── Banner preview ── */
.av-banner-preview {
  max-height: 160px;
  width: auto;
  border-radius: 4px;
  border: 1px solid var(--av-border);
  object-fit: cover;
  margin-top: .5rem;
}

/* ── Login page ── */
.av-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2f3374 0%, #4146A6 100%);
  padding: 1.5rem;
}
.av-login-card {
  background: var(--av-white);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.28);
  padding: 2.4rem 2rem;
  width: 380px;
  max-width: 100%;
}
.av-login-logo  { text-align: center; margin-bottom: 1.4rem; }
.av-login-logo img { max-height: 56px; margin: 0 auto; }
.av-login-title { font-size: 1.2rem; font-weight: 700; color: var(--av-dark); margin-bottom: .2rem; }
.av-login-sub   { font-size: .82rem; color: var(--av-muted); margin-bottom: 1.4rem; }

/* ── Divider ── */
.av-divider { border: none; border-top: 1px solid var(--av-border); margin: 1.3rem 0; }

/* ── Flex helpers ── */
.av-flex     { display: flex; align-items: center; }
.av-flex-gap { gap: .6rem; }
.av-flex-between { justify-content: space-between; }
.av-mt-1 { margin-top: .5rem; }
.av-mt-2 { margin-top: 1rem; }
.av-text-muted { color: var(--av-muted); font-size: .82rem; }

/* ── Add-block panel ── */
.av-add-block-panel {
  border: 2px dashed var(--av-border);
  border-radius: var(--av-radius);
  padding: 1.2rem;
  background: #fafbff;
}
.av-add-block-panel h3 { font-size: .88rem; font-weight: 700; color: var(--av-dark); margin-bottom: .8rem; }

/* ── Type selector ── */
.av-type-grid {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: .9rem;
}
.av-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  padding: .7rem 1rem;
  border: 2px solid var(--av-border);
  border-radius: 10px;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: var(--av-muted);
  transition: all .15s;
  min-width: 72px;
}
.av-type-btn svg { opacity: .6; transition: opacity .15s; }
.av-type-btn:hover { border-color: var(--av-primary); color: var(--av-primary); background: #f3f4ff; }
.av-type-btn:hover svg { opacity: 1; }
.av-type-btn.selected { border-color: var(--av-primary); color: var(--av-primary); background: #eef0ff; box-shadow: 0 0 0 3px rgba(65,70,166,.12); }
.av-type-btn.selected svg { opacity: 1; }

/* ── Toolbar groups & separator ── */
.av-tb-sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: var(--av-border);
  margin: 0 .25rem;
  vertical-align: middle;
  flex-shrink: 0;
}
.av-tb-group {
  display: inline-flex;
  align-items: center;
  gap: .05rem;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .av-stats { grid-template-columns: repeat(2, 1fr); }
  .av-form-row-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .av-sidebar { width: 200px; }
  .av-main    { margin-left: 200px; }
  .av-content { padding: 1.2rem 1rem; }
  .av-form-row,
  .av-form-row-3 { grid-template-columns: 1fr; }
  .av-stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .av-layout { flex-direction: column; }
  .av-sidebar { position: static; width: 100%; height: auto; }
  .av-main    { margin-left: 0; }
}
