/* Custom styles for PhotoShare */

/* Smooth transitions */
.transition-all {
    transition: all 0.3s ease;
}

/* Custom button styles */
.btn-primary {
    @apply bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600 transition-all;
}

/* Card hover effects */
.card {
    @apply bg-white rounded-lg shadow-md p-6 transition-all;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

/* Custom form styles */
.form-input {
    @apply w-full px-4 py-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500;
}

/* Responsive grid for photos */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

/* Loading spinner */
.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #3b82f6;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Mobile optimizations */
@media (max-width: 640px) {
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* --- INIZIO DISATTIVAZIONE OVERRIDE SFONDI DARK --- */
/*
body.bg-gray-800 .form-dark-bg,
body.bg-gray-900 .form-dark-bg,
body.dark .form-dark-bg, body.dark-mode .form-dark-bg {
    background-color: #6B7280 !important;
    color: #f3f4f6 !important;
    border-color: #374151 !important;
}
body.bg-gray-800 .form-dark-bg::placeholder,
body.bg-gray-900 .form-dark-bg::placeholder,
body.dark .form-dark-bg::placeholder, body.dark-mode .form-dark-bg::placeholder {
    color: #a1a1aa !important;
    opacity: 1;
}
body.dark-mode select,
body.dark-mode input,
body.dark-mode textarea {
    background-color: #374151 !important;
    color: #f3f4f6 !important;
    border-color: #4B5563 !important;
}
html body.dark-mode .select2-container--default .select2-selection--single,
html body.dark-mode span.select2-selection.select2-selection--single,
html body.dark-mode .select2-container--default .select2-selection--multiple {
    background-color: #374151 !important;
    color: #f3f4f6 !important;
}
html body.dark-mode .select2-dropdown,
html body.dark-mode .select2-dropdown.select2-dropdown--below,
html body.dark-mode .select2-dropdown.select2-dropdown--above {
    background-color: #374151 !important;
}
html body.dark-mode .select2-results__option {
    background-color: #374151 !important;
    color: #f3f4f6 !important;
}
html body.dark-mode .select2-search__field {
    background-color: #374151 !important;
    color: #f3f4f6 !important;
}
html body.dark-mode .select2-results__option--highlighted {
    background-color: #4B5563 !important;
    color: #ffffff !important;
}
html body.dark-mode select,
html body.dark-mode .select2-container--default .select2-selection--single,
html body.dark-mode span.select2-selection.select2-selection--single {
    background-color: #374151 !important;
    color: #f3f4f6 !important;
    border: 1px solid #4B5563 !important;
    border-radius: 0.375rem !important;
    min-height: 42px !important;
    height: 42px !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    width: 100% !important;
}
html body.dark-mode select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23f3f4f6' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 1.5rem !important;
    padding-right: 2.5rem !important;
}
html body.dark-mode .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #f3f4f6 !important;
    line-height: 30px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}
html body.dark-mode .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px !important;
    top: 1px !important;
    right: 10px !important;
    width: 20px !important;
}
html body.dark-mode .select2-dropdown {
    background-color: #374151 !important;
    border-radius: 0.375rem !important;
    border: 1px solid #4B5563 !important;
}
html body.dark-mode input,
html body.dark-mode .select2-search__field {
    background-color: #374151 !important;
    color: #f3f4f6 !important;
    border: 1px solid #4B5563 !important;
    border-radius: 0.375rem !important;
    padding: 0.5rem 0.75rem !important;
    min-height: 42px !important;
}
html body.dark-mode input[type="text"] {
    height: 42px !important;
    padding: 0.5rem 0.75rem !important;
}
*/
/* --- FINE DISATTIVAZIONE OVERRIDE SFONDI DARK --- */

/* Forza sfondo e testo scuro sui campi con .form-dark-bg in dark mode */
body.bg-gray-800 .form-dark-bg,
body.bg-gray-900 .form-dark-bg,
body.dark .form-dark-bg, body.dark-mode .form-dark-bg {
    background-color: #6B7280 !important; /* Updated from #4B5563 to gray-500 */
    color: #f3f4f6 !important;
    border-color: #374151 !important;
}
body.bg-gray-800 .form-dark-bg::placeholder,
body.bg-gray-900 .form-dark-bg::placeholder,
body.dark .form-dark-bg::placeholder, body.dark-mode .form-dark-bg::placeholder {
    color: #a1a1aa !important;
    opacity: 1;
}
/* Fix definitivo Select2 dark mode: input, dropdown, opzioni - COMMENTED OUT
body.bg-gray-800 .select2-container--default .select2-selection--single,
body.bg-gray-900 .select2-container--default .select2-selection--single,
body.dark .select2-container--default .select2-selection--single, body.dark-mode .select2-container--default .select2-selection--single {
    background-color: #4B5563 !important;
    color: #f3f4f6 !important;
    border-color: #374151 !important;
}
body.bg-gray-800 .select2-container--default .select2-selection--single .select2-selection__rendered,
body.bg-gray-900 .select2-container--default .select2-selection--single .select2-selection__rendered,
body.dark .select2-container--default .select2-selection--single .select2-selection__rendered, body.dark-mode .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #f3f4f6 !important;
}
body.bg-gray-800 .select2-dropdown,
body.bg-gray-900 .select2-dropdown,
body.dark .select2-dropdown, body.dark-mode .select2-dropdown {
    background-color: #4B5563 !important;
    color: #f3f4f6 !important;
}
body.bg-gray-800 .select2-results__option,
body.bg-gray-900 .select2-results__option,
body.dark .select2-results__option, body.dark-mode .select2-results__option {
    background-color: #4B5563 !important;
    color: #f3f4f6 !important;
}
body.bg-gray-800 .select2-results__option--highlighted,
body.bg-gray-900 .select2-results__option--highlighted,
body.dark .select2-results__option--highlighted, body.dark-mode .select2-results__option--highlighted {
    background-color: #374151 !important;
    color: #fff !important;
}
*/

/* Forza Select2 dark mode ovunque se body ha .dark-mode - COMMENTED OUT
body.dark-mode .select2-container--default .select2-selection--single,
body.dark-mode .select2-container--default .select2-selection--multiple {
    background-color: #4B5563 !important;
    color: #f3f4f6 !important;
    border-color: #374151 !important;
}
body.dark-mode .select2-container--default .select2-selection--single .select2-selection__rendered,
body.dark-mode .select2-container--default .select2-selection--multiple .select2-selection__rendered {
    color: #f3f4f6 !important;
}
body.dark-mode .select2-dropdown {
    background-color: #4B5563 !important;
    color: #f3f4f6 !important;
    border-color: #374151 !important;
}
body.dark-mode .select2-results__option {
    background-color: #4B5563 !important;
    color: #f3f4f6 !important;
}
body.dark-mode .select2-results__option--highlighted {
    background-color: #374151 !important;
    color: #fff !important;
}
body.dark-mode .select2-search__field {
    background-color: #4B5563 !important;
    color: #f3f4f6 !important;
    border-color: #374151 !important;
}
*/

/* TEST: Forza Select2 dark mode SEMPRE - COMMENTED OUT / REMOVED */
/*
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple,
.select2-dropdown,
.select2-results__option,
.select2-search__field {
    background-color: #23272f !important;
    color: #f3f4f6 !important;
    border-color: #374151 !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered,
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    color: #f3f4f6 !important;
}
.select2-results__option--highlighted {
    background-color: #374151 !important;
    color: #fff !important;
}
*/

/* Uniforma Select2 alle select native (Tailwind) */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    padding: 0.5rem 0.75rem !important; /* p-2 */
    border-radius: 0.375rem !important; /* rounded-md */
    border-width: 1px !important;
    border-style: solid !important;
    border-color: #374151 !important; /* come border-gray-700 */
    min-height: 2.5rem !important; /* h-10 */
    box-shadow: none !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 0 !important;
    padding-right: 0 !important;
    line-height: 2.5rem !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 2.5rem !important;
    right: 0.75rem !important;
}

/* Ripristina Select2 con stili minimi */
body.dark-mode select,
body.dark-mode input,
body.dark-mode textarea {
    background-color: #374151 !important; /* Grigio più scuro invece di #6B7280 */
    color: #f3f4f6 !important;
    border-color: #4B5563 !important; /* Bordo leggermente più chiaro */
}

/* UNIFICA Select2 con le select native - Versione definitiva */
body.dark-mode .select2-container {
    width: 100% !important;
}

body.dark-mode .select2-container .select2-selection--single,
body.dark-mode .select2-container .select2-selection--multiple {
    background-color: #6B7280 !important;
    color: #f3f4f6 !important;
    border-color: #374151 !important;
    min-height: 2.5rem !important;
    height: auto !important;
    padding: 0.2rem 0.75rem !important;
    border-radius: 0.375rem !important;
    font-size: 1rem !important;
    border-width: 1px !important;
    display: flex !important;
    align-items: center !important;
    box-shadow: none !important;
}

body.dark-mode .select2-container .select2-selection--single .select2-selection__rendered {
    color: #f3f4f6 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    line-height: 2rem !important;
    margin-top: 0 !important;
}

body.dark-mode .select2-container .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
    top: 0 !important;
    right: 0.75rem !important;
    width: 1.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

body.dark-mode .select2-container .select2-selection--single .select2-selection__arrow b {
    border-color: #f3f4f6 transparent transparent transparent !important;
    border-style: solid !important;
    border-width: 5px 4px 0 4px !important;
    margin-left: -4px !important;
    margin-top: -2px !important;
}

body.dark-mode .select2-dropdown {
    background-color: #6B7280 !important;
    color: #f3f4f6 !important;
    border-color: #374151 !important;
    border-width: 1px !important;
    border-radius: 0.375rem !important;
    margin-top: 2px !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

body.dark-mode .select2-search--dropdown .select2-search__field {
    background-color: #4B5563 !important;
    color: #f3f4f6 !important;
    border-color: #374151 !important;
    border-radius: 0.25rem !important;
    padding: 0.3rem 0.5rem !important;
}

body.dark-mode .select2-results__option {
    background-color: #6B7280 !important;
    color: #f3f4f6 !important;
    padding: 0.5rem 0.75rem !important;
}

body.dark-mode .select2-results__option--highlighted {
    background-color: #4B5563 !important;
    color: white !important;
}

/* Forza la visibilità del testo "Seleziona..." */
body.dark-mode .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #d1d5db !important;
}

/* FIX SOLO COLORI Select2 (MASSIMA SPECIFICITÀ) */
html body.dark-mode .select2-container--default .select2-selection--single,
html body.dark-mode span.select2-selection.select2-selection--single,
html body.dark-mode .select2-container--default .select2-selection--multiple {
    background-color: #374151 !important; /* Grigio più scuro invece di #6B7280 */
    color: #f3f4f6 !important;
}

html body.dark-mode .select2-container--default .select2-selection--single .select2-selection__rendered,
html body.dark-mode .select2-selection.select2-selection--single .select2-selection__rendered {
    color: #f3f4f6 !important;
}

html body.dark-mode .select2-dropdown,
html body.dark-mode .select2-dropdown.select2-dropdown--below,
html body.dark-mode .select2-dropdown.select2-dropdown--above {
    background-color: #374151 !important; /* Grigio più scuro invece di #6B7280 */
}

html body.dark-mode .select2-results__option {
    background-color: #374151 !important; /* Grigio più scuro invece di #6B7280 */
    color: #f3f4f6 !important;
}

html body.dark-mode .select2-search__field {
    background-color: #374151 !important; /* Grigio più scuro invece di #6B7280 */
    color: #f3f4f6 !important;
}

html body.dark-mode .select2-results__option--highlighted {
    background-color: #4B5563 !important; /* Highlight leggermente più chiaro */
    color: #ffffff !important;
}

/* UNIFORMITÀ COMPLETA - Stesse proprietà esatte per tutte le dropdown */
html body.dark-mode select,
html body.dark-mode .select2-container--default .select2-selection--single,
html body.dark-mode span.select2-selection.select2-selection--single {
    background-color: #374151 !important;
    color: #f3f4f6 !important;
    border: 1px solid #4B5563 !important;
    border-radius: 0.375rem !important;
    min-height: 42px !important;
    height: 42px !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    width: 100% !important;
}

/* Freccia custom uguale per tutte */
html body.dark-mode select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23f3f4f6' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 1.5rem !important;
    padding-right: 2.5rem !important;
}

/* Uniforma altezza e centra verticalmente testo Select2 */
html body.dark-mode .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #f3f4f6 !important;
    line-height: 30px !important; /* Centratura verticale */
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Freccia dropdown Select2 */
html body.dark-mode .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px !important;
    top: 1px !important;
    right: 10px !important;
    width: 20px !important;
}

/* Arrotonda i dropdown menu allo stesso modo */
html body.dark-mode .select2-dropdown {
    background-color: #374151 !important;
    border-radius: 0.375rem !important;
    border: 1px solid #4B5563 !important;
}

/* Input campo ricerca */
html body.dark-mode input,
html body.dark-mode .select2-search__field {
    background-color: #374151 !important;
    color: #f3f4f6 !important;
    border: 1px solid #4B5563 !important;
    border-radius: 0.375rem !important;
    padding: 0.5rem 0.75rem !important;
    min-height: 42px !important;
}

/* Allineamento campo testo */
html body.dark-mode input[type="text"] {
    height: 42px !important;
    padding: 0.5rem 0.75rem !important;
}

/* Controllo dinamico della dimensione delle anteprime */
:root {
  --thumb-size: 200px;
}
.photo-thumb-container {
  width: 100%;
  height: 100%;
  background: #f3f4f6;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.photo-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  transition: box-shadow 0.2s, transform 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.photo-thumb-img:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}

.photo-grid-dynamic {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--thumb-size), 1fr));
  gap: 1rem;
}

.photo-grid-dynamic > * {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

input[type="range"].thumb-size-range {
  height: 40px;
  vertical-align: middle;
  margin-top: 0;
  margin-bottom: 0;
  position: relative;
  top: 0;
}

/* ===== STILI PULSANTI FILTRO MENU ===== */
/* Fix per i pulsanti di filtro del menu - garantisce leggibilità */
.menu-filter-btn {
    display: inline-block !important;
    padding: 0.25rem 0.75rem !important;
    margin: 0 0.25rem !important;
    border-radius: 0.375rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    text-align: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    border: 1px solid transparent !important;
    text-decoration: none !important;
}

/* Pulsante "Tutti" - Blu */
.menu-filter-btn[data-filter="all"] {
    background-color: #3b82f6 !important;
    color: #ffffff !important;
    border-color: #3b82f6 !important;
}
.menu-filter-btn[data-filter="all"]:hover {
    background-color: #2563eb !important;
    border-color: #2563eb !important;
}

/* Pulsante "Principale" - Viola */
.menu-filter-btn[data-filter="main"] {
    background-color: #8b5cf6 !important;
    color: #ffffff !important;
    border-color: #8b5cf6 !important;
}
.menu-filter-btn[data-filter="main"]:hover {
    background-color: #7c3aed !important;
    border-color: #7c3aed !important;
}

/* Pulsante "Utente" - Indaco */
.menu-filter-btn[data-filter="user"] {
    background-color: #6366f1 !important;
    color: #ffffff !important;
    border-color: #6366f1 !important;
}
.menu-filter-btn[data-filter="user"]:hover {
    background-color: #4f46e5 !important;
    border-color: #4f46e5 !important;
}

/* Pulsante "Footer" - Grigio scuro */
.menu-filter-btn[data-filter="footer"] {
    background-color: #6b7280 !important;
    color: #ffffff !important;
    border-color: #6b7280 !important;
}
.menu-filter-btn[data-filter="footer"]:hover {
    background-color: #4b5563 !important;
    border-color: #4b5563 !important;
}

/* Pulsante "Menu Laterale" - Verde */
.menu-filter-btn[data-filter="sidebar"] {
    background-color: #10b981 !important;
    color: #ffffff !important;
    border-color: #10b981 !important;
}
.menu-filter-btn[data-filter="sidebar"]:hover {
    background-color: #059669 !important;
    border-color: #059669 !important;
}

/* Stato attivo per tutti i pulsanti */
.menu-filter-btn.active {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5) !important;
    transform: translateY(-1px) !important;
}

/* Assicura che il testo sia sempre visibile in dark mode */
body.dark-mode .menu-filter-btn {
    color: #ffffff !important;
}

/* Override per evitare conflitti con altri stili */
.menu-filter-btn * {
    color: inherit !important;
}
