/* ============================================================
   FloorTrack — style.css
   Diseño operativo profesional — Mobile First
   ============================================================ */

/* --- VARIABLES -------------------------------------------- */
:root {
  --bg:          #0f1923;
  --bg2:         #1a2738;
  --bg3:         #243347;
  --surface:     #1e2d3d;
  --surface2:    #243347;
  --border:      #2e4060;
  --text:        #e8f0f8;
  --text-muted:  #7a9ab8;
  --text-dim:    #4a6680;

  /* Status colors */
  --pending:     #f4a940;
  --searching:   #4aa8f0;
  --found:       #3ecf6e;
  --notfound:    #f04a4a;
  --warning:     #f0b040;
  --cancelled:   #6b7f94;
  --finished:    #5a8a6a;

  /* Priority */
  --low:         #4aa8f0;
  --medium:      #f4a940;
  --high:        #f07040;
  --urgent:      #f04a4a;

  /* Brand */
  --accent:      #4aa8f0;
  --accent2:     #2d88d0;

  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 4px 24px rgba(0,0,0,.35);
  --shadow-sm:   0 2px 8px rgba(0,0,0,.25);

  --nav-h:       58px;
  --sidebar-w:   240px;
  --font:        'DM Sans', system-ui, sans-serif;
  --mono:        'JetBrains Mono', monospace;
}

/* --- RESET ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #fff; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* --- TOPNAV ----------------------------------------------- */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--nav-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  box-shadow: var(--shadow-sm);
}
.topnav-left, .topnav-right {
  display: flex; align-items: center; gap: 12px;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 1.1rem; color: var(--text);
  letter-spacing: -.02em;
}
.brand-icon { font-size: 1.4rem; color: var(--accent); }
.brand-name { display: none; }
@media (min-width: 480px) { .brand-name { display: block; } }

.menu-toggle {
  background: none; border: none; padding: 6px;
  display: flex; flex-direction: column; gap: 5px;
}
.menu-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--text-muted); border-radius: 2px;
  transition: .2s;
}

.user-chip {
  display: flex; flex-direction: column; align-items: flex-end;
  line-height: 1.2;
}
.user-chip-role {
  font-size: .65rem; font-weight: 600; color: var(--accent);
  text-transform: uppercase; letter-spacing: .08em;
}
.user-chip-name { font-size: .8rem; color: var(--text-muted); }

.btn-logout {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: var(--radius-sm);
  padding: 6px 10px; font-size: 1.1rem; transition: .2s;
}
.btn-logout:hover { background: var(--notfound); color: #fff; }

/* --- SIDEBAR ---------------------------------------------- */
.sidebar {
  position: fixed; top: var(--nav-h); left: 0; bottom: 0; z-index: 150;
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}
.sidebar.open { transform: translateX(0); }

.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 140;
  background: rgba(0,0,0,.5);
}
.sidebar-overlay.show { display: block; }

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-store {
  display: flex; align-items: center; gap: 8px;
  font-size: .82rem; color: var(--text-muted);
}
.store-icon { font-size: 1rem; }

.sidebar-nav { flex: 1; padding: 12px 8px; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: .9rem; font-weight: 500;
  transition: .15s;
  margin-bottom: 2px;
}
.sidebar-link:hover, .sidebar-link.active {
  background: var(--bg3); color: var(--text);
}
.sidebar-link.active { color: var(--accent); }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 12px 8px; border-top: 1px solid var(--border);
}
.logout-link:hover { background: rgba(240,74,74,.15); color: var(--notfound); }

/* --- MAIN CONTENT ----------------------------------------- */
.main-content {
  margin-top: var(--nav-h);
  min-height: calc(100vh - var(--nav-h));
  padding: 20px 16px 40px;
  transition: margin-left .28s;
}
@media (min-width: 900px) {
  .sidebar { transform: translateX(0); }
  .main-content { margin-left: var(--sidebar-w); }
  .menu-toggle { display: none; }
  .sidebar-overlay { display: none !important; }
}
.page-wrapper { max-width: 1100px; margin: 0 auto; }

/* --- PAGE HEADER ------------------------------------------ */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 24px;
}
.page-title { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.page-subtitle { font-size: .85rem; color: var(--text-muted); margin-top: 2px; }

/* --- CARDS ------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: .8rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px;
}

/* --- STAT CARDS ------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px; margin-bottom: 24px;
}
@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px; text-align: center;
}
.stat-number {
  font-size: 2rem; font-weight: 700;
  font-family: var(--mono); color: var(--text);
  line-height: 1;
}
.stat-label {
  font-size: .75rem; color: var(--text-muted); margin-top: 4px;
  font-weight: 500;
}
.stat-card.accent  .stat-number { color: var(--accent); }
.stat-card.success .stat-number { color: var(--found); }
.stat-card.danger  .stat-number { color: var(--notfound); }
.stat-card.warning .stat-number { color: var(--pending); }

/* --- BADGES ----------------------------------------------- */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: .72rem; font-weight: 600; letter-spacing: .04em;
  white-space: nowrap;
}
.badge-pending    { background: rgba(244,169,64,.18); color: var(--pending); border: 1px solid rgba(244,169,64,.3); }
.badge-searching  { background: rgba(74,168,240,.18); color: var(--searching); border: 1px solid rgba(74,168,240,.3); }
.badge-found      { background: rgba(62,207,110,.18); color: var(--found); border: 1px solid rgba(62,207,110,.3); }
.badge-notfound   { background: rgba(240,74,74,.18); color: var(--notfound); border: 1px solid rgba(240,74,74,.3); }
.badge-warning    { background: rgba(240,176,64,.18); color: var(--warning); border: 1px solid rgba(240,176,64,.3); }
.badge-cancelled  { background: rgba(107,127,148,.18); color: var(--cancelled); border: 1px solid rgba(107,127,148,.3); }
.badge-finished   { background: rgba(90,138,106,.18); color: var(--finished); border: 1px solid rgba(90,138,106,.3); }
.badge-default    { background: var(--bg3); color: var(--text-muted); }

/* Priority badges */
.priority-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
}
.prio-low    { background: rgba(74,168,240,.2); color: var(--low); }
.prio-medium { background: rgba(244,169,64,.2); color: var(--medium); }
.prio-high   { background: rgba(240,112,64,.2); color: var(--high); }
.prio-urgent { background: rgba(240,74,74,.25); color: var(--urgent); animation: pulse-urgent 1.4s infinite; }

@keyframes pulse-urgent {
  0%,100% { opacity: 1; }
  50%      { opacity: .6; }
}

/* --- BUTTONS ---------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 600; border: none;
  transition: .15s; white-space: nowrap; line-height: 1.2;
}
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

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

.btn-success   { background: var(--found); color: #0a1a0f; }
.btn-success:hover { background: #2db558; color: #0a1a0f; }

.btn-danger    { background: var(--notfound); color: #fff; }
.btn-danger:hover { background: #d03030; color: #fff; }

.btn-warning   { background: var(--pending); color: #1a0f00; }
.btn-warning:hover { background: #d48a20; color: #1a0f00; }

.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface2); color: #fff; }

.btn-outline {
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-outline:hover { background: var(--accent); color: #fff; }

/* --- FORMS ------------------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: .8rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .05em;
}
.form-control, .form-select, textarea {
  width: 100%; padding: 11px 14px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: .9rem;
  transition: border-color .15s;
  appearance: none; -webkit-appearance: none;
}
.form-control:focus, .form-select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74,168,240,.15);
}
textarea { resize: vertical; min-height: 90px; }
.form-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237a9ab8'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.form-row { display: grid; gap: 12px; }
@media (min-width: 600px) { .form-row.cols-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 600px) { .form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; } }

.form-hint { font-size: .75rem; color: var(--text-dim); margin-top: 4px; }

/* Toggle/checkbox */
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }

/* --- TABLES ----------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table {
  width: 100%; border-collapse: collapse;
  font-size: .85rem;
}
thead th {
  background: var(--bg3); color: var(--text-muted);
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; padding: 11px 14px; text-align: left;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td {
  padding: 12px 14px; border-bottom: 1px solid rgba(46,64,96,.5);
  vertical-align: middle;
}
tbody tr:hover { background: rgba(36,51,71,.6); }
tbody tr:last-child td { border-bottom: none; }

/* --- REQUEST CARDS (mobile) ------------------------------- */
.request-list { display: flex; flex-direction: column; gap: 10px; }
.request-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  border-left: 4px solid var(--border);
  transition: border-color .15s, transform .1s;
}
.request-card:hover { transform: translateY(-1px); border-left-color: var(--accent); }
.request-card.prio-urgent { border-left-color: var(--urgent); }
.request-card.prio-high   { border-left-color: var(--high); }
.request-card.prio-medium { border-left-color: var(--medium); }
.request-card.prio-low    { border-left-color: var(--low); }

.rc-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.rc-product { font-weight: 600; font-size: .95rem; }
.rc-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rc-body { font-size: .82rem; color: var(--text-muted); margin-bottom: 10px; }
.rc-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.rc-time { font-size: .75rem; color: var(--text-dim); font-family: var(--mono); }
.rc-actions { display: flex; gap: 8px; }

/* --- ALERTS ----------------------------------------------- */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: 16px; font-size: .88rem; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.alert-success { background: rgba(62,207,110,.15); border: 1px solid rgba(62,207,110,.3); color: var(--found); }
.alert-error   { background: rgba(240,74,74,.15); border: 1px solid rgba(240,74,74,.3); color: var(--notfound); }
.alert-info    { background: rgba(74,168,240,.15); border: 1px solid rgba(74,168,240,.3); color: var(--searching); }
.alert-warning { background: rgba(244,169,64,.15); border: 1px solid rgba(244,169,64,.3); color: var(--pending); }

/* --- MODAL ------------------------------------------------- */
.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,.7); align-items: center; justify-content: center;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
  animation: modal-in .2s ease;
}
@keyframes modal-in { from { opacity:0; transform:scale(.96) } to { opacity:1; transform:scale(1) } }
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 20px 0;
}
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 1.3rem;
  color: var(--text-muted); padding: 4px 8px;
  border-radius: 4px;
}
.modal-close:hover { color: var(--text); background: var(--bg3); }
.modal-body { padding: 16px 20px; }
.modal-footer {
  padding: 0 20px 20px;
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
}

/* --- TIMELINE (historial) --------------------------------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 6px; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot {
  position: absolute; left: -24px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg2);
}
.timeline-time { font-size: .72rem; color: var(--text-dim); font-family: var(--mono); }
.timeline-label { font-size: .85rem; font-weight: 600; color: var(--text); margin: 2px 0; }
.timeline-note { font-size: .82rem; color: var(--text-muted); }

/* --- SHIFT STATUS BAR ------------------------------------- */
.shift-bar {
  background: linear-gradient(135deg, var(--bg2) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  margin-bottom: 20px;
}
.shift-bar-info { display: flex; align-items: center; gap: 12px; }
.shift-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--found); animation: blink 1.5s infinite; }
@keyframes blink { 0%,100%{opacity:1}50%{opacity:.3} }
.shift-label { font-size: .82rem; color: var(--text-muted); }
.shift-time { font-family: var(--mono); font-weight: 600; color: var(--text); font-size: .9rem; }

/* --- FILTER BAR ------------------------------------------- */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 20px; align-items: flex-end;
}
.filter-bar .form-control,
.filter-bar .form-select { max-width: 200px; }
@media (max-width: 600px) {
  .filter-bar .form-control,
  .filter-bar .form-select { max-width: 100%; }
}

/* --- EMPTY STATE ------------------------------------------ */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-dim);
}
.empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: .5; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text-muted); }
.empty-sub { font-size: .85rem; margin-top: 4px; }

/* --- LOGIN SCREEN ----------------------------------------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, rgba(74,168,240,.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 80%, rgba(62,207,110,.05) 0%, transparent 60%),
              var(--bg);
  padding: 20px;
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 32px;
  width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo .logo-icon { font-size: 2.5rem; color: var(--accent); display: block; }
.login-logo .logo-name { font-size: 1.5rem; font-weight: 700; color: var(--text); margin-top: 4px; }
.login-logo .logo-sub  { font-size: .8rem; color: var(--text-muted); }

/* --- UTILITY ---------------------------------------------- */
.d-flex   { display: flex; }
.gap-10   { gap: 10px; }
.mt-16    { margin-top: 16px; }
.mt-24    { margin-top: 24px; }
.mb-16    { margin-bottom: 16px; }
.mb-24    { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm  { font-size: .82rem; }
.text-right { text-align: right; }
.mono     { font-family: var(--mono); }
.fw-bold  { font-weight: 700; }
.w-100    { width: 100%; }
.divider  { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* Inline items */
.inline-items { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }

/* Section title */
.section-title {
  font-size: .78rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .1em;
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.section-title::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* --- PRINT ------------------------------------------------- */
@media print {
  .topnav, .sidebar, .sidebar-overlay, .btn, .filter-bar { display: none !important; }
  .main-content { margin: 0 !important; padding: 20px !important; }
  body { background: #fff !important; color: #000 !important; }
  .card, .request-card { border: 1px solid #ccc !important; background: #fff !important; }
  .badge { border: 1px solid #999 !important; }
}
