/* Note Mapinamo — styles (mapinamo brand) */

:root {
  --c-magenta: #C939A3;
  --c-teal: #51A2B6;
  --c-purple: #8B5FA8;
  --c-text: #1a1a1a;
  --c-text-muted: #64748b;
  --c-glass: rgba(255, 255, 255, 0.95);
  --c-border: rgba(0, 0, 0, 0.12);
  --c-border-light: rgba(0, 0, 0, 0.08);
  --c-hover: rgba(0, 0, 0, 0.06);
  --grad-brand: linear-gradient(135deg, var(--c-magenta) 0%, var(--c-teal) 100%);
  --grad-rainbow: linear-gradient(90deg, var(--c-teal) 0%, var(--c-purple) 50%, var(--c-magenta) 100%);
  --bg: #ffffff;
  --bg-page: #eef2fb;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  --panel-width: 360px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: var(--c-text);
  background: var(--bg);
}

/* ============ LOGIN PAGE ============ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-page);
}

.login-container {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--c-glass);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.1);
  border: 1px solid var(--c-border-light);
  max-width: 400px;
  width: 90%;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 1.5rem;
}

.login-logo img {
  height: 32px;
  width: auto;
}

.login-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  color: var(--c-text-muted);
  margin-bottom: 2rem;
  line-height: 1.5;
}

#telegram-login {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.login-hint {
  font-size: 0.8rem;
  color: var(--c-text-muted);
}

/* ============ MAP PAGE ============ */

.map-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

#map {
  flex: 1;
  width: 100%;
}

/* Top bar — glassmorphism */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: var(--c-glass);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--c-border-light);
  z-index: 10;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.top-bar-logo {
  height: 28px;
  width: auto;
}

.top-bar-title {
  font-weight: 700;
  font-size: 1.1rem;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.top-bar-user {
  color: var(--c-text-muted);
  font-size: 0.85rem;
}

.top-bar-right {
  display: flex;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--c-text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  background: var(--c-hover);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--grad-brand);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(201, 57, 163, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 12px rgba(201, 57, 163, 0.35);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  color: var(--c-text-muted);
}

/* ============ TOGGLE SWITCH ============ */

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--c-border);
  border-radius: 11px;
  transition: background 0.3s ease;
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--grad-brand);
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(18px);
}

.toggle-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-text-muted);
  min-width: 44px;
}

.toggle-switch input:checked ~ .toggle-label {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============ FLOATING ADD BUTTON (FAB) ============ */

.fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--grad-brand);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(201, 57, 163, 0.4);
  z-index: 15;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(201, 57, 163, 0.5);
}

/* ============ CROSSHAIR (place mode) ============ */

.crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  z-index: 15;
  pointer-events: none;
}

.crosshair-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  animation: bounce 1s ease-in-out infinite;
}

.crosshair-actions {
  display: flex;
  gap: 0.5rem;
  pointer-events: auto;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ============ NOTE PANEL (sidebar) ============ */

.note-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--panel-width);
  height: 100%;
  background: var(--c-glass);
  backdrop-filter: blur(20px);
  box-shadow: -2px 0 20px rgba(0, 0, 0, 0.1);
  z-index: 20;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.note-panel.open {
  transform: translateX(0);
}

.note-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--c-border-light);
}

.note-panel-header h2 {
  font-size: 1.1rem;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Note form */
.note-form {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-textarea {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  background: rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--c-teal);
}

.form-input {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--c-teal);
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Photo previews */
.photo-preview,
.view-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preview-thumb,
.view-photo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--c-border-light);
  transition: transform 0.15s;
}

.view-photo:hover {
  opacity: 0.85;
}

/* Note view */
.note-view {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.view-text {
  white-space: pre-wrap;
  line-height: 1.5;
}

/* ============ MAP MARKERS ============ */

.map-marker {
  width: 24px;
  height: 24px;
  background: var(--c-teal);
  border: 3px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}

.map-marker:hover {
  transform: scale(1.25);
}

.map-marker.has-photos {
  background: var(--c-magenta);
}

/* ============ MODAL ============ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal {
  background: var(--c-glass);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 90%;
  max-width: 440px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--c-border-light);
}

.modal h3 {
  margin-bottom: 0.5rem;
}

.share-hint {
  font-size: 0.85rem;
  color: var(--c-text-muted);
  margin-bottom: 0.75rem;
}

.modal .form-input {
  margin-bottom: 1rem;
}

/* ============ LOADING ============ */

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--c-border);
  border-top-color: var(--c-magenta);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============ RESPONSIVE ============ */

@media (max-width: 600px) {
  .note-panel {
    width: 100%;
  }

  .top-bar {
    padding: 0.4rem 0.6rem;
  }

  .top-bar-title {
    font-size: 0.95rem;
  }
}
