/* =============================================
   Xavi De La Salud — Events Admin Panel
   Mobile-first responsive design
   ============================================= */

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

:root {
  --sidebar-w: 230px;
  --sidebar-bg: #141417;
  --sidebar-border: #2a2a2e;
  --accent: #D4AF37;
  --accent-hover: #c49f2a;
  --bg: #F0F0F5;
  --card: #ffffff;
  --text: #1C1C1E;
  --text-muted: #6e6e73;
  --border: #e0e0e5;
  --danger: #e94560;
  --success: #34c759;
  --warning: #ff9f0a;
  --info: #0a84ff;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
}

html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; color: var(--text); background: var(--bg); -webkit-text-size-adjust: 100%; }

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--sidebar-bg); color: #fff;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh; z-index: 200;
  border-right: 1px solid var(--sidebar-border);
  transition: transform 0.3s ease;
}
.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-logo .logo-main { font-size: 15px; font-weight: 700; color: var(--accent); letter-spacing: 0.3px; }
.sidebar-logo .logo-sub { font-size: 11px; color: #888; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { padding: 8px 18px 4px; font-size: 10px; font-weight: 600; color: #555; text-transform: uppercase; letter-spacing: 1px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; color: #aaa; text-decoration: none;
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: all 0.15s; border-left: 3px solid transparent;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.04); }
.nav-link.active { color: var(--accent); border-left-color: var(--accent); background: rgba(212,175,55,0.08); }
.nav-link .nav-icon { width: 18px; text-align: center; font-size: 16px; }

.sidebar-bottom { padding: 12px 0; border-top: 1px solid var(--sidebar-border); }
.lang-switcher { display: flex; gap: 4px; padding: 6px 18px; }
.lang-btn {
  padding: 3px 8px; border: 1px solid #444; border-radius: 4px;
  background: transparent; color: #888; font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.lang-btn.active, .lang-btn:hover { background: var(--accent); border-color: var(--accent); color: #000; }

/* ── Sidebar overlay (mobile) ── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 199; opacity: 0; transition: opacity 0.3s;
}
.sidebar-overlay.open { display: block; opacity: 1; }

/* ── Hamburger button ── */
.hamburger-btn {
  display: none; background: none; border: none; font-size: 24px;
  cursor: pointer; padding: 6px; color: var(--text); line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

/* ── Main content ── */
.main { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 14px 28px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 4px rgba(0,0,0,.04);
  gap: 10px;
}
.topbar-title { font-size: 18px; font-weight: 700; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 14px; color: var(--text-muted); font-size: 13px; flex-shrink: 0; }
.content { padding: 24px 28px; flex: 1; }

/* ── Cards ── */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 20px 24px; }
.card-header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-header h3 { font-size: 15px; font-weight: 600; }

/* ── Stats grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px;
}
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-icon.gold { background: rgba(212,175,55,.15); }
.stat-icon.blue { background: rgba(10,132,255,.12); }
.stat-icon.green { background: rgba(52,199,89,.12); }
.stat-icon.red { background: rgba(233,69,96,.12); }
.stat-icon.purple { background: rgba(140,82,255,.12); }
.stat-icon.orange { background: rgba(255,159,10,.12); }
.stat-val { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-lbl { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ── Toolbar ── */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-left { display: flex; align-items: center; gap: 10px; flex: 1; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }

/* ── Form controls ── */
.form-input, .form-select, .form-textarea {
  border: 1px solid var(--border); border-radius: 7px; padding: 10px 12px;
  font-size: 16px; color: var(--text); background: #fff; outline: none;
  transition: border-color 0.15s; font-family: inherit;
  /* 16px prevents iOS zoom on focus */
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); }
.form-input.search { min-width: 200px; padding-left: 32px; }
.search-wrap { position: relative; }
.search-wrap::before { content: '🔍'; position: absolute; left: 9px; top: 50%; transform: translateY(-50%); font-size: 12px; pointer-events: none; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236e6e73' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: 7px; font-size: 14px; font-weight: 600;
  border: none; cursor: pointer; transition: all 0.15s; text-decoration: none; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px; /* Touch target minimum */
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #d63d57; }
.btn-secondary { background: #f0f0f5; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e8e8ef; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f5f5f7; color: var(--text); }
.btn-sm { padding: 7px 12px; font-size: 13px; min-height: 36px; }
.btn-icon { padding: 7px; width: 36px; height: 36px; justify-content: center; min-height: 36px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
thead th { background: #f8f8fb; padding: 11px 14px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; border-bottom: 1px solid var(--border); }
tbody tr { border-bottom: 1px solid #f0f0f5; transition: background 0.1s; }
tbody tr:hover { background: #fafafa; }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 11px 14px; font-size: 13.5px; vertical-align: middle; }
.td-actions { display: flex; gap: 5px; }

/* ── Mobile card view for lists ── */
.mobile-card-list { display: none; }
.mobile-card-item {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 12px; position: relative;
}
.mobile-card-item .mc-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.mobile-card-item .mc-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.mobile-card-item .mc-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; margin-bottom: 10px; }
.mobile-card-item .mc-meta-item { display: flex; align-items: center; gap: 4px; }
.mobile-card-item .mc-actions { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.mobile-card-item .mc-actions .btn { flex: 1; justify-content: center; min-height: 44px; font-size: 14px; }

/* ── Badges ── */
.badge { display: inline-block; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-green { background: #e8f8ec; color: #1a8a35; }
.badge-yellow { background: #fff8e0; color: #a07000; }
.badge-red { background: #fde8ec; color: #c0002a; }
.badge-blue { background: #e0f0ff; color: #0057b8; }
.badge-orange { background: #fff0de; color: #a05500; }
.badge-gray { background: #eeeeee; color: #555; }
.badge-purple { background: #f0e8ff; color: #5500c0; }

/* ── Color dot ── */
.color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(0,0,0,0.1); vertical-align: middle; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.page-info { color: var(--text-muted); font-size: 13px; margin: 0 6px; }
.page-btn { width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.page-btn:hover { background: var(--accent); border-color: var(--accent); color: #000; }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #000; }
.page-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: #fff; border-radius: 12px; padding: 28px; max-width: 480px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-msg { font-size: 15px; margin-bottom: 20px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-actions .btn { min-height: 48px; font-size: 15px; padding: 12px 24px; }

/* ── Form panel (event/venue form) ── */
.form-panel { max-width: 860px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid.cols3 { grid-template-columns: 1fr 1fr 1fr; }
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.form-group label .req { color: var(--danger); margin-left: 2px; }
.form-textarea { min-height: 80px; resize: vertical; }
.form-section { margin: 20px 0 8px; font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.color-input-wrap { display: flex; align-items: center; gap: 8px; }
.color-input-wrap input[type=color] { width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 7px; cursor: pointer; padding: 2px; background: #fff; }
.checkbox-wrap { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.checkbox-wrap input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); cursor: pointer; }
.checkbox-wrap label { font-size: 14px; color: var(--text); cursor: pointer; text-transform: none; letter-spacing: 0; font-weight: 500; }

/* ── Toast ── */
.toast { position: fixed; bottom: 24px; right: 24px; left: 24px; padding: 14px 20px; border-radius: 8px; font-size: 14px; font-weight: 500; color: #fff; z-index: 9999; opacity: 0; transform: translateY(8px); transition: all 0.25s; pointer-events: none; max-width: 400px; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }

/* ── Upload zone ── */
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 40px; text-align: center; cursor: pointer; transition: all 0.2s; }
.upload-zone:hover, .upload-zone.drag { border-color: var(--accent); background: rgba(212,175,55,.05); }
.upload-zone .upload-icon { font-size: 40px; margin-bottom: 12px; }
.upload-zone p { color: var(--text-muted); font-size: 14px; }
.upload-zone strong { color: var(--accent); }

/* ── Dashboard event list ── */
.event-row-mini { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f5f5f5; }
.event-row-mini:last-child { border-bottom: none; }
.event-date-pill { background: var(--accent); color: #000; border-radius: 6px; padding: 4px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.event-row-mini .ev-title { font-weight: 600; font-size: 13.5px; }
.event-row-mini .ev-venue { font-size: 12px; color: var(--text-muted); }

/* ── Login page ── */
.login-page { min-height: 100vh; background: var(--sidebar-bg); display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: #1e1e22; border-radius: 16px; padding: 40px 44px; width: 380px; max-width: 100%; box-shadow: 0 24px 80px rgba(0,0,0,.5); border: 1px solid #2a2a2e; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { color: var(--accent); font-size: 22px; font-weight: 800; }
.login-logo p { color: #888; font-size: 13px; margin-top: 4px; }
.login-form .form-group { margin-bottom: 14px; }
.login-form label { font-size: 11px; font-weight: 600; color: #aaa; text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 6px; }
.login-form .form-input { width: 100%; background: #141417; border-color: #333; color: #fff; }
.login-form .form-input:focus { border-color: var(--accent); }
.login-form .btn-primary { width: 100%; justify-content: center; margin-top: 8px; padding: 14px; font-size: 16px; min-height: 50px; }
.login-error { color: var(--danger); font-size: 13px; margin-top: 10px; text-align: center; }
.login-lang { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 42px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Checkbox in table ── */
input.row-check { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* ── Import result ── */
.import-result { border-radius: 8px; padding: 16px 20px; margin-top: 16px; }
.import-result.success { background: #e8f8ec; border: 1px solid #8fd9a3; }
.import-result.error { background: #fde8ec; border: 1px solid #f0a0b0; }

/* ── Quick action bar (mobile floating) ── */
.mobile-fab {
  display: none; position: fixed; bottom: 24px; right: 24px; z-index: 100;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--accent); color: #000; border: none;
  font-size: 28px; box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  align-items: center; justify-content: center;
}

/* ══════════════════════════════════════
   RESPONSIVE — Mobile (max-width: 768px)
   ══════════════════════════════════════ */
@media (max-width: 768px) {
  /* Sidebar: off-screen, slides in on toggle */
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }

  /* Show hamburger */
  .hamburger-btn { display: block; }

  /* Main: full width */
  .main { margin-left: 0; }

  /* Topbar: compact */
  .topbar { padding: 10px 16px; }
  .topbar-title { font-size: 16px; }
  .topbar-right { gap: 8px; font-size: 12px; }
  .topbar-right .btn { padding: 6px 10px; font-size: 12px; min-height: 36px; }

  /* Content: less padding */
  .content { padding: 16px; }

  /* Sidebar nav links bigger for touch */
  .nav-link { padding: 14px 18px; font-size: 15px; }
  .lang-btn { padding: 6px 12px; font-size: 13px; min-height: 36px; }

  /* Stats grid: 2 columns */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 14px 16px; }
  .stat-val { font-size: 22px; }
  .stat-icon { width: 38px; height: 38px; font-size: 18px; }

  /* Forms: single column */
  .form-grid, .form-grid.cols3 { grid-template-columns: 1fr; }
  .form-full { grid-column: 1; }
  .form-panel { max-width: 100%; }
  .card-body { padding: 16px; }
  .card-header { padding: 14px 16px; }

  /* Buttons: bigger touch targets */
  .btn { min-height: 48px; padding: 12px 18px; font-size: 15px; }
  .btn-sm { min-height: 40px; padding: 8px 14px; font-size: 13px; }
  .btn-icon { width: 44px; height: 44px; min-height: 44px; }

  /* Toolbar: stacked */
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .toolbar-left { flex-direction: column; gap: 8px; }
  .toolbar-left .search-wrap { width: 100%; }
  .toolbar-left .form-input.search { width: 100%; min-width: auto; }
  .toolbar-left .form-select { width: 100%; }
  .toolbar-left .form-input[type="date"] { width: 100%; }
  .toolbar-right { justify-content: stretch; }
  .toolbar-right .btn { flex: 1; justify-content: center; }

  /* Table: hide on mobile, show cards instead */
  .desktop-table { display: none; }
  .mobile-card-list { display: block; }

  /* Pagination */
  .pagination { justify-content: center; }
  .page-btn { width: 48px; height: 48px; font-size: 16px; }

  /* Toast: full width at bottom */
  .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; text-align: center; }

  /* Upload zone: bigger */
  .upload-zone { padding: 30px 20px; }

  /* Dashboard events */
  .event-row-mini { flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px 0; }

  /* Modal: wider on mobile */
  .modal-overlay { padding: 16px; }
  .modal-box { padding: 24px; }

  /* Form submit area */
  .form-submit-mobile { flex-direction: column !important; }
  .form-submit-mobile .btn { width: 100%; justify-content: center; }
  .form-submit-mobile .btn[style*="margin-left:auto"] { margin-left: 0 !important; }

  /* Floating action button */
  .mobile-fab { display: flex; }

  /* Photo upload zone bigger touch */
  .photo-upload-zone { padding: 32px 20px; }
  .photo-upload-zone .icon { font-size: 3rem; }

  /* Color presets bigger */
  .color-preset { width: 40px; height: 40px; }

  /* Login: mobile adjustments */
  .login-card { padding: 30px 24px; }
}

/* ══════════════════════════════════════
   RESPONSIVE — Small mobile (<= 400px)
   ══════════════════════════════════════ */
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-right > span:first-child { display: none; }
  .login-card { padding: 24px 18px; }
}
