@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&display=swap');

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

:root {
  --ocean-deep: #0369a1;
  --ocean: #0ea5e9;
  --ocean-light: #7dd3fc;
  --sky: #38bdf8;
  --sky-light: #e0f2fe;
  --sand: #fbbf24;
  --sand-light: #fef3c7;
  --sand-dark: #92400e;
  --palm: #16a34a;
  --palm-dark: #166534;
  --sunset-pink: #f472b6;
  --sunset-orange: #fb923c;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --bg: #0c4a6e;
  --text: #1c1917;
  --muted: #78716c;
  --radius: 16px;
  --white-glass: rgba(255,255,255,0.15);
}

body {
  font-family: 'Fredoka', sans-serif;
  background: linear-gradient(180deg, #0c4a6e 0%, #0369a1 30%, #0ea5e9 60%, #38bdf8 100%);
  color: var(--text);
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, rgba(251,146,60,0.9), rgba(244,114,182,0.85), rgba(168,85,247,0.8));
  backdrop-filter: blur(10px);
  color: white;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  border-bottom: 3px solid rgba(255,255,255,0.2);
  position: relative;
  overflow: hidden;
}
header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -5%;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, #fde68a 30%, #fbbf24 50%, transparent 70%);
  border-radius: 50%;
  opacity: 0.6;
}

header h1 { font-size: 28px; font-weight: 700; text-shadow: 2px 2px 0 rgba(0,0,0,0.15); position: relative; z-index: 1; letter-spacing: -0.5px; }
.subtitle { opacity: 0.9; font-size: 14px; font-weight: 500; position: relative; z-index: 1; }

.date-picker { margin-left: auto; position: relative; z-index: 1; }
.date-picker label { font-weight: 500; }
.date-picker input {
  padding: 8px 14px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.2);
  color: white;
  font-size: 14px;
  font-family: 'Fredoka', sans-serif;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.date-picker input::-webkit-calendar-picker-indicator { filter: invert(1); }

.main-layout {
  display: flex;
  gap: 24px;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.map-container {
  flex: 1;
  position: relative;
  min-width: 0;
}

#beachMap {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,0,0,0.3), 0 0 0 3px rgba(255,255,255,0.1);
  cursor: default;
}

/* Lounger hover glow */
.lounger-group { cursor: pointer; transition: filter 0.15s; }
.lounger-group:hover { filter: brightness(1.2) drop-shadow(0 0 8px rgba(255,255,255,0.6)); }
.lounger-group text { pointer-events: none; }

/* Animated waves */
@keyframes waveMove {
  0% { transform: translateX(0); }
  100% { transform: translateX(-60px); }
}
.wave-anim { animation: waveMove 3s linear infinite; }

@keyframes waveMove2 {
  0% { transform: translateX(0); }
  100% { transform: translateX(-60px); }
}
.wave-anim2 { animation: waveMove2 4s linear infinite; }

/* Sun rays */
@keyframes sunPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}
.sun-ray { animation: sunPulse 3s ease-in-out infinite; }

@keyframes sunSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Individual frond sway — each rotates around its own base */
@keyframes frondSway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}
.frond { animation: frondSway 3.5s ease-in-out infinite; }

/* Side panel */
.side-panel {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15), 0 0 0 1px rgba(255,255,255,0.2);
}

.panel h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--sand);
  color: var(--ocean-deep);
}

.hidden { display: none !important; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.field input, .field select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e7e5e4;
  border-radius: 12px;
  font-size: 14px;
  font-family: 'Fredoka', sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
}
.field input:focus, .field select:focus {
  border-color: var(--ocean);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.15);
}

.time-row { display: flex; gap: 12px; }
.time-row .field { flex: 1; }

.price-display {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 2px solid #86efac;
  border-radius: 12px;
  padding: 14px;
  margin: 14px 0;
  font-size: 14px;
}
.price-display .total {
  font-size: 26px;
  font-weight: 700;
  color: var(--green);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.05);
}
.price-display .discount {
  color: var(--sunset-orange);
  font-weight: 600;
}

.btn {
  display: block;
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  font-family: 'Fredoka', sans-serif;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  margin-top: 8px;
  letter-spacing: 0.3px;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, #fb923c, #f472b6);
  color: white;
  box-shadow: 0 4px 16px rgba(244,114,182,0.35);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.1);
}
.btn-primary:hover { box-shadow: 0 6px 24px rgba(244,114,182,0.45); transform: translateY(-1px); }
.btn-secondary {
  background: linear-gradient(135deg, var(--sand-light), #fde68a);
  color: var(--sand-dark);
  box-shadow: 0 2px 8px rgba(251,191,36,0.2);
}
.btn-ghost {
  background: none;
  color: var(--muted);
  font-weight: 500;
  margin-top: 12px;
}
.btn-ghost:hover { color: var(--ocean-deep); }

.tariff-card {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border-radius: 12px;
  padding: 14px;
  border: 2px solid #fde68a;
}
.tariff-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 4px;
  border-bottom: 1px dashed rgba(0,0,0,0.08);
  font-size: 15px;
}
.tariff-row:last-child { border: none; }
.tariff-row strong { color: var(--ocean-deep); }

.info-note {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  font-weight: 500;
}

.time-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 10px 0;
}
.time-slot {
  width: 36px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}
.time-slot.free { background: linear-gradient(135deg, #22c55e, #16a34a); }
.time-slot.booked { background: linear-gradient(135deg, #ef4444, #dc2626); }

.tooltip {
  position: absolute;
  background: rgba(12, 74, 110, 0.95);
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  pointer-events: none;
  z-index: 100;
  line-height: 1.6;
  max-width: 280px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.15);
}

.profile-card {
  background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  border: 2px solid #bbf7d0;
}
.profile-card .label { font-size: 12px; color: var(--muted); font-weight: 500; }
.profile-card .value { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--ocean-deep); }

.profile-actions { display: flex; gap: 8px; }
.profile-actions .btn { flex: 1; }

#selectedLoungerInfo {
  background: linear-gradient(135deg, var(--sand-light), #fde68a);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-weight: 600;
  color: var(--sand-dark);
  border: 2px solid #fbbf24;
  text-align: center;
  font-size: 16px;
}

/* Admin page */
.admin-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.admin-table th, .admin-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e7e5e4;
  font-size: 14px;
}
.admin-table th {
  background: linear-gradient(135deg, rgba(251,146,60,0.1), rgba(244,114,182,0.1));
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ocean-deep);
}
.admin-table tr:hover td { background: rgba(14,165,233,0.04); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}
.badge-confirmed { background: #dbeafe; color: #1e40af; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-paid { background: #d1fae5; color: #065f46; }
.badge-unpaid { background: #fef3c7; color: #92400e; }

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.admin-header h2 { color: white; text-shadow: 1px 1px 0 rgba(0,0,0,0.2); }
.admin-filters { display: flex; gap: 12px; align-items: center; }
.admin-filters select, .admin-filters input {
  padding: 8px 14px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  font-size: 14px;
  font-family: 'Fredoka', sans-serif;
  background: rgba(255,255,255,0.9);
}

.stat-cards {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.stat-card {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  flex: 1;
  min-width: 150px;
}
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--ocean-deep); }
.stat-card .stat-label { font-size: 13px; color: var(--muted); font-weight: 500; }

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-family: 'Fredoka', sans-serif;
}
.btn-cancel { background: #fee2e2; color: #991b1b; }
.btn-cancel:hover { background: #fecaca; }

/* === MOBILE === */
@media (max-width: 900px) {
  header {
    padding: 12px 16px;
    gap: 8px;
  }
  header h1 { font-size: 20px; }
  .subtitle { display: none; }
  .date-picker { margin-left: auto; }
  .date-picker label { font-size: 13px; }
  .date-picker input { padding: 6px 10px; font-size: 13px; }

  .main-layout {
    flex-direction: column;
    padding: 12px;
    gap: 0;
  }

  /* Map: scrollable container, bigger SVG */
  .map-container {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px 8px;
  }
  #beachMap {
    width: 700px;
    min-width: 700px;
    height: auto;
    border-radius: 12px;
    touch-action: pan-x pan-y;
  }

  /* Hint to scroll */
  .map-container::after {
    content: '← листайте карту →';
    display: block;
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    padding: 6px 0 2px;
    font-family: 'Fredoka', sans-serif;
  }

  /* Side panel: bottom sheet */
  .side-panel {
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    max-height: 70vh;
    overflow-y: auto;
    padding: 0 12px 12px;
    gap: 0;
    transition: transform 0.3s ease;
    pointer-events: none;
  }
  .side-panel > .panel {
    pointer-events: auto;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.25);
    margin-top: 8px;
  }
  /* drag handle visual */
  .side-panel > .panel::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: #d6d3d1;
    border-radius: 2px;
    margin: 0 auto 12px;
  }
  /* Hide info panel on mobile — show only when booking/profile active */
  #infoPanel { display: none !important; }

  /* Tooltip: hide on mobile, use tap instead */
  .tooltip { display: none !important; }

  /* Lounger tap target bigger */
  .lounger-group { cursor: pointer; }
  .lounger-group:hover { filter: none; }

  .panel { padding: 18px 16px; }
  .panel h2 { font-size: 17px; margin-bottom: 12px; padding-bottom: 8px; }
  .field { margin-bottom: 10px; }
  .btn { padding: 12px; font-size: 14px; }
  .time-slot { width: 32px; height: 26px; font-size: 10px; }

  /* Footer smaller */
  footer { padding: 14px; }
}

@media (max-width: 480px) {
  #beachMap {
    width: 620px;
    min-width: 620px;
  }
  header { padding: 10px 12px; }
  header h1 { font-size: 18px; }
  .main-layout { padding: 8px; }
  .map-container { margin: 0 -8px; padding: 0 8px 6px; }
}
