/* =================================
   STILE AREA PERSONALE - EREMO
   ================================= */

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

/* --- Variabili Globali --- */
:root {
  --primary-color: #365e51;
  --secondary-color: #8db187;
  --accent-color: #d4a373;
  --bg-color: #f4f7f6;
  --card-bg-color: rgba(255, 255, 255, 0.6);
  --sidebar-bg-color: rgba(54, 94, 81, 0.7);
  --text-dark: #2c3e50;
  --text-light: #f0f0f0;
  --text-muted: #7f8c8d;
  --border-color: rgba(0, 0, 0, 0.08);
  --shadow-color: rgba(0, 0, 0, 0.1);
  --danger-color: #e74c3c;
  --success-color: #2ecc71;
  --font-family: 'Poppins', sans-serif;
  --border-radius: 12px;
  --transition-speed: 0.3s;
  --mobile-nav-height: 65px;
}

/* --- Reset e Stili Base --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-dark);
  overflow-x: hidden;
  background-image: url('https://www.transparenttextures.com/patterns/light-paper-fibers.png');
}

h1, h2, h3 {
  font-weight: 600;
  margin-bottom: 0.5em;
}

p {
  line-height: 1.6;
  margin-bottom: 1em;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}

a:hover {
  color: var(--accent-color);
}


/* --- Layout Principale a Griglia (Dashboard) --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ======================= 
   SIDEBAR 
   ======================= */
.sidebar {
  background-color: var(--sidebar-bg-color);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: fixed;
  height: 100%;
  width: 260px;
  transition: transform var(--transition-speed) ease;
  z-index: 1000;
}

.sidebar-header {
  margin-bottom: 2rem;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-light) !important;
}
.sidebar-logo {
  height: 40px;
  width: auto;
}
.sidebar-title {
  font-size: 1.5rem;
  font-weight: 600;
  opacity: 1;
  transition: opacity var(--transition-speed) ease;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: var(--border-radius);
  color: var(--text-light) !important;
  font-weight: 500;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}
.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
}
.nav-link.active {
  background-color: var(--accent-color);
  color: #fff !important;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.nav-icon {
  width: 20px;
  margin-right: 1rem;
  font-size: 1.1rem;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
}

.user-info-widget {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: rgba(0, 0, 0, 0.2);
  padding: 0.8rem;
  border-radius: var(--border-radius);
}
#sidebar-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-color);
}
.user-details {
  display: flex;
  flex-direction: column;
}
#sidebar-username {
  font-weight: 600;
}
.logout-link {
  font-size: 0.85rem;
  color: var(--text-muted) !important;
  opacity: 0.8;
}
.logout-link:hover {
  opacity: 1;
  color: var(--accent-color) !important;
}


/* ======================= 
   MAIN CONTENT 
   ======================= */
.main-content {
  padding: 2rem 3rem;
  grid-column: 2 / 3;
  overflow-y: auto;
  height: 100vh;
}

.main-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sidebar-toggle-btn {
    display: none; /* Hidden by default, shown on tablet */
    background: none;
    border: none;
    color: var(--text-dark);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color var(--transition-speed) ease;
}

.sidebar-toggle-btn:hover {
    background-color: rgba(0,0,0,0.05);
}

.main-header h1 {
  font-size: 2.2rem;
  color: var(--primary-color);
  margin-bottom: 0;
}
.main-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 0;
}

.dashboard-section {
  display: none;
  animation: fadeIn 0.5s ease-in-out;
}
.dashboard-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Stile Card Generico --- */
.card {
  background-color: var(--card-bg-color);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: 0 8px 32px 0 var(--shadow-color);
  margin-bottom: 2rem;
}
.card h2 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    display: inline-block;
    margin-bottom: 1.5rem;
}

/* --- Stile Form --- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.form-group {
  display: flex;
  flex-direction: column;
}
.form-group label {
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.9rem;
}
.form-control {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: rgba(255, 255, 255, 0.7);
  font-family: var(--font-family);
  font-size: 1rem;
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(54, 94, 81, 0.2);
}
.form-control:disabled {
    background-color: #e9ecef;
    opacity: 0.7;
}

/* --- Stile Bottoni --- */
.btn {
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-primary {
  background-color: var(--primary-color);
  color: white;
}
.btn-primary:hover {
  background-color: #2c4a40;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px var(--shadow-color);
}
.btn-danger {
  background-color: var(--danger-color);
  color: white;
}
.btn-danger:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px var(--shadow-color);
}
.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}
.btn-secondary:hover {
    background-color: var(--primary-color);
    color: white;
}
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Spaziatura Aggiuntiva per Bottoni in Form */
form > .btn {
  margin-top: 1.5rem;
}

/* --- Messaggi Form --- */
.form-message {
  margin-top: 1rem;
  padding: 0.8rem;
  border-radius: 8px;
  text-align: center;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: all var(--transition-speed) ease;
}
.form-message.visible {
  opacity: 1;
  max-height: 100px;
}
.form-message.success {
  background-color: rgba(46, 204, 113, 0.15);
  color: #155724;
}
.form-message.error {
  background-color: rgba(231, 76, 60, 0.15);
  color: #721c24;
}

/* ======================= 
   SEZIONE ICONA PROFILO
   ======================= */

.icon-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}
.icon-preview-container #main-avatar-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 4px 15px var(--shadow-color);
}
.icon-header-text {
    flex-grow: 1;
}
.icon-header-text h2 { margin: 0; }
.icon-header-text p { margin: 0; color: var(--text-muted); }

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.tab-link {
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    background: none;
    border: none;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    transition: all var(--transition-speed) ease;
}
.tab-link:hover {
    color: var(--primary-color);
}
.tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.5s; }
.tab-content h3 { color: var(--primary-color); margin-bottom: 1rem; }

.avatar-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 1rem;
}
.avatar-option {
  position: relative;
  cursor: pointer;
}
.avatar-option-image {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid transparent;
  transition: all var(--transition-speed) ease;
}
.avatar-option-image:hover {
  transform: scale(1.05);
}
.avatar-option-image.selected {
  border-color: var(--primary-color);
  box-shadow: 0 0 15px rgba(54, 94, 81, 0.5);
  transform: scale(1.1);
}
.delete-icon-btn {
    position: absolute; top: -5px; right: -5px;
    background-color: var(--danger-color); color: white;
    border: none; border-radius: 50%; width: 24px; height: 24px;
    font-size: 14px; line-height: 24px; text-align: center; cursor: pointer;
    opacity: 0; transition: all var(--transition-speed); z-index: 5;
}
.avatar-option:hover .delete-icon-btn { opacity: 1; }

/* AI Generator */
.ai-prompt-controls-container {
    display: flex; gap: 1rem; align-items: flex-start;
}
#ai-icon-prompt { flex-grow: 1; min-height: 80px; resize: vertical; }
.btn-ai-generate {
    background: linear-gradient(45deg, var(--accent-color), #e7c29a);
    color: var(--primary-color);
}
#ai-generated-icon-preview-container {
    margin-top: 0;
    padding: 0 1rem;
    background-color: rgba(0,0,0,0.02);
    border-radius: var(--border-radius);
    text-align: center;
    opacity: 0;
    transform: scale(0.95);
    transition: all var(--transition-speed) ease, max-height 0.4s ease, padding 0.4s ease, margin 0.4s ease;
    max-height: 0;
    overflow: hidden;
}
#ai-generated-icon-preview-container.visible {
    opacity: 1;
    transform: scale(1);
    max-height: 500px;
    padding: 1rem;
    margin-top: 1.5rem;
}
#ai-generated-icon-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0.5rem auto 1rem;
    border: 4px solid var(--border-color);
}
.ai-preview-actions { display: flex; justify-content: center; gap: 1rem; }
.btn-save { background-color: var(--success-color); color: white; }

/* ======================= 
   SEZIONE PRENOTAZIONI 
   ======================= */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 350px);
    gap: 1.5rem;
    justify-content: start;
}
.booking-card {
    display: flex;
    flex-direction: column;
}
.card-img-top {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}
.card-body {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.card-body h3 {
    margin-top: 0;
}
.card-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto; /* Spinge in basso */
    padding-top: 1rem;
}
.pill {
    background-color: rgba(0,0,0,0.05);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.pill.status-pill.confermata { background-color: rgba(46, 204, 113, 0.2); color: #155724; }
.pill.status-pill.concluso { background-color: rgba(127, 140, 141, 0.2); color: #34495e; }
.pill.status-pill.annullata { background-color: rgba(231, 76, 60, 0.2); color: #721c24; }
.pill.status-pill.in-coda { background-color: rgba(243, 156, 18, 0.2); color: #856404; }
.pill.status-pill.disponibile { background-color: rgba(46, 204, 113, 0.2); color: #155724; }
.pill.status-pill.non-disponibile { background-color: rgba(127, 140, 141, 0.2); color: #34495e; }


.participant-recap { margin: 1rem 0; }
.participant-recap ul { list-style: none; }
.participant-recap li { display: flex; justify-content: space-between; padding: 0.3rem 0; border-bottom: 1px dotted var(--border-color); }
.btn-remove-participant { background: none; border: none; cursor: pointer; color: var(--danger-color); font-size: 1.2rem; }

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
}
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-muted);
}
.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}
.empty-state a {
    margin-top: 1rem;
}


/* ======================= 
   SEZIONE ELIMINA ACCOUNT 
   ======================= */
.danger-zone {
    border-left: 5px solid var(--danger-color);
}
.danger-zone h2 {
    color: var(--danger-color);
}

/* ======================= 
   NAVIGAZIONE MOBILE
   ======================= */

.mobile-bottom-nav {
    display: none;
}


/* ======================= 
   ANIMAZIONI E UTILITY 
   ======================= */

/* Stile per vista ospite */
.guest-view .sidebar { display: none; }
.guest-view .dashboard-grid { grid-template-columns: 1fr; }
.guest-view .main-content {
    max-width: 800px;
    margin: 2rem auto;
}

/* AI Animation Overlay */
#ai-bubble-animation-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(54, 94, 81, 0.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  z-index: 10000; justify-content: center; align-items: center; overflow: hidden;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.3), inset 0 0 12px rgba(255, 255, 255, 0.2);
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  opacity: 0;
}
.bubble.fade-out {
  animation: bubbleFadeOut 0.5s ease-out forwards !important;
}

@keyframes floatToCenterAndFade {
  0% {
    opacity: 0;
    transform: translate(var(--startX), var(--startY)) scale(0.3);
  }
  25% {
    opacity: 0.9;
    transform: translate(calc(var(--startX) * 0.4), calc(var(--startY) * 0.4)) scale(0.7);
  }
  85% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(0, 0) scale(0.2);
  }
}

@keyframes bubbleFadeOut {
    to { opacity: 0; transform: scale(0.1); }
}

#ai-revealed-icon-container {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.3);
  width: 170px; height: 170px; opacity: 0;
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#ai-revealed-icon-container.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#revealed-ai-icon-img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 40px var(--accent-color), 0 0 80px white;
  border: 6px solid white;
}


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

/* Tablet View */
@media (max-width: 992px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .sidebar {
    transform: translateX(-100%);
    z-index: 1001; /* Sopra l'overlay se presente */
  }
  .sidebar.is-open {
      transform: translateX(0);
  }
  .main-content {
    padding: 1.5rem;
    grid-column: 1 / -1;
  }
  .sidebar-toggle-btn {
      display: block;
  }
}

/* Mobile View */
@media (max-width: 768px) {
    .sidebar {
        display: none; /* La sidebar scompare, rimpiazzata dalla nav inferiore */
    }
    .sidebar-toggle-btn {
        display: none; /* Anche il toggle scompare */
    }
    .main-content {
        /* Aggiungi padding in basso per non sovrapporre la nav mobile */
        padding-bottom: calc(var(--mobile-nav-height) + 1.5rem);
    }
    .card-grid {
        justify-content: center; /* Centra le card se c'è spazio */
    }

    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--mobile-nav-height);
        background-color: var(--card-bg-color);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 1px solid rgba(0,0,0,0.1);
        z-index: 1000;
        box-shadow: 0 -2px 15px var(--shadow-color);
    }
    .mobile-nav-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex-grow: 1;
        color: var(--text-muted) !important;
        font-size: 0.7rem;
        transition: color var(--transition-speed) ease;
    }
    .mobile-nav-link i {
        font-size: 1.4rem;
        margin-bottom: 4px;
    }
    .mobile-nav-link.active {
        color: var(--primary-color) !important;
        font-weight: 600;
    }
}

@media (max-width: 576px) {
    .main-content { padding: 1rem; padding-bottom: calc(var(--mobile-nav-height) + 1rem); }
    .main-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .main-header h1 { font-size: 1.8rem; }
    .form-grid { grid-template-columns: 1fr; }
    .icon-header { flex-direction: column; text-align: center; }
}

"