/* assets/css/mundolira.css — Responsive rewrite */

:root {
  --primary:       #7C3AED;
  --primary-dark:  #6D28D9;
  --primary-light: #EDE9FE;
  --primary-mid:   #8B5CF6;
  --accent:        #4F46E5;
  --success:       #059669;
  --success-light: #D1FAE5;
  --warning:       #D97706;
  --warning-light: #FEF3C7;
  --danger:        #DC2626;
  --danger-light:  #FEE2E2;
  --dark:          #111827;
  --dark2:         #1F2937;
  --gray:          #374151;
  --muted:         #6B7280;
  --light:         #F9FAFB;
  --border:        #E5E7EB;
  --white:         #FFFFFF;
  --radius:        10px;
  --radius-lg:     14px;
  --shadow:        0 1px 4px rgba(0,0,0,0.08);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.12);
  --sidebar-w:     240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: #F3F4F6;
  color: var(--dark);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

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

/* ═══════════════════════════════════════
   LAYOUT
═══════════════════════════════════════ */
.app-wrapper { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--dark2);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45); z-index: 199;
}
.sidebar-overlay.open { display: block; }

.sidebar-brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.logo-mark { display: inline-flex; align-items: center; gap: 9px; }
.logo-icon {
  width: 34px; height: 34px; background: var(--primary);
  border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-size: 16px; flex-shrink: 0;
}
.logo-text { font-size: 16px; font-weight: 700; color: #fff; letter-spacing: -0.3px; display: block; }
.logo-sub  { font-size: 10px; color: rgba(255,255,255,0.4); font-weight: 400; display: block; margin-top: 1px; }

.sidebar-close-btn {
  display: none;
  background: none; border: none; color: rgba(255,255,255,0.5);
  font-size: 20px; cursor: pointer; padding: 4px; line-height: 1;
}

.sidebar-nav { flex: 1; padding: 10px 8px; }

.nav-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  color: rgba(255,255,255,0.3); text-transform: uppercase;
  padding: 14px 10px 5px;
}

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; margin-bottom: 1px;
  color: rgba(255,255,255,0.65); font-size: 13px; font-weight: 500;
  transition: background 0.15s, color 0.15s; text-decoration: none;
}
.nav-link i { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--primary); color: #fff; }

.sidebar-footer {
  padding: 10px 8px 14px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.4); }
.logout-btn { font-size: 16px; color: rgba(255,255,255,0.35); cursor: pointer; padding: 4px; background: none; border: none; transition: color 0.15s; flex-shrink: 0; }
.logout-btn:hover { color: #fff; }

/* MAIN */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }

/* TOPBAR */
.topbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 20px; height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  position: sticky; top: 0; z-index: 100;
}
.topbar-left   { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.topbar-title  { font-size: 16px; font-weight: 600; color: var(--dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions{ display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.hamburger {
  display: none; background: none; border: none; cursor: pointer;
  color: var(--gray); font-size: 20px; padding: 4px; flex-shrink: 0;
}

/* PAGE BODY */
.page-body { padding: 20px; flex: 1; }

/* ═══════════════════════════════════════
   CARDS
═══════════════════════════════════════ */
.card { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
.card-header { padding: 13px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-header h3 { font-size: 14px; font-weight: 600; color: var(--dark); }
.card-body { padding: 18px; }
.card-body-flush { padding: 0; }

/* METRICS */
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.metric-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow); }
.metric-card .val { font-size: 28px; font-weight: 700; line-height: 1.1; }
.metric-card .lbl { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all 0.15s;
  font-family: inherit; line-height: 1; white-space: nowrap; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover   { background: var(--primary-dark); }
.btn-secondary { background: var(--white); color: var(--gray); border-color: var(--border); }
.btn-secondary:hover { background: var(--light); }
.btn-success   { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover   { opacity: .88; }
.btn-danger    { background: var(--white); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover    { background: var(--danger-light); }
.btn-warning   { background: var(--white); color: var(--warning); border-color: var(--warning); }
.btn-warning:hover   { background: var(--warning-light); }
.btn-sm  { padding: 5px 11px; font-size: 12px; }
.btn-xs  { padding: 3px 8px;  font-size: 11px; }
.btn-icon{ width: 32px; height: 32px; padding: 0; }
.btn-full{ width: 100%; }

/* ═══════════════════════════════════════
   FORMS
═══════════════════════════════════════ */
.form-group { margin-bottom: 13px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--gray); margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--white); color: var(--dark);
  font-family: inherit; font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none; appearance: none;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.12); }
textarea.form-control { resize: vertical; min-height: 70px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ═══════════════════════════════════════
   BADGES
═══════════════════════════════════════ */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-purple { background:#EDE9FE; color:#5B21B6; }
.badge-blue   { background:#DBEAFE; color:#1E40AF; }
.badge-green  { background:#D1FAE5; color:#065F46; }
.badge-amber  { background:#FEF3C7; color:#92400E; }
.badge-red    { background:#FEE2E2; color:#991B1B; }
.badge-gray   { background:#F3F4F6; color:#374151; }
.badge-indigo { background:#E0E7FF; color:#3730A3; }
.badge-pink   { background:#FCE7F3; color:#9D174D; }
.badge-teal   { background:#CCFBF1; color:#0F5B50; }
.badge-orange { background:#FFEDD5; color:#9A3412; }

/* ═══════════════════════════════════════
   PROGRESS
═══════════════════════════════════════ */
.progress     { background:#E5E7EB; border-radius:20px; overflow:hidden; }
.progress-bar { height:100%; border-radius:20px; transition:width 0.4s; }
.progress-sm  { height:6px; }
.progress-md  { height:8px; }
.progress-lg  { height:12px; }

/* ═══════════════════════════════════════
   TABLE
═══════════════════════════════════════ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.ml-table { width:100%; border-collapse:collapse; min-width:480px; }
table.ml-table th { padding:10px 14px; font-size:11px; font-weight:700; letter-spacing:.05em; text-transform:uppercase; color:var(--muted); border-bottom:1px solid var(--border); text-align:left; background:var(--light); white-space:nowrap; }
table.ml-table td { padding:11px 14px; border-bottom:1px solid var(--border); font-size:13px; vertical-align:middle; }
table.ml-table tr:last-child td { border-bottom:none; }
table.ml-table tbody tr:hover td { background:var(--light); }

/* ═══════════════════════════════════════
   AVATAR
═══════════════════════════════════════ */
.avatar    { width:32px; height:32px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; color:#fff; flex-shrink:0; }
.avatar-sm { width:26px; height:26px; font-size:10px; }
.avatar-lg { width:44px; height:44px; font-size:16px; }
.avatar-xl { width:56px; height:56px; font-size:20px; }

/* ═══════════════════════════════════════
   MODAL
═══════════════════════════════════════ */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.45); z-index:1000; align-items:flex-start; justify-content:center; padding:20px 12px; overflow-y:auto; }
.modal-overlay.open { display:flex; }
.modal-box    { background:var(--white); border-radius:var(--radius-lg); width:560px; max-width:100%; box-shadow:var(--shadow-md); animation:modalIn .18s ease; margin:auto; display:flex; flex-direction:column; }
.modal-box-lg { width:680px; }
.modal-box-sm { width:400px; }
.modal-header { padding:15px 18px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; gap:10px; position:sticky; top:0; background:var(--white); z-index:1; border-radius:var(--radius-lg) var(--radius-lg) 0 0; }
.modal-header h3 { font-size:15px; font-weight:600; }
.modal-body   { padding:18px; overflow-y:auto; }
.modal-footer { padding:13px 18px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:8px; flex-wrap:wrap; position:sticky; bottom:0; background:var(--white); border-radius:0 0 var(--radius-lg) var(--radius-lg); }
.close-btn    { background:none; border:none; cursor:pointer; color:var(--muted); font-size:20px; padding:2px 6px; border-radius:6px; line-height:1; flex-shrink:0; }
.close-btn:hover { background:var(--light); color:var(--dark); }
@keyframes modalIn { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:none; } }

/* ═══════════════════════════════════════
   ALERTS
═══════════════════════════════════════ */
.alert { padding:11px 15px; border-radius:var(--radius); font-size:13px; margin-bottom:14px; border:1px solid; display:flex; align-items:flex-start; gap:8px; }
.alert i { flex-shrink:0; margin-top:1px; }
.alert-success { background:var(--success-light); color:#065F46; border-color:#6EE7B7; }
.alert-danger  { background:var(--danger-light);  color:#991B1B; border-color:#FCA5A5; }
.alert-warning { background:var(--warning-light); color:#92400E; border-color:#FCD34D; }
.alert-info    { background:#EFF6FF; color:#1E40AF; border-color:#BFDBFE; }

/* ═══════════════════════════════════════
   CHECKLIST
═══════════════════════════════════════ */
.check-item { display:flex; align-items:flex-start; gap:10px; padding:9px 0; border-bottom:1px solid var(--border); }
.check-item:last-child { border-bottom:none; }
.check-item input[type=checkbox] { width:16px; height:16px; margin-top:1px; accent-color:var(--primary); cursor:pointer; flex-shrink:0; }
.check-item label { font-size:13px; cursor:pointer; flex:1; }
.check-item.done label { text-decoration:line-through; color:var(--muted); }

/* ═══════════════════════════════════════
   MISC
═══════════════════════════════════════ */
.ph-tag { display:inline-flex; align-items:center; gap:6px; background:var(--light); border:1px solid var(--border); border-radius:20px; padding:4px 11px 4px 4px; font-size:12px; cursor:pointer; transition:all .15s; user-select:none; }
.ph-tag.selected { background:var(--primary-light); border-color:var(--primary); color:var(--primary-dark); }

.color-opt { width:28px; height:28px; border-radius:50%; border:2.5px solid transparent; cursor:pointer; transition:transform .15s, border-color .15s; padding:0; }
.color-opt:hover    { transform:scale(1.15); }
.color-opt.selected { border-color:var(--dark) !important; transform:scale(1.15); }

.status-dot { width:8px; height:8px; border-radius:50%; display:inline-block; flex-shrink:0; }
.status-dot.green { background:var(--success); }
.status-dot.red   { background:var(--danger); }
.status-dot.amber { background:var(--warning); }
.status-dot.gray  { background:var(--muted); }

#toast-container { position:fixed; bottom:20px; right:16px; z-index:9999; display:flex; flex-direction:column; gap:8px; max-width:calc(100vw - 32px); }
.toast { background:var(--dark); color:#fff; padding:11px 16px; border-radius:var(--radius); font-size:13px; box-shadow:var(--shadow-md); animation:toastIn .2s ease; display:flex; align-items:center; gap:8px; max-width:320px; }
.toast.success { background:#065F46; }
.toast.error   { background:#991B1B; }
@keyframes toastIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

.login-page { min-height:100vh; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#1F2937 0%,#111827 100%); padding:20px; }
.login-card { background:var(--white); border-radius:20px; padding:36px 32px; width:380px; max-width:100%; box-shadow:0 8px 40px rgba(0,0,0,0.25); }
.login-logo { text-align:center; margin-bottom:26px; }
.login-logo .icon { width:56px; height:56px; background:var(--primary); border-radius:14px; margin:0 auto 10px; display:flex; align-items:center; justify-content:center; font-size:26px; }
.login-logo h1 { font-size:22px; font-weight:800; color:var(--dark); letter-spacing:-0.5px; }
.login-logo p  { font-size:13px; color:var(--muted); margin-top:2px; }

.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.grid-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:14px; }
.grid-4 { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; }

.text-muted { color:var(--muted); }
.text-sm    { font-size:12px; }
.text-xs    { font-size:11px; }
.fw-600     { font-weight:600; }
.fw-700     { font-weight:700; }
.d-flex     { display:flex; }
.align-center { align-items:center; }
.justify-between { justify-content:space-between; }
.gap-6  { gap:6px; }
.gap-8  { gap:8px; }
.gap-12 { gap:12px; }
.flex-1 { flex:1; }
.min-w-0{ min-width:0; }
.mt-4   { margin-top:4px; }
.mt-8   { margin-top:8px; }
.mt-12  { margin-top:12px; }
.mt-16  { margin-top:16px; }
.mb-8   { margin-bottom:8px; }
.mb-12  { margin-bottom:12px; }
.mb-16  { margin-bottom:16px; }
.mb-20  { margin-bottom:20px; }
.w-full { width:100%; }
hr.divider { border:none; border-top:1px solid var(--border); margin:14px 0; }

.empty-state   { text-align:center; padding:44px 24px; color:var(--muted); }
.empty-state i { font-size:34px; display:block; margin-bottom:10px; opacity:.35; }
.empty-state p { font-size:13px; margin-top:4px; }

/* ═══════════════════════════════════════
   RESPONSIVE — TABLET ≤ 900px
═══════════════════════════════════════ */
@media (max-width: 900px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════
   RESPONSIVE — MOBILE ≤ 680px
═══════════════════════════════════════ */
@media (max-width: 680px) {
  /* Sidebar off-canvas */
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.3); }
  .sidebar-close-btn { display: flex; }

  .main-content { margin-left: 0; }
  .hamburger    { display: flex; }

  .topbar { padding: 0 14px; height: 52px; }
  .topbar-title { font-size: 15px; }
  .page-body { padding: 14px 12px; }

  .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .grid-2  { grid-template-columns: 1fr; }
  .grid-3  { grid-template-columns: 1fr; }
  .grid-4  { grid-template-columns: repeat(2, 1fr); }
  .form-row   { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }

  .metric-card .val { font-size: 22px; }

  /* Modal: sheet desde abajo */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-box { border-radius: var(--radius-lg) var(--radius-lg) 0 0; width: 100%; max-height: 92vh; margin: 0; }
  .modal-box-lg, .modal-box-sm { width: 100%; }

  .login-card { padding: 28px 18px; }

  #toast-container { bottom:12px; right:10px; left:10px; }
  .toast { max-width: 100%; }

  .hide-mobile { display: none !important; }
  .btn-full-mobile { width: 100%; justify-content: center; }
}

/* ═══════════════════════════════════════
   RESPONSIVE — XS ≤ 400px
═══════════════════════════════════════ */
@media (max-width: 400px) {
  .metrics-grid { gap: 8px; }
  .metric-card  { padding: 12px 14px; }
  .metric-card .val { font-size: 20px; }
  .page-body    { padding: 12px 10px; }
}
