@import url('https://fonts.com/css2?family=Inter:wght@300..900&display=swap');

:root {
  /* New Color Palette based on your example */
  --main-dark: #003366; /* Dark Blue - Used for primary elements and dark backgrounds */
  --green: #20B2AA; /* Aqua Green - Usato per accenti e pulsanti */
  --accent-orange: #FFA000; /* Orange - Used for specific CTAs */
  --bg-alt: #F8F9FA; /* Light Gray - Used for alternate backgrounds */
  --white: #FFFFFF; /* White - Used for light backgrounds */
  --text-main: #343A40; /* Dark Gray - Used for main text */
  --text-muted: #6c757d; /* Bootstrap's default muted text */
  --sidebar-bg-color: #F0F4F7; /* A distinct background for the sidebar */
  --sidebar-border-color: #e0e6eb; /* A subtle border color for sidebar elements */
  --sidebar-active-bg: #E0EBF5; /* A light blue for active sidebar items */
  --sidebar-active-text: var(--main-dark); /* Dark text for active sidebar items */


  /* Global variables */
  --border-light: #dee2e6; /* Light border for elements */
  --shadow-light: rgba(0, 0, 0, 0.08); /* Light shadow */
  --shadow-medium: rgba(0, 0, 0, 0.15); /* Medium shadow for hover */
  --shadow-strong: rgba(0, 0, 0, 0.2); /* Stronger shadow for hero/prominent elements */

  /* Typography */
  --font-family-base: 'Inter', sans-serif;
  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  /* Default dynamic hero background, will be overridden by inline style */
  --hero-dynamic-bg: linear-gradient(rgba(0, 51, 102, 0.85), rgba(0, 51, 102, 0.85));
}

body {
  font-family: var(--font-family-base);
  color: var(--text-main);
  background-color: var(--white);
  line-height: 1.6;
  scroll-behavior: smooth;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-base);
  font-weight: var(--font-weight-bold);
  color: var(--main-dark); /* Headings use main-dark */
  line-height: 1.3;
  margin-bottom: 0.5em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }

p {
  font-weight: var(--font-weight-regular);
  color: var(--text-main);
  margin-bottom: 1rem;
}

a {
  color: var(--green); /* Links use accent green */
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: #1a8e88; /* Slightly darker green on hover */
}

/* Sticky Navbar */
.navbar {
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 1020;
  background-color: var(--main-dark); /* Navbar background matches example */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 1rem 0;
}

.navbar-brand, .navbar-nav .nav-link {
  color: var(--white) !important;
  font-weight: var(--font-weight-semibold);
}

.navbar-brand:hover, .navbar-nav .nav-link:hover {
  color: var(--green) !important;
}

.navbar-toggler {
  border-color: rgba(255, 255, 255, 0.2);
}
.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30' fill='rgba%28255, 255, 255, 0.8%29'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Dropdown Menu */
.dropdown-menu {
  background-color: var(--main-dark); /* Dropdown background matches navbar */
  border: none;
  box-shadow: 0 4px 10px var(--shadow-light);
  padding: 0.5rem 0;
}
.dropdown-menu .dropdown-item {
  color: var(--white);
  padding: 0.75rem 1.25rem;
  transition: background-color 0.3s ease, color 0.3s ease;
}
.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
  background-color: var(--green); /* Green on dropdown item hover */
  color: var(--white);
}

/* Nested Dropdown (Submenu) - for mobile/desktop */
.dropdown-submenu {
  position: relative;
}
.dropdown-submenu > .dropdown-menu {
  top: 0;
  left: 100%;
  margin-top: -6px;
  margin-left: -1px;
  border-radius: 0.3rem;
}

/* Hero Section (Call to Action) */
.hero { /* Using your original .hero class name, styling it like hero-section */
  /* Use the dynamic CSS variable for background image, with a fallback gradient */
  background: var(--hero-dynamic-bg, linear-gradient(rgba(0, 51, 102, 0.85), rgba(0, 51, 102, 0.85))) no-repeat center center / cover;
  color: var(--white);
  padding: clamp(60px, 20vh, 120px) 0;
  text-align: center;
  border-bottom-left-radius: 50px; /* Rounded corners from example */
  border-bottom-right-radius: 50px;
  margin-top: 0; /* Remove default margin-top if using as page hero */
  margin-bottom: 50px; /* Spacing below hero */
  box-shadow: 0 8px 25px var(--shadow-strong);
}

.hero.no-bg {
  background-size: auto;
}

.hero h2 { /* Targeting the h2 within .hero, which is dynamic from your FcmsTemplate */
  font-size: 3.5rem;
  font-weight: var(--font-weight-bold);
  margin-bottom: 20px;
  color: var(--white); /* Ensure white text on dark hero */
}

.hero p {
  font-size: 1.3rem;
  margin-bottom: 40px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  color: rgba(255, 255, 255, 0.9);
}

/* Buttons */
.btn-primary {
  background-color: var(--green); /* Primary button uses green */
  border-color: var(--green);
  font-weight: var(--font-weight-semibold);
  padding: 10px 25px; /* Adjust padding */
  border-radius: 50px; /* Fully rounded buttons */
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
  background-color: #1a8e88; /* Darker green on hover */
  border-color: #1a8e88;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* New accent button style */
.btn-accent {
  background-color: var(--accent-orange); /* Accent button uses orange */
  border-color: var(--accent-orange);
  color: var(--white);
  font-weight: var(--font-weight-bold);
  padding: 12px 30px;
  border-radius: 50px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.btn-accent:hover {
  background-color: #e68a00; /* Darker orange on hover */
  border-color: #e68a00;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* Section Bands (Alternating Backgrounds) */
/* Re-using .band from your framework, matching example's section styling */
.band {
  padding: 80px 0; /* Larger padding for sections */
  margin-bottom: 0;
}

.band:nth-of-type(odd) {
  background-color: var(--white);
}

.band:nth-of-type(even) {
  background-color: var(--bg-alt);
}

/* General H2 styling for sections (if not inside .hero) */
main h2 {
  font-size: 2.5rem;
  font-weight: var(--font-weight-bold);
  color: var(--main-dark);
  margin-bottom: 40px;
  text-align: center;
}

/* Card Tiles (your .tile class, styled like example's .card) */
.card.tile, .card { /* Apply to both .card.tile and generic .card if used for similar display */
  border: none;
  border-radius: 15px; /* Match example's card border-radius */
  box-shadow: 0 5px 20px var(--shadow-light);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 100%; /* Ensure uniform height for cards in a row */
  background-color: var(--white); /* Explicit white background */
}

.card.tile:hover, .card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px var(--shadow-medium);
}

.card-body {
  padding: 30px; /* Larger padding for card bodies */
}

.card-title {
  color: var(--main-dark); /* Card titles use main-dark */
  font-weight: var(--font-weight-semibold);
  margin-bottom: 15px;
}

.icon-box { /* For tiles with icons, matching example's icon-box */
  font-size: 3rem;
  color: var(--green); /* Icons use accent green */
  margin-bottom: 20px;
}

.card.tile .card-img-top { /* If tiles use images */
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}


/* Message Boxes (info, success, warning, danger) */
.alert {
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  font-weight: var(--font-weight-medium);
}

.alert-info {
  background-color: #e3f2fd; /* Light blue, similar to your previous light-blue */
  color: var(--main-dark);
  border-color: var(--main-dark);
}
.alert-success {
  background-color: #d4edda;
  color: #155724;
  border-color: #c3e6cb;
}
.alert-warning {
  background-color: #fff3cd;
  color: #856404;
  border-color: #ffeeba;
}
.alert-danger {
  background-color: #f8d7da;
  color: #721c24;
  border-color: #f5c6cb;
}

.alert .fa-solid {
  margin-right: 0.75rem;
}

/* Breadcrumbs */
.breadcrumb {
  padding: 0.75rem 0;
  margin-bottom: 1.5rem;
  background-color: transparent;
}

.breadcrumb-item {
  font-size: 0.95rem;
  font-weight: var(--font-weight-medium);
}

.breadcrumb-item a {
  color: var(--text-muted); /* Using text-muted for subtle links */
}

.breadcrumb-item.active {
  color: var(--main-dark); /* Active breadcrumb uses main-dark */
  font-weight: var(--font-weight-semibold);
}

/* Accordion Styles */
.accordion-item {
  border: none;
  margin-bottom: 10px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.accordion-header {
  margin-bottom: 0;
}

.accordion-button {
  background-color: var(--main-dark) !important;
  color: var(--white) !important;
  font-weight: var(--font-weight-semibold);
  padding: 1.25rem 1.5rem;
  border-radius: 10px !important;
  transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.accordion-button:not(.collapsed) {
  background-color: var(--green) !important;
  color: var(--white) !important; /* Ensure text is white for contrast */
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.125);
}

.accordion-button:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 0.25rem rgba(32, 178, 170, 0.25);
}

.accordion-button::after {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23FFFFFF'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e"); /* White arrow */
  transition: transform 0.2s ease-in-out;
}

.accordion-button:not(.collapsed)::after {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23FFFFFF'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e"); /* White arrow */
  transform: rotate(-180deg);
}

.accordion-body {
  background-color: var(--bg-alt);
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  padding: 1.5rem;
}

/* List Group Styles inside Accordion or generally */
.list-group {
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.list-group-item {
  padding: 1rem 1.5rem;
  border-color: var(--border-light);
  background-color: var(--white);
  color: var(--text-main);
  transition: background-color 0.2s ease, color 0.2s ease;

  display: flex;
  align-items: center;
  /* Adjustments for icon alignment */
  justify-content: space-between; /* Default for sibling icon */
}

/* Small card used to show purchased course information */
.purchase-info-card .list-group-item {
  border: none;
  padding: 0.5rem 1rem;
  justify-content: flex-start;
}

.purchase-info-card i {
  color: var(--green);
  margin-right: 0.5rem;
}

/* Specific styling for sidebar category items */
.sidebar-category-item {
  padding: 0.75rem 1.5rem; /* Adjust padding for better look in sidebar */
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.sidebar-category-item:hover {
  background-color: var(--sidebar-active-bg); /* Use the new light blue */
  transform: translateX(5px); /* Subtle slide effect on hover */
}

/* Active sidebar category item */
.sidebar-category-item.active, /* Add a class for the active state if PHP provides it */
.sidebar-category-item:has(a[aria-current="page"]) { /* More robust active state detection if the link itself is marked active */
  background-color: var(--sidebar-active-bg);
  color: var(--sidebar-active-text) !important;
  font-weight: var(--font-weight-semibold);
  border-left: 4px solid var(--green); /* Strong highlight on the left */
  padding-left: calc(1.5rem - 4px); /* Adjust padding to account for border */
}

.sidebar-category-item.active a,
.sidebar-category-item:has(a[aria-current="page"]) a {
  color: var(--sidebar-active-text) !important; /* Ensure link text is dark */
}

/* Icon within sidebar category item */
.sidebar-category-item .sidebar-icon {
  font-size: 1.1rem; /* Slightly larger icon */
  color: var(--main-dark); /* Darker icon color for visibility */
}

/* Text within sidebar category item */
.sidebar-category-item .sidebar-text {
  flex-grow: 1; /* Allow text to take up available space */
  color: var(--text-main); /* Default text color */
}

/* Adjustments for icon placement within the anchor if PHP *can* put it inside */
.list-group-item a .fa-solid {
  margin-left: 0;
  margin-right: 0.75rem;
  order: -1;
}
/* If the icon is outside the <a> (as in your example): */
.list-group-item .fa-solid:not(.sidebar-icon) { /* Apply only to non-sidebar icons in list groups for general use */
  margin-left: auto;
  flex-shrink: 0;
  order: 1;
}

/* Footer styles */
footer {
  background-color: var(--main-dark);
  color: var(--white);
  padding: 50px 0;
  text-align: center;
  border-top-left-radius: 50px;
  border-top-right-radius: 50px;
  margin-top: 50px;
  font-size: 0.9rem;
}

footer a {
  color: var(--green);
  text-decoration: none;
  transition: color 0.3s ease;
}

footer a:hover {
  color: var(--white);
}

footer .social-icons a {
  font-size: 1.8rem;
  margin: 0 10px;
  color: var(--white);
  transition: color 0.3s ease;
}

footer .social-icons a:hover {
  color: var(--green);
}

/* Responsive adjustments */
@media (max-width: 991.98px) { /* Tablet and Mobile */
  .navbar-dark .navbar-nav {
    margin-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 0.5rem;
  }
  .navbar-dark .navbar-nav .nav-link {
    padding-left: 0;
  }

  .dropdown-submenu > .dropdown-menu {
    position: static;
    left: auto;
    margin-left: 0;
    margin-top: 0;
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
  }

  .dropdown-submenu.show > .dropdown-menu {
    display: block;
  }

  .hero {
    padding: 60px 1rem;
    margin-bottom: 30px;
  }

  .hero h2 {
    font-size: 2.5rem;
  }

  .hero p {
    font-size: 1.1rem;
  }

  .band {
    padding: 50px 1rem;
  }

  .card.tile {
    margin-bottom: 1.5rem;
  }

  .accordion-button {
    padding: 1rem 1.25rem;
  }

  main h2 {
    font-size: 2rem;
    margin-bottom: 30px;
  }
}

@media (max-width: 767.98px) { /* Mobile only */
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.5rem; }

  .hero {
    padding: 40px 1rem;
  }
}