/* ==========================================================================
   ITERCARS ACADEMY - PRIVATE TRAINING & CERTIFICATION STYLES
   ========================================================================== */

.academy-section {
  padding: 120px 0 80px 0;
  min-height: calc(100vh - 200px);
  position: relative;
  z-index: 2;
}

/* ================= LOGIN VIEW ================= */
.academy-login-container {
  max-width: 500px;
  margin: 40px auto;
  padding: 40px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), var(--glow-emerald);
}

.academy-login-header {
  text-align: center;
  margin-bottom: 30px;
}

.academy-login-header i {
  font-size: 3.5rem;
  margin-bottom: 15px;
  display: inline-block;
}

.academy-login-header h2 {
  font-size: 2rem;
  margin-bottom: 10px;
}

.academy-login-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.login-form-group {
  margin-bottom: 22px;
}

.login-form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.login-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-wrapper i {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  font-size: 1.2rem;
  pointer-events: none;
}

.login-input-wrapper input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s ease;
}

.login-input-wrapper input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 15px rgba(0, 146, 70, 0.3);
}

.login-notice {
  margin-top: 24px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid var(--accent-primary);
  border-radius: 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ================= DASHBOARD VIEW ================= */
.academy-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 30px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 20px;
}

.academy-title-area h2 {
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.course-badge {
  padding: 4px 12px;
  background: rgba(0, 146, 70, 0.2);
  border: 1px solid rgba(0, 146, 70, 0.4);
  color: #2ecc71;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.academy-user-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-welcome-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  color: #fff;
}

.user-welcome-badge strong {
  color: var(--accent-primary);
}

/* Course Progress Bar */
.course-progress-container {
  margin-bottom: 30px;
  padding: 24px 30px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.progress-header span {
  font-weight: 600;
  font-size: 0.95rem;
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 10px rgba(0, 146, 70, 0.5);
}

/* ================= COURSE GRID (2 COLUMNS) ================= */
.course-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 30px;
  align-items: start;
}

@media (max-width: 1024px) {
  .course-grid {
    grid-template-columns: 1fr;
  }
  .playlist-column {
    order: 2;
  }
  .video-column {
    order: 1;
  }
}

/* LEFT COLUMN: PLAYLIST */
.playlist-column {
  padding: 24px;
  max-height: 820px;
  display: flex;
  flex-direction: column;
}

.playlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-glass);
}

.playlist-header h3 {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lessons-list {
  overflow-y: auto;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Custom Scrollbar for Playlist */
.lessons-list::-webkit-scrollbar {
  width: 6px;
}
.lessons-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}
.lessons-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.lessons-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

.lesson-card {
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.lesson-card:hover:not(.locked) {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(0, 146, 70, 0.4);
  transform: translateX(4px);
}

.lesson-card.active {
  background: rgba(0, 146, 70, 0.15);
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(0, 146, 70, 0.2);
}

.lesson-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(10, 14, 23, 0.6);
}

.lesson-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.lesson-card.active .lesson-number {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 146, 70, 0.5);
}

.lesson-card.completed .lesson-number {
  background: #2ecc71;
  color: #000;
}

.lesson-info {
  flex-grow: 1;
  min-width: 0;
}

.lesson-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lesson-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.lesson-status-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* RIGHT COLUMN: VIDEO PLAYER */
.video-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.video-player-container {
  width: 100%;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(0, 0, 0, 0.8);
  position: relative;
  aspect-ratio: 16 / 9;
}

.video-player-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lesson-details-card {
  padding: 30px;
}

.lesson-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.lesson-header-row h3 {
  font-size: 1.6rem;
  color: #fff;
  line-height: 1.3;
}

.lesson-status-tag {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tag-uncompleted {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.tag-completed {
  background: rgba(46, 204, 113, 0.15);
  border: 1px solid rgba(46, 204, 113, 0.4);
  color: #2ecc71;
}

.lesson-description {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-glass);
}

.lesson-action-area {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

/* TOAST / ALERT NOTIFICATION */
.academy-toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 16px 24px;
  background: rgba(10, 14, 23, 0.95);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), var(--glow-emerald);
  color: #fff;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.academy-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.academy-toast.error {
  border-color: #ef4444;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(239, 68, 68, 0.3);
}

.academy-toast i {
  font-size: 1.4rem;
}

/* ==========================================================================
   ACADEMY PRESENTATION & BROKERAGE INTRO SECTION
   ========================================================================== */
.presentation-hero-box {
  text-align: center;
  max-width: 900px;
  margin: 0 auto 60px auto;
}

.presentation-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: rgba(0, 146, 70, 0.15);
  border: 1px solid rgba(0, 146, 70, 0.35);
  border-radius: 99px;
  color: #2ecc71;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 24px;
}

.presentation-title {
  font-size: 3.2rem;
  line-height: 1.15;
  margin-bottom: 20px;
}

.presentation-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 36px;
}

/* STATS GRID */
.brokerage-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 70px;
}

@media (max-width: 1024px) {
  .brokerage-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .presentation-title {
    font-size: 2.4rem;
  }
}

@media (max-width: 640px) {
  .brokerage-stats-grid {
    grid-template-columns: 1fr;
  }
}

.broker-stat-card {
  padding: 30px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
}

.broker-stat-card:hover {
  transform: translateY(-5px);
  border-color: rgba(0, 146, 70, 0.4);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 146, 70, 0.15);
}

.stat-icon-wrapper {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(0, 146, 70, 0.15);
  color: #2ecc71;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 16px auto;
}

.stat-number {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
  font-family: var(--font-heading);
}

.stat-label {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* BENEFIT CARDS & INTRO GRID */
.brokerage-benefits-section {
  margin-bottom: 80px;
}

.brokerage-section-header {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 40px auto;
}

.brokerage-benefits-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
}

@media (max-width: 991px) {
  .brokerage-benefits-grid {
    grid-template-columns: 1fr;
  }
}

.benefit-card-broker {
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  transition: all 0.3s ease;
}

.benefit-card-broker:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent-primary);
  transform: translateY(-6px);
}

.benefit-icon-broker {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: var(--accent-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 8px 20px rgba(0, 146, 70, 0.3);
}

.benefit-card-broker h3 {
  font-size: 1.35rem;
  color: #fff;
}

.benefit-card-broker p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* GALLERY GRID: SHOWROOM, BROKER & CLIENTS IN OFFICE */
.brokerage-gallery-section {
  margin-bottom: 80px;
}

.broker-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 991px) {
  .broker-gallery-grid {
    grid-template-columns: 1fr;
  }
}

.gallery-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-lg);
  aspect-ratio: 4 / 3;
  group: true;
}

.gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-card:hover .gallery-img {
  transform: scale(1.08);
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10, 14, 23, 0.95) 0%, rgba(10, 14, 23, 0.4) 50%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  transition: all 0.3s ease;
}

.gallery-tag {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(0, 146, 70, 0.8);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
  width: fit-content;
}

.gallery-title {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.gallery-desc {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.88rem;
}

/* ==========================================================================
   ADVANCED LUXURY SCROLLBAR FOR MODAL FORM & DESKTOP ADAPTATION
   ========================================================================== */
#accessRequestModal .modal-content,
.modal-content {
  scrollbar-width: thin;
  scrollbar-color: #2ecc71 rgba(10, 14, 23, 0.8);
}

#accessRequestModal .modal-content::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
  width: 8px;
}

#accessRequestModal .modal-content::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track {
  background: rgba(10, 14, 23, 0.8);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin: 10px 0;
}

#accessRequestModal .modal-content::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #009246 0%, #2ecc71 50%, #009246 100%);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 12px rgba(46, 204, 113, 0.5);
  transition: all 0.3s ease;
}

#accessRequestModal .modal-content::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #2ecc71 0%, #009246 100%);
  box-shadow: 0 0 18px rgba(46, 204, 113, 0.8);
}

/* Desktop Adaptation & Responsive Form Grid */
@media (min-width: 768px) {
  #accessRequestModal .modal-content {
    max-width: 820px !important;
    padding: 36px 44px !important;
    max-height: 88vh !important;
  }
  #academyLoginModal .modal-content {
    max-width: 540px !important;
    padding: 40px !important;
    max-height: 90vh !important;
  }
  .desktop-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

/* Mobile Adaptation per Modali Academy & Chiedi Accesso */
@media (max-width: 767px) {
  /* Modale overlay su mobile con margine e scroll ottimizzato */
  #accessRequestModal,
  #academyLoginModal {
    padding: 12px !important;
    align-items: flex-start !important;
  }

  /* Box contenuto del modale adatta per smartphone */
  #accessRequestModal .modal-content,
  #academyLoginModal .modal-content {
    max-width: 100% !important;
    width: 100% !important;
    padding: 24px 18px !important;
    max-height: 88vh !important;
    border-radius: 14px !important;
    margin: auto 0 !important;
  }

  /* Titoli del form proporzionati per schermi piccoli */
  #accessRequestModal h3,
  #academyLoginModal h2 {
    font-size: 1.45rem !important;
    line-height: 1.3 !important;
  }

  /* Sottotitoli e descrizioni concise e leggibili */
  #accessRequestModal p,
  #academyLoginModal p {
    font-size: 0.88rem !important;
    line-height: 1.45 !important;
  }

  /* Trasforma le griglie a 2 colonne in 1 colonna verticale su smartphone */
  .desktop-grid-2 {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }

  /* Campi input ad alta leggibilità (16px per evitare zoom automatico su iOS Safari) */
  #accessRequestModal input,
  #accessRequestModal select,
  #accessRequestModal textarea,
  #academyLoginModal input {
    font-size: 16px !important;
    padding: 12px 14px !important;
    height: 48px !important;
  }

  /* Pulsante di chiusura (X) ben accessibile con il pollice */
  #accessRequestModal .close-modal,
  #academyLoginModal .close-modal {
    top: 14px !important;
    right: 14px !important;
    width: 38px !important;
    height: 38px !important;
    font-size: 1.3rem !important;
    background: rgba(255, 255, 255, 0.1) !important;
  }

  /* Pulsanti touch-friendly ampi e comodi */
  #accessRequestModal button[type="submit"],
  #academyLoginModal button[type="submit"] {
    height: 52px !important;
    font-size: 1rem !important;
    padding: 12px !important;
  }
}
