/* =========================
   X1 Master Base - app.css
   Unifica estilo para /admin/*.php + páginas base
   ========================= */

:root{
  --bg0:#070A0E;
  --bg1:#0B0F15;
  --panel:rgba(255,255,255,.06);
  --panel2:rgba(255,255,255,.08);
  --border:rgba(255,255,255,.10);
  --border2:rgba(255,255,255,.14);

  --text:#F5F7FB;
  --text2:rgba(245,247,251,.75);
  --muted:rgba(245,247,251,.55);

  --shadow: 0 14px 40px rgba(0,0,0,.45);

  /* EDITABLES por BD (settings.php inyecta :root con estos valores) */
  --primary:#421565;
  --secondary:#FBC32C;
  --accent:#57A098;

  --radius:18px;
  --radius2:14px;

  --sbw:260px;
  --sbw-collapsed:88px;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
}

*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  font-family:var(--font);
  color:var(--text);
  background:
    radial-gradient(1000px 600px at 20% 40%, rgba(87,160,152,.22), transparent 60%),
    radial-gradient(900px 700px at 75% 35%, rgba(251,195,44,.14), transparent 55%),
    radial-gradient(900px 700px at 55% 80%, rgba(66,21,101,.18), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}

/* Links */
a{ color:inherit; text-decoration:none; }
a:hover{ opacity:.92; }

/* =========================
   Layout wrapper
   ========================= */
.wrap{
  display:flex;
  min-height:100vh;
}

/* =========================
   Sidebar
   ========================= */
.sidebar{
  width:var(--sbw);
  flex:0 0 var(--sbw);
  padding:18px 14px;
  border-right:1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  position:sticky;
  top:0;
  height:100vh;
  overflow:auto;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  padding:10px 10px 14px;
  margin-bottom:10px;
}
.brand .logo{
  width:44px; height:44px;
  border-radius:14px;
  background:rgba(255,255,255,.06);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  box-shadow: 0 8px 18px rgba(0,0,0,.25);
  border:1px solid rgba(255,255,255,.08);
}
.brand .logo img{
  width:100%;
  height:100%;
  object-fit:cover;
}
.brand .title .name{
  font-weight:800;
  letter-spacing:.2px;
  line-height:1.1;
}
.brand .title .role{
  margin-top:2px;
  font-size:12px;
  color:var(--muted);
}

.sidebar nav{ margin-top:8px; display:flex; flex-direction:column; gap:8px; }

.nav-link{
  display:flex;
  align-items:center;
  gap:10px;
  padding:11px 12px;
  border-radius:14px;
  color:var(--text2);
  border:1px solid transparent;
  transition: all .15s ease;
  user-select:none;
}
.nav-link .icon{
  width:22px; height:22px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:rgba(245,247,251,.8);
}
.nav-link:hover{
  background:rgba(255,255,255,.06);
  border-color:rgba(255,255,255,.10);
  color:var(--text);
}
.nav-link.active{
  background:linear-gradient(90deg, rgba(251,195,44,.16), rgba(255,255,255,.04));
  border-color:rgba(251,195,44,.30);
  color:var(--text);
  box-shadow: 0 10px 24px rgba(0,0,0,.28);
}
.nav-link.active .icon{ color:var(--secondary); }

.sidebar .footer{
  margin-top:auto;
  padding:12px 10px 8px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.btn-collapse{
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.18);
  color:var(--text);
  padding:10px 12px;
  border-radius:14px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  transition: all .15s ease;
}
.btn-collapse:hover{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.18);
}

/* Sidebar collapsed mode (si lo activas con JS usando body.sb-collapsed) */
body.sb-collapsed .sidebar{
  width:var(--sbw-collapsed);
  flex-basis:var(--sbw-collapsed);
}
body.sb-collapsed .brand .title,
body.sb-collapsed .nav-link span:last-child,
body.sb-collapsed .btn-collapse span:last-child{
  display:none;
}
body.sb-collapsed .nav-link{
  justify-content:center;
}
body.sb-collapsed .brand{
  justify-content:center;
}

/* =========================
   Main
   ========================= */
.main{
  flex:1;
  padding:20px 22px 30px;
}

.topbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin-bottom:16px;
}
.page-title{
  margin:0;
  font-size:28px;
  letter-spacing:.2px;
}
.page-subtitle{
  margin-top:6px;
  color:var(--muted);
  font-size:13px;
}

.user-chip{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.10);
  border-radius:999px;
  color:var(--text);
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
}
.user-chip .dot{
  width:10px; height:10px;
  border-radius:999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(87,160,152,.16);
}

/* =========================
   Grid + Cards
   ========================= */
.grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:16px;
}
@media (max-width: 1100px){
  .grid-2{ grid-template-columns:1fr; }
}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border:1px solid rgba(255,255,255,.10);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card-header{
  padding:16px 18px 12px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.card-title{
  font-size:16px;
  font-weight:800;
  margin:0;
}
.card-hint{
  margin:6px 0 0;
  color:var(--muted);
  font-size:13px;
  line-height:1.4;
}
.card-body{
  padding:16px 18px 18px;
}

/* =========================
   Forms
   ========================= */
.form-group{ margin-bottom:14px; }
label{
  display:block;
  font-size:13px;
  color:var(--text2); /* IMPORTANTE: SIEMPRE BLANCO */
  margin-bottom:7px;
  font-weight:700;
}
.form-help{
  margin-top:7px;
  font-size:12px;
  color:var(--muted);
}

input[type="text"], input[type="email"], input[type="password"], select, textarea{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.20);
  color:var(--text);
  outline:none;
  transition: all .15s ease;
}
textarea{ min-height:120px; resize:vertical; }

input::placeholder{ color: rgba(245,247,251,.40); }
input:focus, select:focus, textarea:focus{
  border-color: rgba(87,160,152,.55);
  box-shadow: 0 0 0 4px rgba(87,160,152,.12);
}

/* Color control line */
.color-control{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 12px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}
.color-control .meta .title{
  font-weight:900;
  margin:0;
  font-size:14px;
  color:var(--text);
}
.color-control .meta .desc{
  margin-top:2px;
  font-size:12px;
  color:var(--muted);
}
.color-control .inputs{
  display:flex;
  align-items:center;
  gap:10px;
}
.color-picker{
  width:46px;
  height:34px;
  border:none;
  padding:0;
  background:transparent;
  cursor:pointer;
}
.color-hex{
  width:130px !important;
  text-transform:uppercase;
}
.swatch{
  width:34px;
  height:34px;
  border-radius:12px;
  background: var(--sw);
  border:1px solid rgba(255,255,255,.16);
  box-shadow: 0 10px 22px rgba(0,0,0,.22);
}

/* =========================
   Badges
   ========================= */
.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:7px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
}
.badge.accent{
  border-color: rgba(87,160,152,.35);
  background: rgba(87,160,152,.14);
}

/* =========================
   Buttons
   ========================= */
.btn{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:11px 14px;
  border-radius:14px;
  border:1px solid transparent;
  background: rgba(255,255,255,.06);
  color:var(--text);
  cursor:pointer;
  transition: all .15s ease;
  user-select:none;
  font-weight:900;
}
.btn svg{ opacity:.95; }
.btn:hover{ transform: translateY(-1px); }

.btn-primary{
  background: var(--secondary);
  color:#131313;
  border-color: rgba(251,195,44,.50);
}
.btn-primary:hover{
  filter: brightness(1.03);
  box-shadow: 0 12px 28px rgba(251,195,44,.16);
}
.btn-primary:active{
  transform: translateY(0px) scale(.99);
}

.btn-outline{
  background: transparent;
  border-color: rgba(255,255,255,.18);
  color: var(--text);
}
.btn-outline:hover{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.22);
}

/* =========================
   Preview buttons (settings)
   ========================= */
.preview-box{
  margin-top:16px;
  padding:14px 14px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.16);
}
.preview-title{
  font-weight:900;
  margin-bottom:10px;
  color:var(--text);
}
.preview-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.btn-preview{
  padding:10px 14px;
  border-radius:14px;
  font-weight:900;
  border:1px solid transparent;
  user-select:none;
}
.btn-preview.normal{
  background: var(--secondary);
  color:#131313;
}
.btn-preview.hover{
  background: var(--secondary);
  color:#131313;
  filter: brightness(1.08);
}
.btn-preview.active{
  background: var(--secondary);
  color:#131313;
  filter: brightness(.92);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.15);
}
.btn-preview.accent{
  background: rgba(87,160,152,.25);
  border-color: rgba(87,160,152,.35);
  color: var(--text);
}
.btn-preview.outline{
  background: transparent;
  border-color: rgba(255,255,255,.20);
  color: var(--text);
}

/* =========================
   Tables (users list etc)
   ========================= */
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.14);
}
.table th, .table td{
  text-align:left;
  padding:12px 12px;
  border-bottom:1px solid rgba(255,255,255,.08);
  color:var(--text2);
  font-size:13px;
}
.table th{
  color:var(--text);
  font-weight:900;
  background: rgba(255,255,255,.04);
}
.table tr:last-child td{ border-bottom:none; }

/* =========================
   Module tiles
   ========================= */
.tiles{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:14px;
}
@media (max-width: 1100px){
  .tiles{ grid-template-columns:1fr; }
}
.tile{
  padding:16px 16px;
  border-radius: var(--radius);
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  box-shadow: 0 12px 26px rgba(0,0,0,.25);
}
.tile .t-title{ font-weight:900; color:var(--text); margin:0; }
.tile .t-sub{ margin-top:4px; color:var(--muted); font-size:12px; }
.tile .t-row{ display:flex; align-items:center; justify-content:space-between; margin-top:14px; }
.pill{
  display:inline-flex;
  align-items:center;
  padding:7px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
}
.pill.ok{ background: rgba(34,197,94,.16); border-color: rgba(34,197,94,.30); }
.pill.off{ background: rgba(148,163,184,.12); border-color: rgba(148,163,184,.24); }
.tile .t-action{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.18);
  cursor:pointer;
  font-weight:900;
}
.tile .t-action:hover{ background: rgba(255,255,255,.06); }

/* =========================
   Headings (para páginas antiguas)
   ========================= */
h1,h2,h3{ color:var(--text); margin:0 0 8px; }
p{ color:var(--text2); }
small{ color:var(--muted); }

/* =========================
   Footer
   ========================= */
.footer{
  margin-top:18px;
  text-align:center;
  color:rgba(245,247,251,.55);
  font-size:12px;
  padding:10px 0 0;
}

/* =========================
   Utility: avoid “unstyled top-left”
   ========================= */
img{ max-width:100%; height:auto; }
