/* ═══════════════════════════════════════════════════
   Barber Novoa — Cliente · Calendar View
═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #F7F6F3;
  --bg2:         #FFFFFF;
  --bg3:         #EFEDE8;
  --bg-blur:     rgba(247,246,243,0.85);
  --accent:      #1A1917;
  --accent2:     #72706C;
  --accent3:     #B0ADA8;
  --gold:        #8B6914;
  --gold-mid:    #B8930A;
  --gold-light:  #D4AF37;
  --gold-pale:   rgba(139,105,20,0.09);
  --gold-border: rgba(139,105,20,0.20);
  --success:     #2E7D4F;
  --success-bg:  rgba(46,125,79,0.09);
  --success-bd:  rgba(46,125,79,0.22);
  --danger:      #C0392B;
  --danger-bg:   rgba(192,57,43,0.07);
  --danger-bd:   rgba(192,57,43,0.22);
  --warn-bg:     rgba(180,110,0,0.09);
  --warn-bd:     rgba(180,110,0,0.24);
  --warn-text:   #7A4A00;
  --border:      rgba(0,0,0,0.07);
  --border-mid:  rgba(0,0,0,0.12);
  --shadow-sm:   0 2px 12px rgba(0,0,0,0.06);
  --shadow-md:   0 8px 32px rgba(0,0,0,0.10);
  --shadow-lg:   0 24px 64px rgba(0,0,0,0.13);
  --shadow-gold: 0 8px 28px rgba(139,105,20,0.16);
  --radius:      18px;
  --radius-sm:   12px;
  --radius-xs:   8px;
  --ease:        cubic-bezier(0.4,0,0.2,1);
  --spring:      cubic-bezier(0.34,1.4,0.64,1);
  --t:           0.25s;
}

html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--accent);
  min-height: 100vh; -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.10); border-radius: 10px; }

/* ══════════════════════════════════
   AUTH
══════════════════════════════════ */
#auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  background:
    radial-gradient(ellipse 90% 60% at 50% -5%, rgba(212,175,55,0.11) 0%, transparent 65%),
    radial-gradient(ellipse 45% 35% at 85% 100%, rgba(139,105,20,0.07) 0%, transparent 55%),
    var(--bg);
  animation: fadeUp 0.65s var(--ease) both;
}
@keyframes fadeUp { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:translateY(0)} }

.auth-card {
  background: rgba(255,255,255,0.84); backdrop-filter: blur(32px) saturate(1.5);
  -webkit-backdrop-filter: blur(32px) saturate(1.5);
  border: 1px solid rgba(255,255,255,0.92); border-radius: 30px;
  padding: 2.8rem 2.5rem; width: 100%; max-width: 430px;
  box-shadow: var(--shadow-lg), 0 1px 0 #fff inset;
}
.auth-logo { text-align: center; margin-bottom: 2.2rem; }
.auth-logo-icon {
  width: 64px; height: 64px; background: var(--accent); border-radius: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  margin: 0 auto 1.1rem; box-shadow: var(--shadow-md), 0 0 0 1px rgba(0,0,0,0.10);
}
.auth-logo-icon svg { width: 28px; height: 28px; }
.auth-logo h1 {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif; font-size: 2.1rem; font-weight: 500;
  color: var(--accent); letter-spacing: -0.03em; line-height: 1.1;
}
.auth-logo p { color: var(--accent2); font-size: 0.85rem; margin-top: 0.38rem; }

.tab-row {
  display: flex; background: var(--bg3); border-radius: var(--radius-sm);
  padding: 3px; margin-bottom: 1.8rem; border: 1px solid var(--border);
}
.tab-btn {
  flex: 1; padding: 0.58rem 1rem; border: none; background: none;
  color: var(--accent2); border-radius: 10px; cursor: pointer;
  font-size: 0.875rem; font-weight: 500; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif;
  transition: all 0.22s var(--ease);
}
.tab-btn.active { background: var(--bg2); color: var(--accent); font-weight: 600; box-shadow: var(--shadow-sm); }

.form-group { margin-bottom: 1rem; }
label {
  display: block; font-size: 0.72rem; font-weight: 600; color: var(--accent2);
  margin-bottom: 0.44rem; letter-spacing: 0.08em; text-transform: uppercase;
}
input {
  width: 100%; padding: 0.84rem 1.1rem; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--accent); font-size: 0.95rem;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif; outline: none;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), background var(--t) var(--ease);
}
input:focus { background: var(--bg2); border-color: var(--gold-mid); box-shadow: 0 0 0 3.5px rgba(184,147,10,0.13); }
input::placeholder { color: var(--accent3); }

.btn-primary {
  width: 100%; padding: 0.9rem; background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius-sm); font-size: 0.95rem; font-weight: 600;
  cursor: pointer; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif;
  transition: background var(--t), transform 0.12s, box-shadow var(--t);
  box-shadow: 0 4px 18px rgba(0,0,0,0.22); letter-spacing: 0.01em; margin-top: 0.7rem;
}
.btn-primary:hover  { background: #2c2b29; }
.btn-primary:active { transform: scale(0.984); }

.auth-error {
  background: var(--danger-bg); border: 1px solid var(--danger-bd); border-radius: var(--radius-xs);
  padding: 0.7rem 1rem; color: var(--danger); font-size: 0.83rem; margin-top: 0.9rem; display: none;
  animation: shake 0.3s var(--ease);
}
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }

/* ══════════════════════════════════
   HEADER / NAV
══════════════════════════════════ */
#app-screen { display: none; animation: fadeUp 0.4s var(--ease) both; }

header {
  background: var(--bg-blur); backdrop-filter: blur(22px) saturate(1.7);
  -webkit-backdrop-filter: blur(22px) saturate(1.7);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 200; gap: 0.75rem;
}
.logo { display: flex; align-items: center; gap: 0.65rem; }
.logo-icon {
  width: 34px; height: 34px; background: var(--accent); border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.logo-icon svg { width: 14px; height: 14px; }
.logo-text { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif; font-size: 1.12rem; font-weight: 500; color: var(--accent); letter-spacing: -0.02em; }
.logo-sub  { font-size: 0.58rem; color: var(--accent3); letter-spacing: 0.15em; text-transform: uppercase; }

#header-user { display: flex; align-items: center; gap: 0.7rem; font-size: 0.82rem; color: var(--accent2); flex-shrink: 0; }
#header-username { color: var(--accent); font-weight: 600; }
#btn-logout {
  background: var(--bg3); border: 1px solid var(--border); color: var(--accent2);
  padding: 0.32rem 0.82rem; border-radius: 20px; cursor: pointer;
  font-size: 0.76rem; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif; transition: all 0.2s;
}
#btn-logout:hover { background: var(--danger-bg); border-color: var(--danger-bd); color: var(--danger); }

nav {
  background: var(--bg-blur); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border); display: flex; padding: 0 1.5rem;
}
.nav-btn {
  padding: 0.82rem 1.3rem; background: none; border: none;
  border-bottom: 2px solid transparent; color: var(--accent2);
  cursor: pointer; font-size: 0.84rem; font-weight: 500; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif;
  transition: all 0.22s var(--ease); display: flex; align-items: center; gap: 0.42rem;
  white-space: nowrap; flex-shrink: 0;
}
.nav-btn svg { width: 14px; height: 14px; opacity: 0.5; transition: opacity 0.2s; }
.nav-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.nav-btn.active svg { opacity: 1; }
.nav-btn:hover:not(.active) { color: var(--accent); }

/* ══════════════════════════════════
   PAGES
══════════════════════════════════ */
.page { display: none; padding: 1.6rem 1.4rem; max-width: 700px; margin: 0 auto; }
.page.active { display: block; animation: slideIn 0.35s var(--ease) both; }
@keyframes slideIn { from{opacity:0;transform:translateY(14px)} to{opacity:1;transform:translateY(0)} }

.page-header { margin-bottom: 1.5rem; }
.page-header h2 {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif; font-size: 1.9rem; font-weight: 500;
  color: var(--accent); letter-spacing: -0.03em;
}
.page-header p { color: var(--accent2); margin-top: 0.3rem; font-size: 0.84rem; }

/* ══════════════════════════════════
   BOOKING CALENDAR
══════════════════════════════════ */
.booking-calendar {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
}

/* ── Month nav ── */
.cal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.2rem 1.4rem 1rem;
  border-bottom: 1px solid var(--border);
}
.cal-month-label {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif; font-size: 1.3rem; font-weight: 500;
  color: var(--accent); letter-spacing: -0.02em;
}
.cal-arrow {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg3); cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; color: var(--accent2); flex-shrink: 0;
}
.cal-arrow:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.cal-arrow svg { width: 14px; height: 14px; }

/* ── Day grid ── */
.cal-body { padding: 0.8rem 1rem 1rem; }
.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  margin-bottom: 0.3rem;
}
.cal-wd {
  text-align: center; font-size: 0.62rem; font-weight: 700; color: var(--accent3);
  text-transform: uppercase; letter-spacing: 0.06em; padding: 0.3rem 0;
}
.cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }

.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-size: 0.85rem; font-weight: 500; cursor: pointer;
  transition: all 0.18s var(--ease); position: relative; color: var(--accent);
  border: 1.5px solid transparent; user-select: none;
}
.cal-day:hover:not(.cal-empty):not(.cal-past):not(.cal-no-slots) {
  background: var(--bg3); border-color: var(--border-mid);
}
.cal-day.cal-empty   { cursor: default; }
.cal-day.cal-past    { color: var(--accent3); cursor: default; }
.cal-day.cal-no-slots { color: var(--accent3); cursor: default; }

/* Today ring */
.cal-day.cal-today {
  font-weight: 700; color: var(--gold);
}
.cal-day.cal-today::after {
  content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; background: var(--gold); border-radius: 50%;
}

/* Has slots dot */
.cal-day.cal-has-slots::before {
  content: ''; position: absolute; top: 4px; right: 4px;
  width: 5px; height: 5px; background: var(--success); border-radius: 50%;
  box-shadow: 0 0 0 1.5px rgba(46,125,79,0.2);
}

/* Selected */
.cal-day.cal-selected {
  background: var(--accent) !important; color: #fff !important;
  border-color: var(--accent) !important; font-weight: 600;
}
.cal-day.cal-selected::before { display: none; }
.cal-day.cal-selected::after  { display: none; }

/* ── Time slots panel ── */
.time-panel {
  border-top: 1px solid var(--border);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.4s var(--ease);
}
.time-panel.open { max-height: 400px; }

.time-panel-inner { padding: 1.2rem 1.4rem 1.4rem; }

.time-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.time-panel-date {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif; font-size: 1.1rem; font-weight: 500;
  color: var(--accent); letter-spacing: -0.01em;
}
.time-panel-count {
  font-size: 0.72rem; font-weight: 600; color: var(--accent2);
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 20px; padding: 0.18rem 0.65rem;
}

.time-slots-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 0.5rem;
}
.time-slot-btn {
  padding: 0.65rem 0.5rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg3);
  color: var(--accent); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif;
  font-size: 1.1rem; font-weight: 500; cursor: pointer; text-align: center;
  transition: all 0.18s var(--ease); letter-spacing: -0.01em;
}
.time-slot-btn:hover {
  border-color: var(--gold-border); background: var(--gold-pale); color: var(--gold);
  transform: translateY(-1px); box-shadow: 0 3px 10px rgba(139,105,20,0.12);
}
.time-slot-btn:active { transform: scale(0.97); }

/* No slots for day */
.time-no-slots {
  text-align: center; padding: 1.5rem; color: var(--accent2); font-size: 0.84rem;
}

/* ══════════════════════════════════
   MY BOOKINGS
══════════════════════════════════ */
.bookings-list { display: flex; flex-direction: column; gap: 0.65rem; }
.booking-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.4rem; display: flex; align-items: center; gap: 1rem;
  transition: box-shadow var(--t), border-color var(--t);
  animation: fadeUp 0.4s var(--ease) both;
}
.booking-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-mid); }

.booking-time-big {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif; font-size: 1.7rem; font-weight: 500;
  color: var(--gold); letter-spacing: -0.02em; min-width: 50px; text-align: center; flex-shrink: 0;
}
.booking-divider { width: 1px; height: 34px; background: var(--border); flex-shrink: 0; }
.booking-info { flex: 1; min-width: 0; }
.booking-slot { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.booking-date { font-size: 0.78rem; color: var(--accent2); margin-top: 2px; }

.booking-actions { display: flex; align-items: center; gap: 0.55rem; flex-shrink: 0; }

.btn-cancel-booking {
  padding: 0.28rem 0.75rem; border-radius: var(--radius-xs);
  border: 1px solid var(--danger-bd); background: var(--danger-bg);
  color: var(--danger); font-size: 0.72rem; font-weight: 600;
  cursor: pointer; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif;
  transition: all 0.18s; white-space: nowrap;
}
.btn-cancel-booking:hover { background: rgba(192,57,43,0.14); border-color: var(--danger); }


.badge {
  padding: 0.27rem 0.82rem; border-radius: 20px; font-size: 0.71rem;
  font-weight: 600; white-space: nowrap; letter-spacing: 0.02em;
}
.badge-paid    { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-bd); }
.badge-pending { background: var(--warn-bg);    color: var(--warn-text); border: 1px solid var(--warn-bd); }

/* ══════════════════════════════════
   EMPTY / LOADER
══════════════════════════════════ */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--accent2); animation: fadeUp 0.4s var(--ease) both; }
.empty-icon {
  width: 50px; height: 50px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; margin: 0 auto 1rem;
}
.empty-icon svg { width: 20px; height: 20px; opacity: 0.4; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--accent); margin-bottom: 0.35rem; }
.empty-state p  { font-size: 0.84rem; }

.loader { display: flex; align-items: center; justify-content: center; padding: 4rem; color: var(--accent2); gap: 0.85rem; font-size: 0.88rem; }
.spinner { width: 20px; height: 20px; flex-shrink: 0; border: 2px solid rgba(0,0,0,0.09); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ══════════════════════════════════
   MODAL
══════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20,18,15,0.38);
  display: none; align-items: flex-end; justify-content: center;
  z-index: 300; padding: 1rem;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.modal-overlay.open { display: flex; animation: overlayIn 0.22s var(--ease) both; }
@keyframes overlayIn { from{opacity:0} to{opacity:1} }

.modal {
  background: var(--bg2); border: 1px solid rgba(255,255,255,0.85);
  border-radius: 26px 26px 20px 20px; padding: 0 2rem 2rem;
  max-width: 440px; width: 100%; box-shadow: var(--shadow-lg);
  animation: modalUp 0.38s var(--spring) both;
}
@keyframes modalUp { from{opacity:0;transform:translateY(60px) scale(0.96)} to{opacity:1;transform:translateY(0) scale(1)} }

.modal-handle {
  width: 36px; height: 4px; background: var(--border-mid); border-radius: 2px;
  margin: 0.95rem auto 1.5rem; display: block;
}
.modal h3 {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif; font-size: 1.55rem; font-weight: 500;
  color: var(--accent); margin-bottom: 0.35rem; letter-spacing: -0.02em;
}
.modal p { color: var(--accent2); font-size: 0.86rem; margin-bottom: 1.4rem; }

.modal-slot-display {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 1.2rem; text-align: center; margin-bottom: 1.5rem; position: relative; overflow: hidden;
}
.modal-slot-display::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
}
.msdate { font-size: 0.88rem; font-weight: 500; color: var(--accent); margin-bottom: 0.45rem; }
.mstime {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif; font-size: 2.6rem; font-weight: 500;
  color: var(--gold); letter-spacing: -0.03em; line-height: 1;
}

.modal-btns { display: flex; gap: 0.65rem; }
.btn-cancel {
  flex: 1; padding: 0.84rem; background: var(--bg3); border: 1px solid var(--border);
  color: var(--accent2); border-radius: var(--radius-sm); cursor: pointer;
  font-size: 0.9rem; font-weight: 500; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif; transition: all 0.2s;
}
.btn-cancel:hover { background: var(--danger-bg); border-color: var(--danger-bd); color: var(--danger); }
.modal-btns .btn-primary { flex: 1; margin-top: 0; }

/* ══════════════════════════════════
   TOAST
══════════════════════════════════ */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(70px);
  background: var(--accent); border-radius: 40px;
  padding: 0.76rem 1.5rem; font-size: 0.855rem; font-weight: 500; color: #fff;
  box-shadow: 0 12px 40px rgba(0,0,0,0.20); opacity: 0;
  transition: all 0.4s var(--spring); z-index: 400; pointer-events: none;
  white-space: nowrap; max-width: calc(100vw - 2rem); text-align: center;
}
.toast.show    { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: #1e6e3a; }
.toast.error   { background: var(--danger); }

/* ══════════════════════════════════
   RESPONSIVE
══════════════════════════════════ */
@media (max-width: 600px) {
  .logo-sub { display: none; } /* Hide "Reservas" sublogo to make room for name */
  #header-user { font-size: 0.8rem; gap: 0.4rem; }
  .page { padding: 1.2rem 1rem; }
  .page-header h2 { font-size: 1.7rem; }
  .cal-nav { margin-bottom: 0.5rem; }
  
  /* Mobile Bookings Card Layout */
  .booking-card {
    flex-wrap: wrap; 
    gap: 0.8rem;
    padding: 1rem;
  }
  .booking-divider { display: none; }
  .booking-info {
    flex: 1;
    min-width: 140px;
  }
  .booking-actions {
    width: 100%;
    margin-top: 0.2rem;
    justify-content: flex-start;
  }
  .cal-body { padding: 0.6rem 0.7rem 0.8rem; }
  .cal-header { padding: 1rem 1.1rem 0.85rem; }
  .time-panel-inner { padding: 1rem 1.1rem 1.2rem; }
  .time-slots-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 0.4rem; }
  .time-slot-btn { font-size: 1rem; padding: 0.6rem 0.4rem; }
  .modal { border-radius: 22px 22px 16px 16px; padding: 0 1.5rem 1.8rem; }
  .mstime { font-size: 2.1rem; }
}
@media (max-width: 380px) {
  .time-chips { gap: 0.35rem; }
  .time-chip { font-size: 0.78rem; padding: 0.38rem 0.72rem; }
}