@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #1a56db;
  --primary-dark: #1140a6;
  --primary-light: #e8f0fe;
  --secondary: #0e9f6e;
  --warning: #ff8800;
  --danger: #e02424;
  --dark: #111827;
  --gray-900: #1f2937;
  --gray-700: #374151;
  --gray-500: #6b7280;
  --gray-300: #d1d5db;
  --gray-100: #f3f4f6;
  --white: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.08);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: 'Plus Jakarta Sans', sans-serif; background: #f0f4f8; color: var(--gray-900); min-height: 100vh; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ---- LAYOUT ---- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--dark);
  color: #fff;
  position: fixed; top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  display: flex; flex-direction: column;
  transition: width .25s, transform .25s;
}
.sidebar-logo {
  padding: 22px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 11px;
}
.sidebar-logo .logo-icon {
  width: 38px; height: 38px;
  background: var(--primary); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.sidebar-logo .logo-text { font-weight: 800; font-size: 1.05rem; }
.sidebar-logo .logo-text span { color: #60a5fa; }

.sidebar-section {
  padding: 14px 14px 4px;
  font-size: .68rem; font-weight: 700;
  color: #4b5563; text-transform: uppercase; letter-spacing: 1px;
}
.sidebar-menu { list-style: none; padding: 0 8px; }
.sidebar-menu li a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  font-size: .87rem; font-weight: 500; color: #9ca3af;
  transition: all .15s; margin-bottom: 2px;
}
.sidebar-menu li a:hover { background: rgba(255,255,255,.06); color: #e5e7eb; }
.sidebar-menu li a.active { background: var(--primary); color: #fff; }
.sidebar-menu li a i { width: 18px; font-size: .95rem; }

.sidebar-user {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: #fff;
  overflow: hidden; flex-shrink: 0;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-size: .82rem; font-weight: 600; color: #f3f4f6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .72rem; color: #6b7280; }

.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; transition: margin-left .25s; }
/* Sidebar collapsed - desktop */
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .sidebar-logo { padding: 12px 0; display:flex; align-items:center; justify-content:center; }
.sidebar.collapsed .sidebar-logo img { height: 30px; margin:0; }
.sidebar.collapsed .sidebar-section { display: none; }
.sidebar.collapsed .sidebar-menu li a { justify-content: center; padding: 12px 0; }
.sidebar.collapsed .sidebar-menu li a i { width: auto; font-size: 1.15rem; margin: 0; }
.sidebar.collapsed .sidebar-menu li a .link-text { display: none; }
.sidebar.collapsed .sidebar-user { display: none; }
.sidebar.collapsed #sidebarClose i { display: none; }
.main-content.sidebar-collapsed { margin-left: 60px; }

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-300);
  padding: 0 24px; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 90;
  box-shadow: var(--shadow);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-weight: 700; font-size: 1rem; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

#menuBtn { display: none; background: none; border: none; font-size: 1.25rem; cursor: pointer; color: var(--gray-700); padding: 4px 8px; }

.btn-notif {
  position: relative; background: none; border: none;
  cursor: pointer; color: var(--gray-500); font-size: 1.1rem;
  padding: 6px; border-radius: 8px; transition: background .15s;
}
.btn-notif:hover { background: var(--gray-100); }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--danger); color: #fff;
  font-size: .58rem; font-weight: 700;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.page-content { padding: 24px; flex: 1; }

/* ---- CARDS ---- */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--gray-100); }
.card-title { font-weight: 700; font-size: .97rem; }

/* ---- STAT CARDS ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 15px; border-left: 4px solid transparent; }
.stat-card.blue  { border-color: var(--primary); }
.stat-card.green { border-color: var(--secondary); }
.stat-card.orange{ border-color: var(--warning); }
.stat-card.red   { border-color: var(--danger); }
.stat-card.purple{ border-color: #7c3aed; }
.stat-icon { width: 46px; height: 46px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.stat-card.blue   .stat-icon { background: #dbeafe; color: var(--primary); }
.stat-card.green  .stat-icon { background: #d1fae5; color: var(--secondary); }
.stat-card.orange .stat-icon { background: #fff3cd; color: var(--warning); }
.stat-card.red    .stat-icon { background: #fde8e8; color: var(--danger); }
.stat-card.purple .stat-icon { background: #ede9fe; color: #7c3aed; }
.stat-value { font-size: 1.55rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .78rem; color: var(--gray-500); margin-top: 3px; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 600;
  border: none; cursor: pointer; transition: all .15s;
  text-decoration: none; font-family: inherit; white-space: nowrap;
}
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); }
.btn-secondary{ background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover{ background: var(--gray-300); }
.btn-success  { background: var(--secondary); color: #fff; }
.btn-success:hover { background: #057a55; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #c81e1e; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-dark     { background: var(--dark); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: .78rem; }
.btn-icon { padding: 7px 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- TABLES ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .87rem; }
thead th { background: var(--gray-100); padding: 10px 14px; text-align: left; font-weight: 700; font-size: .76rem; text-transform: uppercase; color: var(--gray-500); letter-spacing: .4px; white-space: nowrap; }
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tbody tr:hover { background: #fafbfd; }
tbody tr:last-child td { border-bottom: none; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 15px; }
label { display: block; font-size: .84rem; font-weight: 600; color: var(--gray-700); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], input[type=tel], input[type=search],
select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
  font-family: inherit; font-size: .87rem; color: var(--gray-900);
  transition: border-color .15s; background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}
input[type=file] { padding: 6px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ---- BADGES ---- */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }
.badge-success   { background: #d1fae5; color: #065f46; }
.badge-danger    { background: #fde8e8; color: #9b1c1c; }
.badge-warning   { background: #fff3cd; color: #92400e; }
.badge-info      { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: var(--gray-100); color: var(--gray-700); }
.badge-purple    { background: #ede9fe; color: #5b21b6; }

/* ---- ALERTS ---- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .87rem; display: flex; align-items: flex-start; gap: 10px; }
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--secondary); }
.alert-danger  { background: #fde8e8; color: #9b1c1c; border-left: 4px solid var(--danger); }
.alert-warning { background: #fff3cd; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid var(--primary); }

/* ---- MODAL ---- */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 999; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: modalIn .2s ease; }
@keyframes modalIn { from { opacity:0; transform:scale(.95) translateY(-8px); } to { opacity:1; transform:scale(1) translateY(0); } }
.modal-lg { max-width: 720px; }
.modal-header { padding: 18px 20px 12px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; }
.modal-title  { font-weight: 700; font-size: .97rem; }
.modal-close  { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--gray-500); padding: 4px; border-radius: 6px; line-height: 1; }
.modal-close:hover { background: var(--gray-100); }
.modal-body   { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--gray-100); display: flex; gap: 8px; justify-content: flex-end; }

/* ---- MINUTA ---- */
.minuta-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--gray-100); }
.minuta-item:last-child { border-bottom: none; }
.minuta-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .88rem; flex-shrink: 0; }
.tipo-ingreso { background: #d1fae5; color: #065f46; }
.tipo-salida  { background: #fde8e8; color: #9b1c1c; }
.tipo-paquete { background: #dbeafe; color: #1e40af; }
.tipo-novedad { background: #fff3cd; color: #92400e; }
.tipo-ronda   { background: #ede9fe; color: #5b21b6; }
.tipo-visita  { background: #fce7f3; color: #9d174d; }

/* ---- QR PAGE ---- */
.qr-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f0f4f8; }
.qr-card { background: #fff; border-radius: 16px; padding: 36px; text-align: center; max-width: 380px; width: 100%; box-shadow: var(--shadow-lg); }
.qr-card img { max-width: 220px; margin: 16px auto; display: block; }

/* ---- LOGIN ---- */
.login-page { min-height: 100vh; display: flex; background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 55%, #1a56db 100%); }
.login-left  { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-right { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; color: #fff; }
.login-box { background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 25px 50px rgba(0,0,0,.28); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-big { width: 54px; height: 54px; background: var(--primary); border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; margin-bottom: 12px; }
.login-logo h1 { font-size: 1.45rem; font-weight: 800; }
.login-logo h1 span { color: var(--primary); }
.login-logo p { color: var(--gray-500); font-size: .83rem; margin-top: 4px; }
.feature-pill { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); border-radius: 8px; padding: 9px 15px; font-size: .83rem; margin: 4px; display: inline-block; }

/* ---- MISC ---- */
hr { border: none; border-top: 1px solid var(--gray-100); margin: 16px 0; }
.text-muted { color: var(--gray-500); font-size: .82rem; }
.text-danger { color: var(--danger); }
.text-success { color: var(--secondary); }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.d-flex { display: flex; } .gap-1 { gap: 6px; } .gap-2 { gap: 12px; } .flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; } .justify-between { justify-content: space-between; }
.w-100 { width: 100%; } .text-center { text-align: center; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 10px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  #menuBtn { display: block; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .login-right { display: none; }
  .page-content { padding: 16px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-box { padding: 28px 20px; }
}
