/* ==========================================
   RESET & CORE
   ========================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0a0c;
  --surface: #111114;
  --border: rgba(255, 255, 255, 0.07);
  --text: #e8e8f0;
  --muted: #6b6b80;
  --accent: #7c6af7;
  --accent2: #3de8c8;
  --red: #f75a5a;
  --green: #3de87a;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  min-height: 100vh;
  overflow-x: hidden;
  cursor: none;
}

/* === BACKGROUNDS === */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(124, 106, 247, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 106, 247, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.12;
}
.blob-1 { width: 600px; height: 600px; background: var(--accent); top: -10%; right: -10%; }
.blob-2 { width: 400px; height: 400px; background: var(--accent2); bottom: -10%; left: -10%; }

/* ==========================================
   NAVBAR
   ========================================== */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 12, 0.7);
}

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.8rem 2rem;
  display: flex;
  align-items: center;
}

.nav-spacer-left { flex: 1.5; }
.nav-spacer-right { flex: 1; }

.nav-logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.04em;
  color: var(--text);
  text-decoration: none;
}
.nav-logo span { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 0.5rem; margin: 0 1.5rem; }
.nav-icon-link {
  display: flex; align-items: center; justify-content: center;
  width: 2.2rem; height: 2.2rem; border-radius: 8px;
  color: var(--muted); transition: all 0.2s;
}
.nav-icon-link:hover { color: var(--accent2); background: rgba(255,255,255,0.06); }

/* ==========================================
   DASHBOARD MAIN
   ========================================== */
.dashboard {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 2rem;
  position: relative;
  z-index: 10;
}

.dashboard-header {
  width: 90%;
  max-width: 650px;
  text-align: center;
  margin-bottom: 2rem;
  transition: all 0.3s ease;
  min-height: 280px; /* Ger plats åt klocka + väder så inget hoppar */
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* Håller sökfältet stabilt i botten av headern */
  padding-bottom: 1rem;
}

.clock-container {
  margin-bottom: auto; /* Trycker upp klockan en bit */
  padding-top: 1rem;
}

.time-display {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 6rem;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 0.5rem;
}
.date-display { font-size: 1.1rem; color: var(--muted); margin-bottom: 1.5rem; }

/* === WEATHER === */
.weather-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 2rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  animation: fadeIn 1s ease;
}
#weather-temp { font-family: 'Syne', sans-serif; font-weight: 700; color: var(--text); font-size: 1.1rem; }
#weather-icon { font-size: 1.2rem; }

/* === SEARCH BAR === */
.search-container { width: 100%; position: relative; }
.search-mode-switch { display: flex; justify-content: center; gap: 0.5rem; margin-bottom: 1.5rem; }

.mode-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.4rem 1.2rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.mode-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.search-box {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.5rem;
  gap: 0.5rem;
  transition: all 0.3s ease;
}
.search-box:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.search-box:focus-within { border-color: var(--accent); background: rgba(255, 255, 255, 0.05); }

.search-engine-toggle { display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.8rem; background: rgba(255, 255, 255, 0.05); border-radius: 10px; font-size: 0.8rem; font-weight: 600; cursor: pointer; position: relative; }
.engine-dropdown {
  position: absolute; top: 110%; left: 0; width: 160px; background: rgba(20, 20, 25, 0.8); backdrop-filter: blur(20px); border: 1px solid var(--border); border-radius: 12px; padding: 0.5rem; display: none; flex-direction: column; gap: 0.2rem; z-index: 1000; box-shadow: 0 15px 45px rgba(0, 0, 0, 0.5);
}
.engine-dropdown.active { display: flex; }
.engine-option { padding: 0.6rem 1rem; border-radius: 8px; font-size: 0.85rem; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 0.75rem; }
.engine-option:hover { background: rgba(255, 255, 255, 0.05); color: var(--accent2); }
.engine-option.active { background: var(--accent); color: #fff; }

#search-input { flex: 1; background: transparent; border: none; color: var(--text); padding: 0.6rem; font-family: inherit; font-size: 1.1rem; outline: none; }
.search-arrow { width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; background: var(--accent); border: none; border-radius: 10px; color: #fff; cursor: pointer; }

/* ==========================================
   PINS & SIDEBARS
   ========================================== */
.pins-container {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 1400px;
  padding: 0 4rem;
  position: absolute;
  top: 15%;
  height: 70vh;
  pointer-events: none;
}

.pins-left {
  pointer-events: auto;
  width: 240px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.pins-sort-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.sort-mode-switch {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 20px;
  padding: 2px;
  border: 1px solid var(--border);
}

.sort-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.25rem 0.6rem;
  border-radius: 18px;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.sort-btn.active {
  background: var(--accent);
  color: #fff;
}

.pins-list-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  /* Vi lägger masken på wrappern istället för den scrollbara listan */
  mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 15%, black 85%, transparent);
}

.pins-list-inner {
  height: 100%;
  overflow-y: auto;
  padding: 1.5rem 0.5rem; /* Mer padding för att länkarna inte ska maskas direkt */
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.pins-list-inner::-webkit-scrollbar { display: none; }

.pins-right {
  pointer-events: auto;
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 3rem;
  padding: 1rem 0;
}

.pin-group { width: 100%; }
.group-label {
  font-size: 0.8rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 1.5rem;
}

.pin-grid-vertical { display: flex; flex-direction: column; gap: 0.75rem; }

.pin-tile {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.6rem 1rem; background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px; text-decoration: none; color: var(--text);
  font-size: 0.8rem; transition: all 0.2s; position: relative;
  width: 100%;
}
.pin-tile:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.1); transform: translateY(-2px); box-shadow: 0 10px 20px rgba(0,0,0,0.4); }
.pin-tile img { width: 18px; height: 18px; border-radius: 4px; object-fit: contain; }
.pin-svg-icon { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; }
.pin-svg-icon svg { width: 100%; height: 100%; object-fit: contain; }

.pin-tile.priority { 
  background: rgba(255, 255, 255, 0.06); 
  border-color: rgba(255, 255, 255, 0.1);
  font-weight: 600;
  color: var(--text);
}
.pin-tile.priority::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%; width: 3px; background: var(--accent); border-radius: 0 4px 4px 0;
}

/* ==========================================
   ADMIN PANELS (MODALS)
   ========================================== */
#admin-panel, #admin-profile-panel, #admin-login-panel, #admin-reorder-panel, #admin-confirm-panel {
  display: none !important; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--surface); border: 1px solid var(--border); padding: 2.5rem; border-radius: 16px;
  z-index: 2000; width: 90%; max-width: 420px; flex-direction: column; gap: 1.2rem; box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}
#admin-panel.active, #admin-profile-panel.active, #admin-login-panel.active, #admin-reorder-panel.active, #admin-confirm-panel.active { display: flex !important; }

.admin-overlay { display: none !important; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(8px); z-index: 1999; }
.admin-overlay.active { display: block !important; }

input, select, textarea { width: 100%; background: rgba(255,255,255,0.03); border: 1px solid var(--border); color: var(--text); padding: 0.8rem; border-radius: 8px; font-family: inherit; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); }

.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.4rem; border-radius: 8px; font-family: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all 0.2s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-outline { background: rgba(255,255,255,0.03); border-color: var(--border); color: var(--muted); }

#google-signin-btn:hover { background: #f0f0f0 !important; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }

.btn-add-global {
  display: none; width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 50%;
  background: var(--accent); color: #fff; border: none; cursor: pointer; font-size: 1.2rem; transition: all 0.2s;
}
.btn-add-global:hover { transform: scale(1.1) rotate(90deg); box-shadow: 0 0 15px var(--accent); }
.is-admin .btn-add-global { display: flex; }

/* Management Helpers */
.pin-actions { position: absolute; top: 50%; right: 0.5rem; transform: translateY(-50%); display: flex; gap: 0.25rem; opacity: 0; transition: opacity 0.2s; }
.pin-tile:hover .pin-actions { opacity: 1; }
.btn-pin-edit { background: rgba(0,0,0,0.5); border: none; color: #fff; width: 26px; height: 26px; border-radius: 6px; cursor: pointer; }
.btn-pin-delete { background: rgba(247, 90, 90, 0.2); border: 1px solid rgba(247, 90, 90, 0.4); color: var(--red); width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font-size: 1rem; line-height: 1; transition: all 0.2s; }
.btn-pin-delete:hover { background: var(--red); color: #fff; }

.quick-tools { display: flex; justify-content: center; gap: 0.5rem; margin-top: 1.5rem; flex-wrap: wrap; }
.tool-btn { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); color: var(--muted); padding: 0.4rem 1rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 0.4rem; text-decoration: none; }
.tool-btn img, .tool-btn .pin-svg-icon { width: 14px; height: 14px; border-radius: 2px; }
.tool-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); border-color: var(--accent); }
.tool-btn.edit-only { border-style: dashed; opacity: 0.6; }

.category-reorder-item { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: 10px; }

/* Custom Checks */
.custom-check-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0;
}
.custom-check-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text);
  cursor: pointer;
  padding: 0.5rem;
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.2s;
}
.custom-check-label:hover {
  background: rgba(255,255,255,0.05);
}
.custom-check-label input {
  width: auto;
}

/* ==========================================
   ALERTS
   ========================================== */
.alert-container { position: fixed; top: 2rem; right: 2rem; z-index: 10000; display: flex; flex-direction: column; gap: 0.8rem; pointer-events: none; }
.custom-alert {
  background: rgba(20, 20, 25, 0.9); backdrop-filter: blur(12px); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  color: var(--text); padding: 1rem 1.5rem; border-radius: 12px; transform: translateX(120%); transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28); pointer-events: all;
  display: flex; align-items: center; gap: 1rem; min-width: 300px;
}
.custom-alert.active { transform: translateX(0); }
.custom-alert.error { border-left-color: var(--red); }
.custom-alert.success { border-left-color: var(--green); }

/* ==========================================
   CURSOR
   ========================================== */
.cursor { position: fixed; width: 10px; height: 10px; background: var(--accent); border-radius: 50%; pointer-events: none; z-index: 9999; transform: translate(-50%, -50%); mix-blend-mode: screen; }
.cursor-ring { position: fixed; width: 36px; height: 36px; border: 1px solid rgba(124, 106, 247, 0.4); border-radius: 50%; pointer-events: none; z-index: 9998; transform: translate(-50%, -50%); transition: all 0.1s ease; }

footer { display: none !important; }

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

/* Gör headern fluid så den kan krympa */
.dashboard-header {
  width: 90%;
  max-width: 650px;
  text-align: center;
  margin-bottom: 2rem;
  transition: all 0.3s ease;
  min-height: 280px; /* Ger plats åt klocka + väder så inget hoppar */
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* Håller sökfältet stabilt i botten av headern */
  padding-bottom: 1rem;
}

.clock-container {
  margin-bottom: auto; /* Trycker upp klockan en bit */
  padding-top: 1rem;
}

/* När skärmen blir för smal för att ha listorna på sidorna */
@media (max-width: 1250px) {
  .dashboard {
    justify-content: flex-start;
    padding-top: 10rem;
    padding-bottom: 5rem;
  }

  .pins-container {
    position: relative; /* Flytta ner från absolut position */
    top: 0;
    height: auto;
    pointer-events: auto;
    flex-direction: row;
    justify-content: center;
    gap: 3rem;
    padding: 2rem;
    margin-top: 3rem;
    max-width: 1000px;
  }

  .pins-left, .pins-right {
    width: 100%;
    max-width: 320px;
    height: auto;
  }

  .pins-list-wrapper {
    height: 500px; /* Behåll höjden för scroll-fade */
  }
}

/* Mobil: Staxka kolumnerna vertikalt */
@media (max-width: 768px) {
  .pins-container {
    flex-direction: column-reverse; /* Vänder ordningen så att Right (Priority/Tools) hamnar överst */
    align-items: center;
    gap: 4rem;
  }

  .pins-left, .pins-right {
    max-width: 100%;
    width: 100%;
    height: auto;
  }
  
  .pins-right {
    gap: 2rem; /* Något tätare mellan Priority och Tools på mobilen */
  }

  .time-display { font-size: 4.5rem; }
  .dashboard-header { margin-bottom: 1rem; }
  
  .nav-inner { padding: 0.8rem 1rem; }
  .nav-logo { font-size: 1.1rem; }
}

