/* Stile per nascondere le sezioni non attive */
.view {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

/* Stile per mostrare la sezione attiva */
.view.active {
    display: block;
    opacity: 1;
}

/* Stili aggiuntivi per migliorare l'aspetto */
body {
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.body-has-background {
    background-image: var(--gallery-background);
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
}



/* Force dark text and no shadow for inventory detail header */
.inventory-detail-header-text {
    text-shadow: none; /* White glow for readability */
    color: #ffffff !important;
}

/* Styles for Stat Rows on Character Detail Page */
.stat-row {
    background-color: #f1f3f5; /* A light grey */
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    border: 1px solid #dee2e6;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

.stat-row span {
    color: #495057; /* Slightly muted color for the stat name */
}

.stat-row strong {
    color: #212529; /* Dark color for the stat value */
}

/* Dark Mode styles for stat rows */
body.dark-mode .stat-row {
    background-color: #343a40; /* A dark grey */
    border-color: #495057;
}

body.dark-mode .stat-row span {
    color: #adb5bd; /* Lighter muted color */
}

body.dark-mode .stat-row strong {
    color: #f8f9fa; /* White color for the stat value */
}

/* Styles for Equipment Cards (Weapon/Artifacts) on Character Detail Page */
.equip-item-card {
    background-color: #f1f3f5; /* Light grey */
    border: 1px solid #dee2e6;
    color: #212529; /* Dark text */
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}
.equip-item-card .text-muted {
    color: #6c757d !important;
}

body.dark-mode .equip-item-card {
    background-color: #343a40; /* Dark grey */
    border-color: #495057;
    color: #f8f9fa; /* Light text */
}
body.dark-mode .equip-item-card .text-muted {
    color: #adb5bd !important;
}

/* New class for theme-aware cards */
.card.theme-card-bg {
    background-color: var(--light-card-bg); /* Default to light card background */
    color: var(--light-color); /* Default to light text color */
    border-color: var(--light-card-border);
}

body.dark-mode .card.theme-card-bg {
    background-color: var(--dark-card-bg); /* Dark card background in dark mode */
    color: var(--dark-color); /* Dark text color in dark mode */
    border-color: var(--dark-card-border);
}

/* Remove backlight from inventory view titles */
body.body-has-background #inventory-view h1,
body.body-has-background #inventory-view h2 {
    text-shadow: none !important;
    color: inherit !important; /* Ensure text color adapts to theme */
}

/* Specific overrides to remove text shadow and ensure appropriate color */
body.body-has-background #gallery-settings-toggle-btn i,
body.body-has-background .custom-card h5,
body.body-has-background .custom-card span,
body.body-has-background #gallery-controls * {
    text-shadow: none !important;
    color: inherit !important; /* Revert to inherited color */
}

/* Ensure text in custom cards is readable */
body.body-has-background .custom-card h5,
body.body-has-background .custom-card span {
    color: #212529; /* Default text color for cards */
}

body.body-has-background.dark-mode .custom-card h5,
body.body-has-background.dark-mode .custom-card span {
    color: var(--dark-color); /* Dark mode text color for cards */
}

/* Specific overrides for elements that should not have text shadow/forced color */
body.body-has-background .navbar *,
body.body-has-background .site-footer * {
    color: #fff !important; /* Force white color for navbar text */
    text-shadow: none !important; /* Remove text shadow */
}

/* Text color and shadow for main content (excluding navbar, footer, and settings view) */
/* Text color and shadow for main content (excluding navbar, footer, and settings view) */
body.body-has-background main h1,
body.body-has-background main h2 {
    color: #212529; /* Default text color for light mode */
    text-shadow: 0 0 8px #fff, 0 0 10px #fff; /* Text glow */
}

body.body-has-background.dark-mode main h1,
body.body-has-background.dark-mode main h2 {
    color: #dee2e6; /* White text for dark mode */
}

body.body-has-background main h3,
body.body-has-background main h4,
body.body-has-background main h5,
body.body-has-background main h6,
body.body-has-background main p,
body.body-has-background main span,
body.body-has-background main a,
body.body-has-background main li,
body.body-has-background main label {
    text-shadow: none !important; /* Remove text glow from other elements */
    color: #212529; /* Default text color for light mode */
}

body.body-has-background.dark-mode main h3,
body.body-has-background.dark-mode main h4,
body.body-has-background.dark-mode main h5,
body.body-has-background.dark-mode main h6,
body.body-has-background.dark-mode main p,
body.body-has-background.dark-mode main span,
body.body-has-background.dark-mode main a,
body.body-has-background.dark-mode main li,
body.body-has-background.dark-mode main label {
    color: #dee2e6; /* White text for dark mode */
}

/* Specific overrides for dashboard title and comparison labels */
body.body-has-background #ticket-submission-view h2,
body.body-has-background #ticket-submission-view p,
body.body-has-background #ticket-submission-view label,
body.body-has-background #dashboard-title,
body.body-has-background #dashboard-view .form-label,
body.body-has-background #character-creation-view h2,
body.body-has-background #build-logger-view h2,
body.body-has-background #build-management-view h2,
body.body-has-background #character-creation-view p.text-muted,
body.body-has-background #character-creation-view label[for="character-library-select"],
body.body-has-background #character-creation-view label[for="name"],
body.body-has-background #character-creation-view label[for="splashart"],
body.body-has-background #character-creation-view label[for="acquisition_date"],
body.body-has-background #character-creation-view label[for="constellation"],
body.body-has-background #character-creation-view label[for="signature_weapon"],
body.body-has-background #character-creation-view label[for="talents"],
body.body-has-background #character-creation-view .row.align-items-center .col-md-4 > .form-label,
body.body-has-background #build-logger-view p.text-muted,
body.body-has-background #build-logger-view .form-label,
body.body-has-background #build-management-view p.text-muted,
body.body-has-background #build-management-view .form-label {
    color: #212529 !important; /* Black text */
    text-shadow: 0 0 8px #fff, 0 0 10px #fff !important; /* Text glow */
}

/* Remove text shadow from these elements when no background is active */
body:not(.body-has-background) #dashboard-title,
body:not(.body-has-background) #dashboard-view .form-label,
body:not(.body-has-background) #character-creation-view h2,
body:not(.body-has-background) #build-logger-view h2,
body:not(.body-has-background) #build-management-view h2 {
    text-shadow: none !important;
}

/* Ensure text color follows theme when no background is active */
body:not(.body-has-background).dark-mode #dashboard-title,
body:not(.body-has-background).dark-mode #dashboard-view .form-label,
body:not(.body-has-background).dark-mode #character-creation-view h2,
body:not(.body-has-background).dark-mode #build-logger-view h2,
body:not(.body-has-background).dark-mode #build-management-view h2 {
    color: var(--dark-color) !important;
}



body:not(.body-has-background):not(.dark-mode) #dashboard-title,
body:not(.body-has-background):not(.dark-mode) #dashboard-view .form-label,
body:not(.body-has-background):not(.dark-mode) #character-creation-view h2,
body:not(.body-has-background):not(.dark-mode) #build-logger-view h2,
body:not(.body-has-background):not(.dark-mode) #build-management-view h2 {
    color: var(--light-color) !important;
}

/* Small texts (p, label) in specific views: white with illumination in dark mode when background is active */
body.body-has-background.dark-mode #dashboard-view p,
body.body-has-background.dark-mode #dashboard-view label {
    color: #dee2e6 !important; /* White text */
    text-shadow: 0 0 8px #fff, 0 0 10px #fff; /* Text glow */
}

/* Character card constellation and acquisition date */
body.body-has-background .card-constellation,
body.body-has-background .card-acquisition-date {
    color: #fff !important; /* Always white text */
    text-shadow: none !important; /* No glow */
}

/* Character card hover stats */
body.body-has-background .card-hover-stats * {
    color: #fff !important; /* Always white text */
    text-shadow: none !important; /* No glow */
}

/* Remove text shadow from interactive elements in specific views */
body.body-has-background #character-creation-view .form-control,
body.body-has-background #character-creation-view .form-select,
body.body-has-background #character-creation-view .btn,
body.body-has-background #build-logger-view .form-control,
body.body-has-background #build-logger-view .form-select,
body.body-has-background #build-logger-view .btn,
body.body-has-background #build-management-view .form-control,
body.body-has-background #build-management-view .form-select,
body.body-has-background #build-management-view .btn,
body.body-has-background #dashboard-view .form-control,
body.body-has-background #dashboard-view .form-select,
body.body-has-background #dashboard-view .btn,
body.body-has-background #dashboard-view .table * {
    text-shadow: none !important;
}

/* Ensure text color adapts to theme for these elements */
body.body-has-background #character-creation-view .form-control,
body.body-has-background #character-creation-view .form-select,
body.body-has-background #build-logger-view .form-control,
body.body-has-background #build-logger-view .form-select,
body.body-has-background #build-management-view .form-control,
body.body-has-background #build-management-view .form-select,
body.body-has-background #dashboard-view .form-control,
body.body-has-background #dashboard-view .form-select {
    color: #212529; /* Default text color for light mode */
}

body.body-has-background.dark-mode #character-creation-view .form-control,
body.body-has-background.dark-mode #character-creation-view .form-select,
body.body-has-background.dark-mode #build-logger-view .form-control,
body.body-has-background.dark-mode #build-logger-view .form-select,
body.body-has-background.dark-mode #build-management-view .form-control,
body.body-has-background.dark-mode #build-management-view .form-select,
body.body-has-background.dark-mode #dashboard-view .form-control,
body.body-has-background.dark-mode #dashboard-view .form-select {
    color: #dee2e6; /* White text for dark mode */
}

/* Remove text shadow from statistics in dashboard comparison tables */
body.body-has-background #dashboard-view .card-body ul li,
body.body-has-background #dashboard-view .card-body ul li * {
    text-shadow: none !important;
}

/* Darker blue for specific headings when background is active */
body.body-has-background main h5:not(.card-title) {
    color: #003366 !important; /* Darker blue */
}

body.body-has-background.dark-mode main h5:not(.card-title) {
    color: #6ea8fe !important; /* Keep light blue for dark mode */
}

/* Ensure form controls remain readable */
body.body-has-background .form-control,
body.body-has-background .form-select {
    color: #212529; /* Default text color for form controls */
    text-shadow: none;
}

body.body-has-background.dark-mode .form-control,
body.body-has-background.dark-mode .form-select {
    color: var(--dark-color); /* Dark mode text color for form controls */
}

/* Settings view specific styling */
body.body-has-background #settings-view h2 {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    color: #212529 !important;
    text-shadow: 0 0 8px #fff, 0 0 10px #fff; /* Keep glow for title */
}

/* Style for the unified settings menu container */
body.body-has-background #settings-view #v-pills-tab {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 0.375rem;
    padding: 0.5rem;
}
body.body-has-background.dark-mode #settings-view #v-pills-tab {
    background-color: rgba(52, 58, 64, 0.9);
}

/* Reset individual link backgrounds */
body.body-has-background #settings-view .nav-pills .nav-link {
    background-color: transparent; /* No individual background */
    color: #212529;
    text-shadow: none;
    margin-bottom: 2px; /* Keep a small gap */
    border-radius: 0.25rem; /* Smaller radius for the hover effect */
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

body.body-has-background.dark-mode #settings-view .nav-pills .nav-link {
    background-color: transparent;
    color: #dee2e6;
}

/* Style for hover/active links */
body.body-has-background #settings-view .nav-pills .nav-link:hover,
body.body-has-background #settings-view .nav-pills .nav-link.active {
    background-color: rgba(200, 200, 200, 0.95); /* Lighter gray on hover/active */
}

body.body-has-background.dark-mode #settings-view .nav-pills .nav-link:hover,
body.body-has-background.dark-mode #settings-view .nav-pills .nav-link.active {
    background-color: rgba(45, 50, 55, 0.95); /* Darker on hover/active */
}

body.body-has-background #settings-view .tab-content {
    background-color: rgba(255, 255, 255, 0.9); /* Background for tab content */
    text-shadow: none; /* Remove text shadow */
    border-radius: 0.375rem;
    padding: 1rem;
}

body.body-has-background.dark-mode #settings-view .tab-content {
    background-color: rgba(52, 58, 64, 0.9); /* Dark background for tab content */
}

body.body-has-background.dark-mode #settings-view .tab-content {
    background-color: rgba(52, 58, 64, 0.9); /* Dark background for tab content */
}

body.body-has-background #gallery-view h2,
body.body-has-background #gallery-view .text-muted {
    color: #212529 !important; 
    text-shadow: 0 0 8px #fff, 0 0 10px #fff;
}

#gallery-view {
    flex-grow: 1; /* Aggiunto per farla espandere */
}

main {
    flex: 1;
}

/* Transizioni Sincronizzate per Cambio Tema */
body, .card, .list-group-item, .modal-content, .form-control, .form-select, #gallery-controls, .site-footer, .table {
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

#character-form h5 {
    margin-top: 1.5rem;
    color: #0056b3;
}

.text-orange {
    color: #fd7e14 !important;
}

.text-success {
    color: #28a745 !important; /* Original Bootstrap success green */
}

/* Override for lighter green */
.text-success.lighter {
    color: #2ecc71 !important; /* A lighter shade of green */
}

/* --- Dark Mode --- */
:root {
    --light-bg: #f8f9fa;
    --light-color: #212529;
    --light-card-bg: #fff;
    --light-card-border: rgba(0, 0, 0, 0.175);

    --dark-bg: #212529;
    --dark-color: #dee2e6;
    --dark-card-bg: #343a40;
    --dark-card-border: #495057;
    --dark-footer-bg: #1c1f23;
}

body.dark-mode {
    background-color: var(--dark-bg);
    color: var(--dark-color);
}

body.dark-mode .card {
    background-color: var(--dark-card-bg);
    border-color: var(--dark-card-border);
    color: var(--dark-color);
}

body.dark-mode .list-group-item {
    background-color: var(--dark-card-bg);
    border-color: var(--dark-card-border);
    color: var(--dark-color);
}

body.dark-mode .form-control, 
body.dark-mode .form-select {
    background-color: var(--dark-card-bg);
    color: var(--dark-color);
    border-color: var(--dark-card-border);
}

body.dark-mode .form-control::placeholder {
    color: #adb5bd; /* A lighter gray for dark mode placeholders */
    opacity: 1; /* Ensure it's not transparent */
}

body.dark-mode .form-control:focus, 
body.dark-mode .form-select:focus {
    background-color: var(--dark-card-bg);
    color: var(--dark-color);
    border-color: #86b7fe;
}

body.dark-mode #character-form h5 {
    color: #6ea8fe;
}

body.dark-mode .navbar-dark {
    background-color: #1c1f23!important;
}

body.dark-mode .footer {
    background-color: var(--dark-footer-bg);
}

/* Stili per il Modale in Dark Mode */
body.dark-mode .modal-content {
    background-color: var(--dark-card-bg);
    color: var(--dark-color);
    border-color: var(--dark-card-border);
}

body.dark-mode .modal-header,
body.dark-mode .modal-footer {
    background-color: var(--dark-card-bg);
    border-color: var(--dark-card-border);
}

body.dark-mode .modal-title {
    color: var(--dark-color);
}


body.dark-mode .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

body.body-has-background .btn-outline-secondary {
    background-color: rgba(255, 255, 255, 0.8); /* Semi-transparent white background */
    border-color: #6c757d; /* Keep original border color */
}

body.body-has-background.dark-mode .btn-outline-secondary {
    background-color: rgba(52, 58, 64, 0.8); /* Semi-transparent dark background */
    border-color: #adb5bd; /* Adjust border color for dark mode */
    color: #dee2e6; /* Adjust text color for dark mode */
}

/* User Dropdown Menu Styling */
body.body-has-background .dropdown-menu {
    background-color: #212529; /* Black background */
    border-color: #343a40;
}

body.body-has-background .dropdown-menu .dropdown-item {
    color: #fff; /* White text */
}

body.body-has-background .dropdown-menu .dropdown-item:hover,
body.body-has-background .dropdown-menu .dropdown-item:focus {
    background-color: #495057; /* Darker gray on hover */
    color: #fff; /* Ensure text remains white on hover */
}

body.body-has-background .dropdown-menu .dropdown-divider {
    border-top-color: #6c757d; /* Lighter divider in dark menu */
}

/* Stili per la galleria personaggi */


body:not(.dark-mode) #gallery-view #gallery-controls {
    background-color: #e9ecef;
}

.gallery-card {
    position: relative;
    overflow: hidden; /* Nasconde parti degli overlay che escono dalla card */
    border-radius: 0.375rem;
}

.gallery-card .card-body {
    min-height: 130px; /* Altezza minima per uniformare le card */
}

.card-constellation {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    z-index: 10;
}

.card-acquisition-date {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    z-index: 10;
}

.card-roles {
    padding: 5px 0;
}

.role-tag {
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 2px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-hover-stats {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 15px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 20;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: none; /* Aggiunto per far passare i click */
}

.gallery-card:hover .card-hover-stats {
    opacity: 1;
    visibility: visible;
}

.card-hover-stats h5 {
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    padding-bottom: 5px;
}

.card-hover-stats ul {
    padding-left: 0;
    width: 90%;
    font-size: 0.9rem;
}

.card-hover-stats ul li {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
}

.footer {
    flex-shrink: 0;
}

.build-separator {
    margin-top: 1.5rem !important;
    margin-bottom: 1.5rem !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

body.dark-mode .build-separator {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#build-list-container .list-group-item {
    margin-bottom: 10px;
    border-radius: .25rem;
}

/* Colori Rarità 5 Stelle */
.rarity-5-c0 { color: #ffc107 !important; } /* Giallo */
.rarity-5-c1 { color: #ffca2c !important; } /* Giallo Chiaro */
.rarity-5-c2 { color: #d4edda !important; } /* Verde Chiaro */
.rarity-5-c3 { color: #0dcaf0 !important; } /* Ciano */
.rarity-5-c4 { color: #d63384 !important; } /* Magenta */
.rarity-5-c5 { color: #6f42c1 !important; } /* Viola */
.rarity-5-c6 { color: #fff !important; text-shadow: 0 0 5px #000; } /* Bianco */

/* Styling for Gallery Controls */
#gallery-controls {
    background-color: #f8f9fa; /* A light gray for light mode */
    border-color: #dee2e6 !important; /* Bootstrap default border color */
    transition: background-color 0.3s, border-color 0.3s;
}

.dark-mode #gallery-controls {
    background-color: #343a40; /* A dark gray for dark mode */
    border-color: #495057 !important; /* A darker border for dark mode */
}

/* Ensure labels are visible in dark mode */
.dark-mode #gallery-controls .form-label,
.dark-mode #gallery-controls .form-check-label {
    color: #f8f9fa; /* Light text color for dark backgrounds */
}

/* Add space between gallery title and controls */
#gallery-view h2 {
    margin-bottom: 1.5rem; /* or 24px */
}

#nav-logout {
    color: #dc3545 !important; /* Bootstrap's danger red */
}

/* User Management - Dark Mode Search Input */
body.dark-mode #user-search {
    background-color: var(--dark-bg);
    color: var(--dark-color);
    border-color: var(--dark-card-border);
}

body.dark-mode #user-search::placeholder {
    color: #6c757d;
}

body.dark-mode #user-search:focus {
    background-color: var(--dark-bg);
    color: var(--dark-color);
    border-color: #86b7fe;
}
/* --- Stili per il Theme Toggle Switch --- */
.theme-switch-wrapper {
  display: flex;
  align-items: center;
}
.theme-switch {
  display: inline-block;
  height: 24px;
  position: relative;
  width: 50px;
}
.theme-switch input {
  display:none;
}

.slider {
  background-color: #ccc;
  bottom: 0;
  cursor: pointer;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  transition: .4s;
  border-radius: 34px;
}

.slider:before { /* Il pallino che scorre */
  background-color: #fff;
  content: "";
  height: 20px;
  width: 20px;
  position: absolute;
  transition: .4s;
  border-radius: 50%;
  /* Nuovo metodo di centraggio verticale e posizionamento */
  top: 50%;
  left: 2px;
  transform: translate(0, -50%);
  z-index: 2; /* Assicura che il pallino sia sopra le icone */
}

input:checked + .slider {
  background-color: #f8f9fa; /* Sfondo chiaro per lo switch in dark mode */
}

input:checked + .slider:before {
  /* Aggiorna la trasformazione per spostare il pallino */
  transform: translate(26px, -50%);
  background-color: #343a40; /* Pallino scuro per lo switch in dark mode */
}

/* Icone dentro l'interruttore */
.slider .icon-moon, .slider .icon-sun {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  transition: opacity 0.4s ease;
  z-index: 1; /* Le icone stanno sotto il pallino */
}
.slider .icon-moon {
  left: 5px;
  color: #212529;
  opacity: 1;
}
.slider .icon-sun {
  right: 5px;
  color: #fff;
  opacity: 0;
}
input:checked + .slider .icon-moon {
  opacity: 0;
}
input:checked + .slider .icon-sun {
  opacity: 1;
}

/* --- Stili per la Tabella in Dark/Light Mode --- */
body.dark-mode .table {
    --bs-table-bg: var(--dark-card-bg);
    --bs-table-border-color: var(--dark-card-border);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.05);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.075);
}
/* Imposta il colore del testo per tutte le celle della tabella in modalità notte */
body.dark-mode .table th,
body.dark-mode .table td {
    color: var(--dark-color);
}

/* --- Stili per la Pagina Modifica Profilo --- */
#profile-edit-view .avatar-label {
    font-size: 1.1rem;
    font-weight: 600;
    display: block;
    text-align: center;
    margin-bottom: 0.5rem;
}



  /* --- Stili per il Nuovo Footer --- */
  .site-footer {
    background-color: #2c3e50;
    color: #a9bacc;
    padding: 45px 0 20px;
    font-size: 15px;
    line-height: 24px;
  }
  .site-footer .footer-heading {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
  }
  .site-footer .footer-text {
    color: #a9bacc;
    margin-bottom: 0;
  }
  .site-footer .footer-list {
    padding-left: 0;
  }
  .site-footer .footer-list li {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
  }
  .site-footer .footer-list i {
    color: #0d6efd;
  }
  .site-footer a {
    color: #a9bacc;
    text-decoration: none;
  }
  .site-footer a:hover {
    color: #fff;
  }

  body.dark-mode .site-footer {
      background-color: var(--dark-footer-bg);
      color: #869ab8;
  }
  body.dark-mode .site-footer .footer-heading {
      color: #fff;
  }
  body.dark-mode .site-footer a {
      color: #869ab8;
  }
  body.dark-mode .site-footer a:hover {
      color: #fff;
  }

  /* Stili per il link "Torna su" */
  #back-to-top {
    display: block;
    text-align: center;
    margin-top: 15px; /* Aggiunge spazio sopra il link */
    border: none !important;
    background-color: transparent !important;
    padding: 0 !important;
    text-decoration: none; /* Rimuove la sottolineatura se presente */
  }

  #back-to-top:hover {
      text-decoration: underline !important; /* Aggiunge sottolineatura al passaggio del mouse */
  }

  /* Spaziatura per la galleria */
  #gallery-view {
      margin-bottom: 3rem; /* Aggiunge spazio sotto la galleria */
  }

  /* --- Stili Pagina Impostazioni -- */
  #settings-view .nav-pills .nav-link {
    color: #495057;
  }

  #settings-view .nav-pills .nav-link.active {
      color: #fff;
      background-color: #0d6efd;
  }

  #settings-view .tab-content {
      border-left: 1px solid #dee2e6;
      padding-left: 2rem;
  }

  .dark-mode #settings-view .nav-pills .nav-link {
      color: #dee2e6;
  }

  .dark-mode #settings-view .nav-pills .nav-link.active {
      color: #fff;
      background-color: #0d6efd;
  }

  .dark-mode #settings-view .tab-content {
      border-left: 1px solid #495057;
  }

  #settings-avatar-preview {
      width: 150px;
      height: 150px;
      object-fit: cover;
  }

/* New Gallery Card Styles */
.gallery-card-new {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    width: 300px; /* Larghezza per proporzioni quadrate */
    height: 350px; /* Altezza aumentata */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.gallery-card-new:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.gallery-card-new-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover; /* Usa cover per riempire lo spazio */
    background-repeat: no-repeat;
    background-position: center 30%;
    transition: transform 0.3s ease;
}

.gallery-card-new:hover .gallery-card-new-background {
    transform: scale(1.05);
}

/* --- Stili Dark Mode (Default) --- */
.gallery-card-new-overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.2) 40%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0.9) 100%);
}

.gallery-card-new-content {
    color: white;
}

.gallery-card-new-name {
    font-size: 1.8rem;
    font-weight: bold;
    text-shadow: 2px 2px 8px rgba(0,0,0,1); /* Ombra più forte per leggibilità */
}

.gallery-card-new-hover-overlay {
    background-color: rgba(0,0,0,0.85); /* Sfondo scuro per l'overlay hover */
    color: white;
}

/* --- Stili Light Mode --- */
body:not(.dark-mode) .gallery-card-new {
    background-color: #fff; /* Sfondo bianco per la card */
    border: 1px solid #e0e0e0; /* Bordo grigio chiaro */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

body:not(.dark-mode) .gallery-card-new:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

body:not(.dark-mode) .gallery-card-new-overlay {
    background: none; /* Rimuove il gradiente */
}

body:not(.dark-mode) .gallery-card-new-content {
    color: #1a1a1a; /* Testo scuro per leggibilità */
}

body:not(.dark-mode) .gallery-card-new-name {
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5); /* Ombra sottile per testo scuro in light mode */
}

body:not(.dark-mode) .gallery-card-new-rarity .bi-star-fill {
    color: #ffc107;
    text-shadow: none;
}

body:not(.dark-mode) .gallery-card-new-hover-overlay {
    background-color: rgba(255, 255, 255, 0.9); /* Sfondo bianco traslucido */
    color: #212529; /* Testo scuro */
    border-top: 4px solid var(--element-color, #ccc); /* Bordo superiore con colore elemento */
}

/* Stili Comuni */
.gallery-card-new-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.gallery-card-new-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    padding: 1rem;
    transition: opacity 0.3s ease;
}

.gallery-card-new:hover .gallery-card-new-content {
    opacity: 0; /* Nasconde il contenuto normale in hover */
}

.gallery-card-new-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.gallery-card-new-rarity .bi-star-fill {
    text-shadow: 0 0 5px rgba(0,0,0,0.8);
}

.gallery-card-new-element img {
    width: 40px; /* Icona elemento più grande */
    height: 40px;
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.8));
}

.gallery-card-new-body {
    text-align: center;
}

.gallery-card-new-roles .role-tag {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.gallery-card-new-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 500;
}

.gallery-card-new-hover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column; /* Imposta la direzione a colonna */
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none; /* Permette al click di passare alla card sottostante */
    padding: 15px;
    text-align: center;
}

.gallery-card-new:hover .gallery-card-new-hover-overlay {
    opacity: 1;
    pointer-events: auto; /* Riabilita gli eventi quando visibile */
}

.card-hover-info h5 {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
    border-bottom: 1px solid currentColor;
    padding-bottom: 5px;
}

.build-score {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.build-score-value {
    font-size: 1.5rem;
    font-weight: bold;
}

.build-stats-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
    width: 100%;
}

.build-stats-list li {
    display: flex;
    justify-content: space-between;
    padding: 2px 5px;
}

.build-stats-list li:nth-child(odd) {
    background-color: rgba(0,0,0,0.1);
}

body:not(.dark-mode) .build-stats-list li:nth-child(odd) {
    background-color: rgba(0,0,0,0.05);
}
/* Gallery Settings Panel */
#gallery-settings-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 300px;
    z-index: 1050;
    display: none; /* Hidden by default */
    background-color: rgba(255, 255, 255, 0.9); /* Semi-transparent white */
    border: 1px solid rgba(0, 0, 0, 0.175);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease-in-out;
}

body.dark-mode #gallery-settings-panel {
    background-color: rgba(52, 58, 64, 0.9); /* Semi-transparent dark */
    border-color: rgba(255, 255, 255, 0.175);
}

body.body-has-background.dark-mode #gallery-settings-panel p {
    color: #dee2e6 !important;
}

#gallery-settings-panel h5 {
    margin-bottom: 0.5rem;
}

#gallery-settings-panel hr {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

#gallery-background-selector-grid .background-item {
    width: 100%; /* Make items fill available width */
    height: 70px; /* Adjust height for smaller thumbnails */
}

#gallery-card-opacity-slider-container {
    margin-top: 1rem;
}

/* Stili per le sezioni del form di creazione personaggio */
.form-section-box {
    background-color: var(--light-card-bg);
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    border: 1px solid var(--light-card-border);
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

body.dark-mode .form-section-box {
    background-color: var(--dark-card-bg);
    border-color: var(--dark-card-border);
}

/* Unify switch animation speed to match theme toggle */
.form-switch .form-check-input {
    transition: background-position .4s ease-in-out !important;
}

/*
 * Fix per Stile Testo con Sfondo Attivo (Richiesta Utente)
 * Applica l'effetto luminoso e i colori corretti a specifici elementi
 * quando è impostato uno sfondo globale.
 */

/* [FIX] Vista CREA PERSONAGGIO */

/* Applica effetto luminoso a p e label in light mode (già presente in dark mode) */
body.body-has-background:not(.dark-mode) #character-creation-view .form-label,
body.body-has-background:not(.dark-mode) #character-creation-view p.text-muted {
    text-shadow: 0 0 8px #fff, 0 0 10px #fff;
}

/* Applica effetto luminoso e colore blu scuro ai titoli h5 */
body.body-has-background #character-creation-view hr + h5,
body.body-has-background #build-logger-view h5 {
    color: #0056b3 !important; /* Blu scuro richiesto */
    text-shadow: 0 0 8px #fff, 0 0 10px #fff !important;
}

body.body-has-background.dark-mode #dashboard-view .form-label {
    color: #212529 !important; /* Force black text on dashboard labels even in dark mode */
}

body.dark-mode #character-info-btn {
    background-color: #0a58ca;
    border-color: #0a58ca;
    color: white;
}

/* Stili per il Grimorio */
body.grimoire-background {
    background-image: var(--grimoire-background);
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
}

/* Modifiche richieste dall'utente per il Grimorio */

/* 1. Sfondo sezione filtri con opacità e senza bordo */
#grimoire-controls {
    background-color: rgba(248, 249, 250, 0.7); /* Sfondo chiaro con opacità 70% */
    border-radius: .375rem;
    padding: 1rem;
    border: none !important;
}

body.dark-mode #grimoire-controls {
    background-color: rgba(52, 58, 64, 0.7); /* Sfondo scuro con opacità 70% */
}

/* 2. Sfondo card con opacità */
.grimoire-card {
    position: relative;
    overflow: hidden;
    border-radius: 0.375rem;
    background-color: rgba(255, 255, 255, 0.5); /* Sfondo card chiaro con opacità 50% */
    transition: transform 0.2s ease-in-out;
}

body.dark-mode .grimoire-card {
    background-color: rgba(52, 58, 64, 0.5); /* Sfondo card scuro con opacità 50% */
}

/* 3. Stile del font per il nome del personaggio */
.grimoire-card-body h5 {
    color: var(--light-color);
}

body.dark-mode .grimoire-card-body h5 {
    color: var(--dark-color);
}

/* 4. Colore per l'icona del pulsante di aiuto */
#grimoire-view .help-btn i {
    color: #212529; /* Colore scuro per tema chiaro */
}

body.dark-mode #grimoire-view .help-btn i {
    color: #dee2e6; /* Colore chiaro per tema scuro */
}

.grimoire-card:hover {
    transform: translateY(-5px);
}

.grimoire-card-img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: filter 0.3s ease;
}

.grimoire-card-body {
    padding: 1rem;
}

.grimoire-card-element {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    z-index: 10;
}

.grimoire-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.grimoire-card:hover .grimoire-card-overlay {
    opacity: 1;
}

.grimoire-card:hover .grimoire-card-img {
    filter: brightness(0.5);
}

.grimoire-overlay-name {
    font-size: 1.5rem;
    font-weight: bold;
}

.grimoire-overlay-title {
    font-size: 1rem;
    font-style: italic;
}

/* Sfondo per le viste del grimorio */
#grimoire-view,
#character-detail-view {
    background-color: transparent;
}

/* Rimuove l'effetto di retroilluminazione dai titoli del grimorio */
#grimoire-view h2,
#character-detail-view h2 {
    text-shadow: none !important;
}

.grimoire-no-results {
    padding-top: 100px;
    padding-bottom: 100px;
    min-height: 300px;
}

.grimoire-no-results p {
    color: #000000;
}

body.dark-mode .grimoire-no-results p {
    color: #FFFFFF;
}

#settings-view .help-btn {
    display: none !important;
}

/* Fix title color on edit character page with background */
body.body-has-background #character-edit-view h2 {
    color: #000000 !important; /* Force black color */
    text-shadow: 0 0 6px #fff, 0 0 8px #fff; /* Enhance glow for readability */
}

/* Grimoire Icon View Specific Styles */
#grimoire-grid.grimoire-view-icon {
    /* Adjust grid for more columns */
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

.grimoire-view-icon .col {
    /* Override bootstrap column classes to create a more dense grid */
    flex: 0 0 auto;
    width: 12.5%; /* 8 columns */
}

@media (max-width: 1200px) {
    .grimoire-view-icon .col { width: 16.666%; } /* 6 columns */
}
@media (max-width: 992px) {
    .grimoire-view-icon .col { width: 20%; } /* 5 columns */
}
@media (max-width: 768px) {
    .grimoire-view-icon .col { width: 25%; } /* 4 columns */
}
@media (max-width: 576px) {
    .grimoire-view-icon .col { width: 33.333%; } /* 3 columns */
}


.grimoire-view-icon .grimoire-card {
    background-color: rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    border-radius: 0.375rem;
    aspect-ratio: 1 / 1; /* Make it a square */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

body.dark-mode .grimoire-view-icon .grimoire-card {
     background-color: rgba(255,255,255,0.05);
}

.grimoire-view-icon .grimoire-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Use cover to fill the square */
    border-radius: 0; /* Remove border-radius */
}

.grimoire-view-icon .grimoire-card:hover .grimoire-card-img {
    transform: none; /* Disable previous hover effect */
}

.grimoire-view-icon .grimoire-card-body {
    display: none; /* Hide the body, we will use the overlay */
}

.grimoire-view-icon .grimoire-card-element {
    width: 28px;
    height: 28px;
    top: 8px;
    right: 8px;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.7));
}

/* Show a simple overlay on hover */
.grimoire-view-icon .grimoire-card-overlay {
    display: flex;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    justify-content: flex-end;
    align-items: center;
    padding: 0.5rem;
}

.grimoire-view-icon .grimoire-card-overlay .grimoire-overlay-name {
    font-size: 1rem;
    font-weight: normal;
    text-align: center;
    line-height: 1.2;
}

.grimoire-view-icon .grimoire-card-overlay .grimoire-overlay-title {
    display: none; /* Hide title in this view */
}

.grimoire-view-icon .grimoire-card:hover .grimoire-card-overlay {
    opacity: 1;
}

.grimoire-view-icon .grimoire-card:hover .grimoire-card-img {
    filter: none; /* Disable previous filter */
}

.avatar-select-card {
    cursor: pointer;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.avatar-select-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.tooltip-keyword {
    border-bottom: 1px dotted;
}

.grimoire-content-wrapper {
    background-color: rgba(255, 255, 255, 0.8);
    padding: 1rem;
    border-radius: 0.5rem;
    border: none;
}

body.dark-mode .grimoire-content-wrapper {
    background-color: rgba(33, 37, 41, 0.8);
}

#grimoire-tabs .nav-link {
    color: #495057;
    font-weight: 500;
    border-bottom: 2px solid transparent;
}

body.dark-mode #grimoire-tabs .nav-link {
    color: #dee2e6;
}

#grimoire-tabs .nav-link.active {
    color: #0d6efd;
    background-color: transparent;
    border-color: #0d6efd;
}

body.dark-mode #grimoire-tabs .nav-link.active {
    color: #6ea8fe;
    border-bottom-color: #6ea8fe;
}

#grimoire-tabs.nav-tabs {
    border-bottom: 1px solid #dee2e6;
}

body.dark-mode #grimoire-tabs.nav-tabs {
    border-bottom: 1px solid #495057;
}

.nation-detail-content::after {
    content: "";
    display: table;
    clear: both;
}

/* Nation Card Styles */
.nation-card {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    border: none;
}

.nation-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
}

.nation-card .card-img-top {
    height: 250px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.nation-card:hover .card-img-top {
    transform: scale(1.05);
}

.nation-card .card-body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    padding: 1.5rem 1rem 1rem 1rem;
}

.nation-card .card-title {
    color: white;
    font-weight: bold;
    font-size: 1.25rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

/* Dark Mode for Nations Accordion */
body.dark-mode #nations-accordion-container .accordion-item {
    background-color: var(--dark-card-bg);
    border-color: var(--dark-card-border);
}

body.dark-mode #nations-accordion-container .accordion-header .accordion-button {
    background-color: var(--dark-card-bg);
    color: var(--dark-color);
}

body.dark-mode #nations-accordion-container .accordion-header .accordion-button::after {
    filter: invert(1) grayscale(100%) brightness(200%);
}

body.dark-mode #nations-accordion-container .accordion-body {
    background-color: var(--dark-bg);
    color: var(--dark-color);
}

/* Dark Mode for Keyword Tooltips Accordion */
body.dark-mode #keyword-tooltips-accordion .accordion-item {
    background-color: var(--dark-card-bg);
    border-color: var(--dark-card-border);
}

body.dark-mode #keyword-tooltips-accordion .accordion-header .accordion-button {
    background-color: var(--dark-card-bg);
    color: var(--dark-color);
}

body.dark-mode #keyword-tooltips-accordion .accordion-header .accordion-button::after {
    filter: invert(1) grayscale(100%) brightness(200%);
}

body.dark-mode #keyword-tooltips-accordion .accordion-body {
    background-color: var(--dark-bg);
    color: var(--dark-color);
}

/* Dark Mode for Keyword Tooltips Accordion */
body.dark-mode #keyword-tooltips-accordion .accordion-item {
    background-color: var(--dark-card-bg);
    border-color: var(--dark-card-border);
}

body.dark-mode #keyword-tooltips-accordion .accordion-header .accordion-button {
    background-color: var(--dark-card-bg);
    color: var(--dark-color);
}

body.dark-mode #keyword-tooltips-accordion .accordion-header .accordion-button::after {
    filter: invert(1) grayscale(100%) brightness(200%);
}

body.dark-mode #keyword-tooltips-accordion .accordion-body {
    background-color: var(--dark-bg);
    color: var(--dark-color);
}

/* Dark Mode for Keyword Tooltips Accordion */
body.dark-mode #keyword-tooltips-accordion .accordion-item {
    background-color: var(--dark-card-bg);
    border-color: var(--dark-card-border);
}

body.dark-mode #keyword-tooltips-accordion .accordion-header .accordion-button {
    background-color: var(--dark-card-bg);
    color: var(--dark-color);
}

body.dark-mode #keyword-tooltips-accordion .accordion-header .accordion-button::after {
    filter: invert(1) grayscale(100%) brightness(200%);
}

body.dark-mode #keyword-tooltips-accordion .accordion-body {
    background-color: var(--dark-bg);
    color: var(--dark-color);
}
#banner-splash-art {
    width: auto;
    height: 180%;
    right: -15%;
    bottom: -10%;
}
/* Stili per le card informative di Abisso/Teatro */
.info-card {
    margin-bottom: 1.5rem;
}
.info-card .card-header h3 {
    margin-bottom: 0;
}
