/* ==========================================================================
   RESET & VARIABILI DI BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
}

:root {
  --bg-color: #000000;
  --text-color: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.7);
  --glass-bg: rgba(30, 30, 30, 0.65);
  --glass-border: rgba(255, 255, 255, 0.15);
  --window-bg: rgba(32, 32, 32, 0.85);
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", sans-serif;
  --dock-size: 58px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: 13px;
  letter-spacing: -0.01em;
}

/* ==========================================================================
   BARRA DEI MENU DESKTOP (macOS)
   ========================================================================== */
.mac-menubar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 28px;
  background: rgba(20, 20, 20, 0.55);
  -webkit-backdrop-filter: blur(25px);
  backdrop-filter: blur(25px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.menubar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.apple-logo {
  font-size: 14px;
  cursor: default;
}

.app-name {
  font-weight: 700;
}

.menu-items {
  display: flex;
  gap: 14px;
  color: var(--text-muted);
}

.menu-items span {
  cursor: default;
  transition: color 0.15s ease;
}

.menu-items span:hover {
  color: var(--text-color);
}

.menubar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-icon {
  display: flex;
  align-items: center;
  cursor: default;
  color: var(--text-muted);
}

.status-datetime {
  font-size: 12px;
  font-weight: 500;
}

/* ==========================================================================
   WORKSPACE & MOBILE GRID
   ========================================================================== */
.workspace {
  position: relative;
  width: 100%;
  height: 100%;
  padding-top: 28px;
  padding-bottom: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* La griglia mobile è nascosta di default su Desktop */
.mobile-grid {
  display: none;
}

/* ==========================================================================
   DOCK DI SISTEMA
   ========================================================================== */
.dock-container {
  position: fixed;
  bottom: 12px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 900;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.dock {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 8px 14px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), inset 0 0.5px 1px rgba(255, 255, 255, 0.25);
}

.dock-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  width: var(--dock-size);
  height: var(--dock-size);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dock-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* Puntino indicatore app attiva */
.dock-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: #ffffff;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.dock-item.is-open .dock-dot {
  opacity: 1;
}

/* Tooltip al passaggio del mouse */
.dock-tooltip {
  position: absolute;
  top: -34px;
  background: rgba(18, 18, 18, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: all 0.15s ease-out;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.dock-item:hover .dock-tooltip {
  opacity: 1;
  transform: translateY(0);
}

/* Animazione rimbalzo avvio app */
@keyframes dockBounce {
  0%   { transform: translateY(0); }
  30%  { transform: translateY(-20px); }
  50%  { transform: translateY(0); }
  70%  { transform: translateY(-10px); }
  100% { transform: translateY(0); }
}

.dock-item.is-bouncing {
  animation: dockBounce 0.85s ease-out;
}

/* ==========================================================================
   FINESTRA APPLICAZIONE (Desktop)
   ========================================================================== */
.app-window {
  position: absolute;
  width: 860px;
  max-width: 92vw;
  height: 560px;
  max-height: 80vh;
  background: var(--window-bg);
  -webkit-backdrop-filter: blur(35px);
  backdrop-filter: blur(35px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.75), inset 0 0.5px 1px rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 500;
  animation: windowAppear 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes windowAppear {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.window-header {
  height: 40px;
  background: rgba(45, 45, 45, 0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.window-controls {
  display: flex;
  gap: 8px;
}

.win-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.close-btn { background-color: #ff5f56; }
.min-btn   { background-color: #ffbd2e; cursor: default; }
.max-btn   { background-color: #27c93f; cursor: default; }

.window-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-color);
  flex-grow: 1;
  text-align: center;
  margin-right: 44px;
}

.window-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: 24px;
  color: var(--text-color);
}

.mobile-home-bar {
  display: none;
}

/* ==========================================================================
   APP NOTE (CV & PRESENTAZIONE)
   ========================================================================== */
.notes-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 10px 10px 40px;
  line-height: 1.6;
}

.notes-date {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}

.notes-header {
  margin-bottom: 24px;
}

.notes-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.notes-location {
  font-size: 13px;
  color: #a1a1a6;
  display: flex;
  align-items: center;
  gap: 6px;
}

.notes-divider {
  border: none;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 20px 0;
}

.notes-section-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a1a1a6;
  margin: 24px 0 12px;
}

.notes-bio-text {
  font-size: 14px;
  color: #e5e5ea;
  margin-bottom: 14px;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.notes-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px 14px;
}

.notes-card-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  color: #ffffff;
}

.notes-card-desc {
  font-size: 12px;
  color: #a1a1a6;
}

.notes-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.notes-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #f2f2f7;
}

.notes-cta-wrap {
  margin-top: 32px;
  display: flex;
  justify-content: flex-start;
}

.notes-btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #0071e3;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.notes-btn-download:hover {
  background-color: #0077ed;
}

/* ==========================================================================
   APP ABLETON (BEAT SHOWCASE)
   ========================================================================== */
.ableton-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.ableton-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ableton-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ableton-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.ableton-table-wrap {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 60px;
  padding-right: 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.ableton-table-wrap::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.beats-table {
  width: 100%;
  border-collapse: collapse;
}

.beats-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.beats-table th:last-child,
.beats-table td:last-child {
  padding-right: 16px;
}

.beat-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease;
}

.beat-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.beat-row.is-playing {
  background: rgba(0, 113, 227, 0.15);
}

.beat-row td {
  padding: 10px 12px;
  font-size: 13px;
  vertical-align: middle;
}

.beat-play-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.beat-play-btn:hover {
  border-color: #fff;
  transform: scale(1.05);
}

.beat-meta-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #ddd;
}

.beat-download-btn {
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  transition: color 0.15s ease;
}

.beat-download-btn:hover {
  color: #fff;
}

/* ==========================================================================
   ABLETON TRANSPORT BAR (PLAYER INTERNO)
   ========================================================================== */
.ableton-transport-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(22, 22, 24, 0.95);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.atb-info {
  display: flex;
  flex-direction: column;
  min-width: 140px;
  max-width: 180px;
}

.atb-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.atb-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

.atb-controls {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.atb-play-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.2s ease;
}

.atb-play-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.atb-time {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.6);
  min-width: 30px;
  text-align: center;
}

.atb-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
  outline: none;
  cursor: pointer;
}

.atb-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff764d;
  box-shadow: 0 0 6px rgba(255, 118, 77, 0.6);
  cursor: pointer;
}

/* ==========================================================================
   APP FOTO (STUDIO GALLERY)
   ========================================================================== */
.photos-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 8px 8px 30px;
}

.photos-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.photos-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.photos-count {
  font-size: 12px;
  color: var(--text-muted);
}

.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.photo-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.photo-item:hover {
  transform: scale(1.02);
  border-color: rgba(255, 255, 255, 0.25);
}

.photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  padding: 24px;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 10px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  font-size: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   DESKTOP RULE: NASCONDI SLIDER IPHONE
   ========================================================================== */
@media (min-width: 769px) {
  .mobile-pages-wrapper {
    display: contents;
  }
  .mobile-page#page-2,
  .mobile-page#page-3,
  .mobile-page-indicator {
    display: none !important;
  }
}

/* ==========================================================================
   LAYOUT SMARTPHONE (iOS)
   ========================================================================== */
@media (max-width: 768px) {
  .mac-menubar {
    display: none;
  }

  .workspace {
    padding-top: 0;
    padding-bottom: 0;
    align-items: stretch;
  }

  /* Slider a pagine orizzontale */
  .mobile-pages-wrapper {
    display: flex !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory !important;
    -webkit-overflow-scrolling: touch;
    width: 100vw !important;
    height: 100vh !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  .mobile-pages-wrapper::-webkit-scrollbar {
    display: none !important;
  }

  .mobile-page {
    flex: 0 0 100vw !important;
    width: 100vw !important;
    min-width: 100vw !important;
    height: 100% !important;
    scroll-snap-align: start !important;
    padding: 60px 24px 140px !important;
    box-sizing: border-box !important;
  }

  /* Griglia icone iOS */
  .mobile-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px 16px;
    width: 100%;
  }

  .app-icon-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
  }

  .app-icon-img {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    object-fit: cover;
  }

  .app-label {
    font-size: 11px;
    color: #ffffff;
    margin-top: 6px;
    font-weight: 400;
  }

  /* Pallini di pagina iOS: posizionati sopra il Dock, invisibili di default */
  .mobile-page-indicator {
    position: fixed !important;
    bottom: 108px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px !important;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    z-index: 850 !important;
    pointer-events: none !important;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .mobile-page-indicator.is-visible {
    opacity: 1;
  }

  .mobile-page-indicator .dot {
    width: 6px !important;
    height: 6px !important;
    background: rgba(255, 255, 255, 0.35) !important;
    border-radius: 50% !important;
    transition: background 0.2s ease, transform 0.2s ease;
  }

  .mobile-page-indicator .dot.active {
    background: #ffffff !important;
    transform: scale(1.15) !important;
  }

  /* Dock in stile iOS */
  .dock-container {
    bottom: 20px;
    z-index: 900;
  }

  .dock {
    border-radius: 35px;
    padding: 12px 18px;
    gap: 20px;
  }

  .dock-item {
    width: 60px;
    height: 60px;
  }

  .desktop-only,
  .dock-tooltip,
  .dock-dot {
    display: none !important;
  }

  /* Quando una finestra è aperta, nascondi del tutto il Dock */
  body:has(#appWindow[style*="display: flex"]) .dock-container {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(40px) !important;
  }

  /* Finestra modale mobile curva che copre fino in fondo */
  #appWindow {
    position: fixed !important;
    top: 40px !important;
    left: 8px !important;
    right: 8px !important;
    bottom: 12px !important;
    width: auto !important;
    max-width: calc(100vw - 16px) !important;
    height: auto !important;
    max-height: none !important;
    border-radius: 24px !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    overflow: hidden !important;
    margin: 0 !important;
    transform: none !important;
    box-sizing: border-box !important;
    z-index: 9500 !important;
    padding-bottom: 0 !important;
  }

  /* Header finestra bloccato: altezza fissa, no schiacciamento */
  .window-header {
    height: 44px !important;
    min-height: 44px !important;
    flex-shrink: 0 !important;
    padding: 0 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
  }

  .window-controls,
  #winCloseBtn,
  .win-btn {
    display: none !important;
  }

  .window-title {
    margin: 0 !important;
    text-align: center !important;
    font-size: 15px !important;
  }

  .window-body {
    padding: 14px !important;
    overflow-y: auto !important;
    flex: 1 1 auto !important;
  }

  /* Home Bar in fondo bloccata e indeformabile */
  .mobile-home-bar {
    display: flex !important;
    justify-content: center;
    align-items: center;
    height: 26px;
    min-height: 26px;
    flex-shrink: 0 !important;
    width: 100%;
    cursor: pointer;
    touch-action: none;
    z-index: 99999 !important;
    background: transparent;
  }

  .home-indicator {
    width: 130px;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 100px;
  }

  /* Tabella Ableton responsive */
  .beats-table {
    width: 100% !important;
    table-layout: fixed !important;
    font-size: 12px !important;
  }

  .beats-table th, 
  .beats-table td {
    padding: 8px 4px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .beat-meta-tag {
    font-size: 10px !important;
    padding: 2px 4px !important;
  }

  .beats-table td:nth-child(2) {
    font-size: 12px !important;
    max-width: 110px !important;
  }

  /* Transport bar curva che si adatta allo schermo piccolo */
  .ableton-transport-bar {
    border-radius: 0 0 24px 24px !important;
    padding: 8px 12px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
  }

  .atb-info {
    min-width: 0 !important;
    flex: 1 1 100% !important;
  }

  .atb-title {
    font-size: 12px !important;
  }

  .atb-controls {
    width: 100% !important;
    gap: 6px !important;
  }

  /* ==========================================================================
     APP FOTO STILE iOS (GRIGLIA COMPATTA A 3 COLONNE)
     ========================================================================== */
  .photos-container {
    padding: 0 0 20px !important;
  }

  .photos-header {
    padding: 4px 6px 10px !important;
    margin-bottom: 8px !important;
  }

  .photos-title {
    font-size: 17px !important;
  }

  .photos-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 2px !important;
  }

  .photo-item {
    border-radius: 0 !important;
    border: none !important;
    aspect-ratio: 1 / 1 !important;
  }

  .photo-item:hover {
    transform: none !important;
  }

  .photo-img {
    border-radius: 0 !important;
  }
}