/* ============================================================
   estilos-movil.css  —  Tema "app móvil"
   Sistema de operación de puerta · Minera Río Tinto / Ingeniería ECA
   Se carga DESPUÉS de sb-admin-2.min.css y reescribe el shell:
   app bar fija + cajón (drawer) oculto + esquema slate/teal.
   ============================================================ */

:root {
  --bg:        #eef2f7;
  --surface:   #ffffff;
  --ink:       #0f172a;   /* slate-900 */
  --ink-2:     #1e293b;   /* slate-800 */
  --muted:     #64748b;   /* slate-500 */
  --line:      #e2e8f0;   /* slate-200 */
  --teal:      #0d9488;   /* acento principal */
  --teal-600:  #0f766e;
  --teal-tint: rgba(13,148,136,.12);
  --success:   #059669;   /* desbloquear */
  --success-600:#047857;
  --danger:    #e11d48;   /* bloquear / rechazar */
  --danger-600:#be123c;
  --radius:    16px;
  --radius-sm: 12px;
  --tap:       50px;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --appbar-h:  60px;
}

* { -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }

body, body#page-top {
  background: var(--bg) !important;
  color: var(--ink);
  font-size: 15px;
}

/* El wrapper deja de ser flex: el drawer va por encima (fixed) */
#wrapper { display: block; }
#content-wrapper { width: 100%; min-width: 0; background: transparent; overflow-x: hidden; }
#content { padding-bottom: calc(2rem + var(--safe-bottom)); }

/* Contenedor tipo columna de app */
.container-fluid { max-width: 940px; margin: 0 auto; padding: 1rem 1rem 0; }

/* ============================================================
   APP BAR (barra superior fija)
   ============================================================ */
.eca-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  min-height: var(--appbar-h);
  padding: .5rem .8rem;
  padding-top: calc(.5rem + var(--safe-top));
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: .4rem;
  box-shadow: 0 2px 14px rgba(15,23,42,.28);
  border: 0;
}
.eca-topbar::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--teal);
}
.eca-burger {
  background: transparent; border: 0;
  color: #fff; font-size: 1.25rem;
  width: 42px; height: 42px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}
.eca-burger:active { background: rgba(255,255,255,.12); }

.eca-brand { display: inline-flex; align-items: center; }
.eca-brand img { height: 34px; width: auto; display: block; }

.eca-titles { display: flex; flex-direction: column; justify-content: center; margin-left: .5rem; min-width: 0; line-height: 1.15; }
.eca-title { font-weight: 700; font-size: .98rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eca-sub   { font-size: .72rem; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.eca-topbar .navbar-nav { flex-direction: row; align-items: center; }
.eca-user, .eca-user:focus { color: #e2e8f0 !important; display: inline-flex; align-items: center; padding: .35rem .5rem; }
.eca-user .fa-user-circle { font-size: 1.5rem; }
.eca-topbar .dropdown-menu { border: 0; box-shadow: 0 10px 30px rgba(15,23,42,.18); border-radius: var(--radius-sm); }

/* ============================================================
   DRAWER (cajón lateral oculto por defecto)
   ============================================================ */
.app-drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 280px; max-width: 84vw;
  background: #0f172a;
  color: #cbd5e1;
  z-index: 1050;
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  box-shadow: 2px 0 24px rgba(0,0,0,.35);
  overflow-y: auto;
}
body.drawer-open .app-drawer { transform: translateX(0); }

.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  z-index: 1040;
  opacity: 0; visibility: hidden;
  transition: opacity .28s ease;
}
body.drawer-open .drawer-backdrop { opacity: 1; visibility: visible; }

.drawer-head {
  display: flex; align-items: center; gap: .6rem;
  padding: 1.1rem 1rem;
  border-bottom: 1px solid rgba(148,163,184,.16);
}
.drawer-logo { height: 40px; width: auto; }
.drawer-brand { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.drawer-brand-name { color: #fff; font-weight: 700; font-size: .9rem; }
.drawer-brand-sub  { color: #94a3b8; font-size: .72rem; }
.drawer-close {
  margin-left: auto; background: transparent; border: 0; color: #94a3b8;
  width: 38px; height: 38px; border-radius: 10px; font-size: 1.15rem;
}
.drawer-close:active { background: rgba(255,255,255,.08); }

.drawer-nav { padding: .6rem .6rem; flex: 1; }
.drawer-label {
  color: #64748b; font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  padding: .9rem .8rem .35rem;
}
.drawer-item {
  display: flex; align-items: center; gap: .85rem;
  padding: .8rem .8rem;
  margin-bottom: .15rem;
  border-radius: 12px;
  color: #cbd5e1; text-decoration: none;
  font-size: .95rem; font-weight: 500;
  min-height: var(--tap);
}
.drawer-item i { width: 22px; text-align: center; font-size: 1.02rem; color: #94a3b8; }
.drawer-item:active { background: rgba(148,163,184,.12); }
.drawer-item.active {
  background: var(--teal-tint);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--teal);
}
.drawer-item.active i { color: var(--teal); }

.drawer-logout {
  display: flex; align-items: center; gap: .85rem;
  margin: .4rem .6rem calc(.8rem + var(--safe-bottom));
  padding: .85rem .8rem;
  border-radius: 12px;
  background: rgba(225,29,72,.12);
  color: #fda4af; text-decoration: none;
  font-weight: 600; font-size: .95rem;
  min-height: var(--tap);
}
.drawer-logout i { width: 22px; text-align: center; }
.drawer-logout:active { background: rgba(225,29,72,.2); color: #fff; }

/* ============================================================
   CARDS, BOTONES, TÍTULOS
   ============================================================ */
h1.h3, h1.h3.text-gray-800 { color: var(--ink) !important; font-weight: 700; font-size: 1.35rem; }
.text-gray-800 { color: var(--ink) !important; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 18px rgba(15,23,42,.06);
}
.card .card-header {
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
  color: var(--ink);
}
.card .card-header.bg-secondary { background: var(--ink-2) !important; }

.btn { border-radius: 12px; font-weight: 600; }
.btn-lg, .btn-block { min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.btn-primary { background: var(--teal); border-color: var(--teal); }
.btn-primary:hover, .btn-primary:focus { background: var(--teal-600); border-color: var(--teal-600); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover { background: var(--success-600); border-color: var(--success-600); }
.btn-danger  { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-600); border-color: var(--danger-600); }

/* ============================================================
   PANTALLA OPERAR (home tipo app)
   ============================================================ */
.app-hero {
  max-width: 460px; margin: 1.5rem auto 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 12px 40px rgba(15,23,42,.10);
  padding: 2rem 1.5rem;
  text-align: center;
}
.app-hero-icon {
  width: 84px; height: 84px; margin: 0 auto 1rem;
  border-radius: 24px;
  background: linear-gradient(135deg, #0f172a, #334155);
  color: #fff; font-size: 2.1rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(15,23,42,.25);
}
.app-hero-title { font-size: 1.3rem; font-weight: 700; color: var(--ink); margin: 0; }
.app-hero-sub   { color: var(--muted); font-size: .9rem; margin: .25rem 0 1.6rem; }

.btn-unlock {
  width: 100%; min-height: 60px;
  border: 0; border-radius: 16px;
  background: linear-gradient(135deg, var(--success), var(--teal));
  color: #fff; font-size: 1.1rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  box-shadow: 0 8px 22px rgba(5,150,105,.35);
}
.btn-unlock:active { transform: translateY(1px); }

.app-status {
  margin-top: 1.2rem;
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .75rem 1rem;
  color: var(--ink-2); font-weight: 600; font-size: .95rem;
}

.app-note {
  max-width: 460px; margin: 1.5rem auto 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.5rem; text-align: center; color: var(--muted);
}
.app-note i { font-size: 2rem; color: var(--muted); display: block; margin-bottom: .6rem; }

/* ============================================================
   TABLAS  (escritorio: limpias / móvil: tarjetas)
   ============================================================ */
.table-responsive { border-radius: var(--radius); }
.table { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.table .thead-dark th {
  background-color: var(--ink);
  border-color: var(--ink-2);
  font-size: .74rem; text-transform: uppercase; letter-spacing: .5px;
}
.table.table-bordered, .table.table-bordered td, .table.table-bordered th { border-color: var(--line); }

@media (max-width: 575.98px) {
  body { font-size: 16px; }
  .container-fluid form .btn, .btn-block { width: 100%; }
  .d-inline .btn { width: 100%; margin-bottom: .5rem; }

  table.table.responsiva thead { display: none; }
  table.table.responsiva, table.table.responsiva tbody,
  table.table.responsiva tr, table.table.responsiva td { display: block; width: 100%; }
  table.table.responsiva tr {
    margin-bottom: 1rem; border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden;
    background: var(--surface); box-shadow: 0 2px 10px rgba(15,23,42,.05);
  }
  table.table.responsiva td {
    display: block;
    text-align: right;
    padding: .6rem .9rem;
    border: 0; border-bottom: 1px solid #f1f5f9;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  table.table.responsiva td::after { content: ""; display: block; clear: both; }
  table.table.responsiva td:last-child { border-bottom: 0; }
  table.table.responsiva td::before {
    content: attr(data-label);
    float: left;
    max-width: 32%;
    text-align: left;
    padding-right: .5rem;
    font-weight: 700; color: var(--muted);
    text-transform: uppercase; font-size: .64rem; letter-spacing: .3px; line-height: 1.3;
  }
  table.table.responsiva td.celda-acciones { text-align: center; }
  table.table.responsiva td.celda-acciones::before { content: none; }
}

/* DataTables: controles con estilo del tema */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select { border-radius: 10px; border: 1px solid var(--line); }
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--teal) !important; border-color: var(--teal) !important; color: #fff !important; border-radius: 8px;
}

/* ============================================================
   PIE Y BOTÓN "IR ARRIBA"
   ============================================================ */
.sticky-footer { background: transparent; }
.sticky-footer .copyright { color: #94a3b8; font-size: .78rem; }

.scroll-to-top {
  display: none; align-items: center; justify-content: center;
  position: fixed; right: 1rem; bottom: calc(1rem + var(--safe-bottom));
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--teal); color: #fff; z-index: 1035;
  box-shadow: 0 6px 18px rgba(13,148,136,.4);
}
.scroll-to-top:hover { background: var(--teal-600); color: #fff; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-wrap { min-height: 100vh; display: flex; align-items: center; background: linear-gradient(160deg, #0f172a 0%, #1e293b 55%, #334155 100%); }
.login-card { border-radius: 22px; overflow: hidden; border: 0; box-shadow: 0 24px 60px rgba(0,0,0,.4); }
.login-card .login-hero img { width: 100%; height: 100%; object-fit: cover; }
.login-card .form-control { min-height: var(--tap); border-radius: 12px; border: 1px solid var(--line); }
.login-card .form-control:focus { border-color: var(--teal); box-shadow: 0 0 0 .2rem var(--teal-tint); }
.btn-accion { min-height: 54px; font-size: 1.05rem; }
.login-card .btn-accion { background: linear-gradient(135deg, var(--success), var(--teal)); border: 0; color: #fff; }
