/* ============================================
   SUKIE COOKIE - Estilo Apple Minimalista
   ============================================ */

:root {
  --bg: #f5f5f7;
  --white: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #86868b;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --success: #34c759;
  --warning: #ff9500;
  --danger: #ff3b30;
  --border: #e5e5e5;
  --shadow: 0 2px 10px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ---- Layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.card-header h2 { font-size: 20px; font-weight: 600; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---- Botones ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font);
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-lg {
  padding: 16px 32px;
  font-size: 18px;
  border-radius: var(--radius);
}
.btn-xl {
  padding: 24px 48px;
  font-size: 24px;
  font-weight: 600;
  border-radius: 16px;
  min-width: 200px;
}

/* ---- Kiosko ---- */
.kiosk-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(180deg, #f5f5f7 0%, #e8e8ed 100%);
}

.kiosk-card {
  background: var(--white);
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  width: 100%;
  max-width: 420px;
}

.kiosk-logo {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.kiosk-subtitle {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 32px;
}

.pin-display {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}
.pin-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: all 0.2s;
}
.pin-dot.filled {
  background: var(--text);
  border-color: var(--text);
}
.pin-dot.error {
  background: var(--danger);
  border-color: var(--danger);
  animation: shake 0.5s;
}

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 300px;
  margin: 0 auto 24px;
}
.numpad-btn {
  width: 80px;
  height: 80px;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  font-size: 28px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
.numpad-btn:hover { background: #e5e5ea; }
.numpad-btn:active { background: #d1d1d6; transform: scale(0.95); }
.numpad-btn.clear { font-size: 16px; background: transparent; color: var(--danger); }
.numpad-btn.backspace { font-size: 20px; background: transparent; }

.clock-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}
.clock-btn {
  padding: 20px;
  border: none;
  border-radius: 16px;
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}
.clock-btn.entrada {
  background: var(--success);
  color: white;
}
.clock-btn.salida {
  background: var(--danger);
  color: white;
}
.clock-btn:active { transform: scale(0.97); }
.clock-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.kiosk-time {
  font-size: 48px;
  font-weight: 200;
  letter-spacing: -1px;
  color: var(--text);
  margin-bottom: 4px;
}
.kiosk-date {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.kiosk-message {
  padding: 16px;
  border-radius: var(--radius);
  margin-top: 16px;
  font-size: 16px;
  font-weight: 500;
  animation: fadeIn 0.3s;
}
.kiosk-message.success { background: #d4edda; color: #155724; }
.kiosk-message.error { background: #f8d7da; color: #721c24; }

/* ---- Navbar Admin ---- */
.navbar {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}
.navbar-brand {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.navbar-nav {
  display: flex;
  gap: 4px;
  list-style: none;
}
.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}
.nav-link:hover, .nav-link.active {
  background: rgba(0,0,0,0.05);
  color: var(--text);
}

/* ---- Tablas ---- */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
}
tr:hover td { background: #fafafa; }

/* ---- Stats / Badges ---- */
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
}
.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-green { background: #d4edda; color: #155724; }
.badge-yellow { background: #fff3cd; color: #856404; }
.badge-red { background: #f8d7da; color: #721c24; }
.badge-blue { background: #cce5ff; color: #004085; }
.badge-gray { background: #e9ecef; color: #495057; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font);
  transition: border-color 0.2s;
  background: var(--white);
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,113,227,0.1);
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s;
}
.modal {
  background: var(--white);
  border-radius: 16px;
  padding: 32px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s;
}
.modal h3 { font-size: 20px; margin-bottom: 20px; }

/* ---- Alerts banner ---- */
.alert-banner {
  background: linear-gradient(135deg, #ff9500, #ff6b00);
  color: white;
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  cursor: pointer;
  transition: transform 0.2s;
}
.alert-banner:hover { transform: translateY(-1px); }
.alert-count {
  font-size: 28px;
  font-weight: 700;
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- Helpers ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 13px; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.hidden { display: none !important; }

/* ---- Filter bar ---- */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 16px;
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 150px; }

/* ---- Animations ---- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .container { padding: 12px; }
  .card { padding: 16px; }
  .navbar-nav { gap: 0; }
  .nav-link { padding: 8px 10px; font-size: 13px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-bar .form-group { min-width: 100%; }
  table { font-size: 13px; }
  th, td { padding: 8px 10px; }
}

/* ---- Calendar view ---- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.calendar-header {
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 8px 0;
}
.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: default;
  position: relative;
}
.calendar-day.worked { background: #d4edda; }
.calendar-day.absent { background: #f8d7da; }
.calendar-day.today { border: 2px solid var(--accent); }
.calendar-day .hours {
  font-size: 10px;
  color: var(--text-secondary);
}

/* Loading spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 500;
  z-index: 2000;
  animation: slideUp 0.3s;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
