@import "tailwindcss";

/* 🍋 SYCYLIJSKI ZESTAW STYLÓW PREMIUM (Tailwind v4 CLI) */

@theme {
  /* OKLCH Premium Colors */
  --color-brand: oklch(0.85 0.18 96);        /* Słoneczna, soczysta cytryna */
  --color-brand-hover: oklch(0.82 0.22 93);
  --color-sea: oklch(0.55 0.14 220);         /* Szmaragdowo-turkusowe Morze Jońskie */
  --color-sea-dark: oklch(0.35 0.12 230);    /* Głęboki błękit morski */
  --color-volcano: oklch(0.20 0.03 240);     /* Wulkaniczna czerń bazaltowa z Katanii */
  --color-sand: oklch(0.92 0.04 85);         /* Ciepły piasek z San Vito Lo Capo */
  --color-terracotta: oklch(0.65 0.16 45);   /* Tradycyjna, ciepła sycylijska glina */
  
  /* Specyficzne dla Glassmorphism */
  --color-glass-bg-dark: rgba(18, 19, 24, 0.75);
  --color-glass-bg-light: rgba(255, 255, 255, 0.06);
  --color-glass-border-dark: rgba(255, 255, 255, 0.08);
  --color-glass-border-light: rgba(0, 0, 0, 0.05);
}

:root {
  /* Czcionka premium systemowa */
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
  
  /* Zmienne CSS do szybkiego użycia */
  --glass-blur: blur(20px);
  --transition-smooth: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* 🌓 NATIVE DARK & LIGHT MODE SYSTEM (OKLCH based) */
@media (prefers-color-scheme: dark) {
  body {
    background-color: oklch(0.12 0.02 240);
    color: oklch(0.95 0.01 240);
  }
  .glass-card {
    background: var(--color-glass-bg-light);
    border: 1px solid var(--color-glass-border-dark);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
  }
}

@media (prefers-color-scheme: light) {
  body {
    background-color: oklch(0.96 0.01 85);
    color: oklch(0.15 0.02 240);
  }
  .glass-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.06);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
  }
  
  /* Nadpisywanie kolorów tła w trybie jasnym dla lepszego UX */
  .bg-volcano {
    background-color: oklch(0.93 0.02 85) !important;
  }
  .text-sand {
    color: oklch(0.20 0.03 240) !important;
  }
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 🍷 GLASSMORPHISM UTILITIES */
.glass-panel {
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.glass-nav {
  background: rgba(18, 19, 24, 0.88);
  border-top: 1px solid var(--color-glass-border-dark);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  padding: 0.375rem 0.25rem calc(0.375rem + env(safe-area-inset-bottom));
}

/* 🖥️ DESKTOP AMBIENT WRAPPER */
@media (min-width: 768px) {
  .desktop-bg {
    background:
      radial-gradient(ellipse 60% 40% at 20% 50%, oklch(0.55 0.14 220 / 0.15) 0%, transparent 60%),
      radial-gradient(ellipse 50% 60% at 80% 50%, oklch(0.85 0.18 96 / 0.08) 0%, transparent 60%),
      oklch(0.10 0.03 240);
  }

  .app-phone-frame {
    border-radius: 2.5rem;
    box-shadow:
      0 60px 120px rgba(0, 0, 0, 0.7),
      0 0 0 1px rgba(255, 255, 255, 0.10),
      inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    overflow: hidden;
    position: relative;
  }

  .app-phone-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 5px;
    background: rgba(255,255,255,0.12);
    border-radius: 0 0 6px 6px;
    z-index: 100;
  }
}

/* 🏝️ HERO BANNER ANIMACJA */
@keyframes gradient-drift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-banner {
  background: linear-gradient(135deg, oklch(0.65 0.16 45), oklch(0.45 0.12 240), oklch(0.7 0.15 30), oklch(0.55 0.14 220), oklch(0.85 0.18 96));
  background-size: 300% 300%;
  animation: gradient-drift 10s ease infinite;
}

/* 🃏 ANIMACJA KASKADOWA KART */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.day-card {
  animation: fade-in-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: var(--delay, 0ms);
}

.day-card .card-image {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.day-card:hover .card-image {
  transform: scale(1.06);
}

/* 📊 PROGRESS BAR */
.progress-bar-track {
  width: 100%;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 99px;
  height: 4px;
  overflow: hidden;
}

.progress-bar-inner {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(to right, oklch(0.85 0.18 96), oklch(0.55 0.14 220));
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 🌀 VIEW TRANSITIONS API KEY ANIMATIONS */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Morphing dedykowany dla aktywnych kart dni */
.selected-day-card {
  view-transition-name: active-day-view;
}

/* 📖 NATYWNY AKORDEON <details> I <summary> */
details {
  transition: var(--transition-smooth);
}

details summary {
  list-style: none;
  cursor: pointer;
  outline: none;
}

details summary::-webkit-details-marker {
  display: none;
}

/* Płynny obrót ikony strzałki w akordeonie */
details[open] summary svg {
  transform: rotate(180deg);
}

details[open] {
  animation: sweep 0.3s ease-in-out;
}

@keyframes sweep {
  0% {
    opacity: 0;
    transform: translateY(-8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 🌅 DYNAMICZNE GRAFIKI I GRADIENTY */
.dynamic-bg-gradient {
  background-image: var(--bg-gradient);
}

.day-map-bg {
  background-image: var(--bg-image);
}

/* 🚗 TIMELINE & ESTETYKA OSI CZASU */
.timeline-line::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, oklch(0.85 0.18 96) 0%, oklch(0.55 0.14 220) 100%);
  opacity: 0.3;
}

/* Świecąca kropka dla zaliczonej stacji */
.timeline-dot-active {
  background: oklch(0.85 0.18 96) !important;
  box-shadow: 0 0 10px oklch(0.85 0.18 96 / 0.6);
}

/* ⚡ CUSTOM SCROLLBARS FOR MOBILE FEEL */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: oklch(0.85 0.18 96);
}

/* 📱 OPTYMALIZACJE DLA EKRANÓW RETINA I DOTYKOWYCH */
/* 📱 OPTYMALIZACJE DLA EKRANÓW RETINA I DOTYKOWYCH */
@media (max-width: 640px) {
  .safe-padding-bottom {
    padding-bottom: calc(4.5rem + env(safe-area-inset-bottom));
  }

  /* Zmniejszenie marginesów i dopełnień dla widoków głównych */
  main {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    padding-top: 0.75rem !important;
  }

  .app-view {
    gap: 0.75rem !important;
  }

  .glass-card {
    padding: 0.75rem !important;
  }

  /* Skondensowanie głównego nagłówka */
  header {
    padding: 0.65rem 0.85rem !important;
  }
  header h1 {
    font-size: 0.8rem !important;
  }
  header p {
    font-size: 0.55rem !important;
  }

  /* Karty dni - zmniejszenie wysokości obrazka i paddingu */
  .day-card .dynamic-bg-gradient {
    height: 7.5rem !important; /* Zmniejszone z h-48 (12rem) na h-30 (7.5rem) */
  }
  .day-card img {
    height: 7.5rem !important;
  }
  .day-card .p-4 {
    padding: 0.65rem 0.75rem !important;
    gap: 0.5rem !important;
  }
  .day-card .pt-2 {
    padding-top: 0.4rem !important;
  }
  .day-card h3 {
    font-size: 0.95rem !important;
    line-height: 1.2 !important;
  }

  /* Skondensowanie osi czasu stacji */
  .timeline-card {
    margin-bottom: 0.5rem !important;
  }
  
  /* Kontenery stacji */
  .timeline-card > div {
    border-radius: 0.75rem !important;
  }

  /* Lewy panel stacji (Godzina / Checkbox) */
  .timeline-card .bg-black\/30 {
    padding: 0.5rem 0.75rem !important;
    min-width: unset !important;
    width: 100% !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-right: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  }
  
  .timeline-card .bg-black\/30 .flex-col {
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }
  
  .timeline-card .bg-black\/30 .text-lg {
    font-size: 0.95rem !important;
    line-height: 1 !important;
  }
  
  .timeline-card .bg-black\/30 .text-\[9px\] {
    font-size: 0.55rem !important;
  }

  /* Prawy panel stacji (Treść stacji) */
  .timeline-card .flex-1 {
    padding: 0.75rem !important;
    gap: 0.5rem !important;
  }
  
  .timeline-card h4 {
    font-size: 0.8rem !important;
    line-height: 1.25 !important;
  }
  
  .timeline-card p {
    font-size: 0.65rem !important; /* Lepszy, bardziej skondensowany rozmiar */
    line-height: 1.4 !important;
  }

  /* Tabela podziału ról (Sebastian / Ania) */
  .timeline-card .grid-cols-1 {
    border-radius: 0.5rem !important;
  }
  
  .timeline-card .grid-cols-1 > div {
    padding: 0.5rem !important;
    gap: 0.25rem !important;
  }
  
  .timeline-card .grid-cols-1 span {
    font-size: 0.625rem !important; /* text-xxs */
    line-height: 1.35 !important;
  }

  /* Przyciski i szuflady */
  .timeline-card .btn-toggle-notes,
  .timeline-card .btn-toggle-photo,
  .photo-drawer label {
    padding: 0.35rem 0.65rem !important;
    font-size: 0.6rem !important;
  }

  .notes-drawer textarea {
    height: 3.5rem !important; /* Skrócone z h-20 (5rem) do h-14 (3.5rem) */
    padding: 0.5rem !important;
    font-size: 0.65rem !important;
  }

  /* Wykres donut i budżet w zakładce Kasa */
  #expense-analytics-card {
    padding: 0.85rem !important;
  }
  
  #expense-analytics-card .flex-col {
    gap: 0.75rem !important;
  }
  
  #expense-balance-card {
    padding: 0.85rem !important;
    gap: 0.5rem !important;
  }

  /* Mapa dynamiczna */
  #day-map-interactive, #day-map-placeholder {
    min-height: 180px !important; /* Obniżona wysokość mapy z 250px do 180px, by zajmować mniej ekranu w pionie */
  }

  /* Leaflet specyficzne poprawki */
  .leaflet-popup-content-wrapper {
    border-radius: 0.75rem !important;
    padding: 0.25rem !important;
  }
  .leaflet-popup-content {
    margin: 6px 8px !important;
  }

  /* Polaroid wspomnień w galerii */
  .polaroid-frame {
    padding: 0.5rem 0.5rem 1.5rem 0.5rem !important;
  }
  .polaroid-caption {
    font-size: 0.55rem !important;
    margin-top: 0.5rem !important;
  }
}

/* 🚫 RESPECT REDUCED MOTION PREFERENCES */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
  
  *, ::before, ::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
}

/* 📸 STYL RAMEK POLAROIDOWYCH (Photo Journal) */
.polaroid-frame {
  background: white;
  padding: 0.75rem 0.75rem 2.25rem 0.75rem;
  border-radius: 0.25rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  transform: rotate(-1.5deg);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.polaroid-frame:hover {
  transform: rotate(1deg) scale(1.02);
  box-shadow: 0 20px 35px -5px rgba(0, 0, 0, 0.5), 0 12px 15px -8px rgba(0, 0, 0, 0.5);
}

.polaroid-frame img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.polaroid-caption {
  font-family: 'Outfit', sans-serif;
  color: #121318;
  font-size: 0.65rem;
  font-weight: 600;
  text-align: center;
  margin-top: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* 📊 DONUT CHART INTERACTIVE HOVER TRANSITIONS */
#donut-segments-group circle {
  transition: stroke-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), stroke-dashoffset 0.5s ease-out, opacity 0.3s ease;
}

#donut-segments-group circle:hover {
  stroke-width: 5;
  opacity: 0.95;
  cursor: pointer;
}

/* 🔊 SPEECH SYNTHESIS PULSING WAVE ANIMATION */
@keyframes audio-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(254, 240, 138, 0.5);
    transform: scale(1);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(254, 240, 138, 0);
    transform: scale(1.03);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(254, 240, 138, 0);
    transform: scale(1);
  }
}

.audio-pulse-active {
  animation: audio-pulse 1.5s infinite ease-in-out;
  border-color: oklch(0.85 0.18 96) !important;
  background: rgba(254, 240, 138, 0.1) !important;
}

