/* Plik: css/style.css */

body {
    font-family: 'Inter', sans-serif;
}

/* Custom scrollbar */
::-webkit-scrollbar { 
    width: 8px; 
    height: 8px; 
    display: none; /* Ukryj pasek przewijania */
}
::-webkit-scrollbar-track { 
    background: transparent; 
}
::-webkit-scrollbar-thumb { 
    background: #d1d5db; /* gray-300 */
    border-radius: 10px; 
}
::-webkit-scrollbar-thumb:hover { 
    background: #9ca3af; /* gray-400 */
}
.dark ::-webkit-scrollbar-thumb { 
    background: #4b5563; /* gray-600 */
}
.dark ::-webkit-scrollbar-thumb:hover { 
    background: #6b7280; /* gray-500 */
}

/* Transitions for sidebar and main content */
#sidebar, #main-content {
    transition: all 0.3s ease-in-out; 
}
#sidebar-overlay { 
    transition: opacity 0.3s ease-in-out; 
}

/* Styl dla paska nawigacyjnego - dodano przewijanie */
#main-nav {
    overflow-y: auto;
    scrollbar-width: none; /* Ukryj pasek przewijania w Firefox */
}

/* Styles for collapsed sidebar on desktop */
#sidebar.collapsed {
    width: 5rem; /* 80px */
}

#sidebar.collapsed .sidebar-text {
    display: none;
    opacity: 0;
    pointer-events: none;
}
#sidebar.collapsed .nav-link {
    justify-content: center;
}

/* Tooltip for collapsed sidebar */
.sidebar-link .tooltip {
    /* Tooltip is hidden by default when the menu is expanded */
    display: none;
    position: absolute;
    left: 100%;
    margin-left: 1rem; /* 16px offset from the icon */
    padding: 0.5rem; /* 8px */
    font-size: 0.875rem; /* 14px */
    background-color: #1f2937; /* gray-800 */
    color: white;
    border-radius: 0.375rem; /* 6px */
    white-space: nowrap;
    z-index: 50; /* Ensures it's on top */
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

/* Show tooltip ONLY when the menu is collapsed AND hovered */
#sidebar.collapsed .sidebar-link:hover .tooltip {
    display: block;
    opacity: 1;
}

/* Fixes for mobile menu */
@media (max-width: 1023px) {
    #sidebar.collapsed {
        /* Hide the "collapsed" sidebar on mobile when the window is resized */
        transform: translateX(-100%);
    }
    #sidebar {
        /* Ensure the menu expands to full width */
        width: 16rem; /* 256px */
    }
}

#sidebar {
    /* Uspójnienie animacji dla wszystkich widoków */
    transition: transform 0.3s ease-in-out, width 0.3s ease-in-out;
}

.sidebar-text {
    white-space: nowrap; /* Zapobiega łamaniu tekstu na wiele linii */
    overflow: hidden;    /* Ukrywa tekst, który się nie mieści */
}

/* Hide sidebar text when collapsed */
#sidebar.collapsed .sidebar-text {
    opacity: 0;
    pointer-events: none;
    display: none;
}

/* Wymuszenie koloru tekstu dla etykiet i nagłówków w trybie ciemnym */
.dark label,
.dark h2 {
  color: #d1d5db; /* Kolor gray-300 */
}

/* Poprawka dla wszystkich pól input w trybie ciemnym */
.dark input[type='text'],
.dark input[type='password'],
.dark input[type='number'],
.dark input[type='email'],
.dark input[type='tel'],  
.dark textarea {
  background-color: #374151; /* Kolor gray-700 */
  border-color: #4b5563; /* Kolor gray-600 */
  color: #d1d5db; /* Kolor gray-300 */
}

/* Poprawka dla pól select w trybie ciemnym */
.dark select {
  -webkit-appearance: none;
  appearance: none;
  background-color: #374151; /* Kolor gray-700 */
  border-color: #4b5563; /* Kolor gray-600 */
  color: #d1d5db; /* Kolor gray-300 */
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* Poprawka dla pól input po autouzupełnieniu w trybie ciemnym */
.dark input:-webkit-autofill,
.dark input:-webkit-autofill:hover, 
.dark input:-webkit-autofill:focus, 
.dark input:-webkit-autofill:active {
    box-shadow: 0 0 0 30px #374151 inset !important; /* gray-700 */
    -webkit-text-fill-color: #d1d5db !important; /* gray-300 */
}

/* Poprawka dla focusu na wszystkich polach w trybie ciemnym */
.dark input[type='text']:focus,
.dark input[type='password']:focus,
.dark input[type='number']:focus,
.dark input[type='email']:focus,
.dark input[type='tel']:focus,  
.dark textarea:focus,
.dark select:focus {
  border-color: #3b82f6; /* Kolor blue-500 */
  --tw-ring-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
}

/* Style dla modala w trybie banera */
.modal.modal-banner {
    /* Usuwamy wyśrodkowanie, aby pasek mógł być na górze */
    align-items: flex-start;
}

.modal.modal-banner .bg-white {
    width: 100%;
    max-width: 100%;
    border-radius: 0 0 12px 12px; /* Zaokrąglenie tylko na dole */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.4s ease-out forwards;
}

/* Animacja wysuwania się paska */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Style dla telefonów (np. ekrany węższe niż 768px) */
@media (max-width: 768px) {
    /* Zmień nawigację na bardziej mobilną (np. hamburger menu - to zadanie na później) */
    nav ul {
        flex-direction: column; /* Ułóż linki jeden pod drugim */
        align-items: center;
    }

    /* Spraw, by elementy galerii zajmowały całą szerokość */
    .gallery-item {
        width: 90%; /* Zamiast 30%, aby były większe na małym ekranie */
        margin-bottom: 20px;
    }
}

/* Style dla dynamicznych pól w formularzu narzędzi */
.tool-component-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.tool-component-field label {
    font-size: 0.75rem; /* mniejsza etykieta */
    color: #6b7280; /* kolor szary */
}

.dark .tool-component-field label {
    color: #9ca3af;
}

.tool-component-field input {
    border: 1px solid #d1d5db; /* ramka */
    text-align: center; /* wyśrodkowany tekst */
    padding: 0.5rem;
    border-radius: 0.375rem;
    background-color: #f9fafb; /* lekkie tło */
    width: 100%;
}

.dark .tool-component-field input {
    background-color: #374151;
    border-color: #4b5563;
}

/* Custom File Input Styling */
.custom-file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.custom-file-input-wrapper input[type=file] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.custom-file-button {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background-color: #4f46e5; /* indigo-600 */
    color: white;
    border-radius: 0.375rem; /* rounded-md */
    cursor: pointer;
    font-size: 0.875rem; /* text-sm */
    font-weight: 500;
}
.dark .custom-file-button {
    background-color: #6366f1; /* indigo-500 */
}

.custom-file-button:hover {
    background-color: #4338ca; /* indigo-700 */
}
.dark .custom-file-button:hover {
    background-color: #4f46e5; /* indigo-600 */
}


.custom-file-name {
    margin-left: 1rem;
    font-size: 0.875rem;
    color: #6b7280; /* gray-500 */
}
.dark .custom-file-name {
    color: #d1d5db; /* gray-300 */
}

/* NOWE STYLE DLA KART NARZĘDZI */
.tool-card-hover {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.tool-card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.dark .tool-card-hover:hover {
     box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.2);
}

/* Styl dla przycisków akcji na kartach */
.action-btn {
    color: white;
    font-size: 0.75rem; /* text-xs */
    padding: 0.25rem 0.75rem; /* py-1 px-3 */
    border-radius: 0.25rem; /* rounded */
    display: inline-flex;
    align-items: center;
    gap: 0.25rem; /* gap-1 */
    font-weight: 600; /* font-semibold */
    transition: background-color 0.2s;
}

.action-btn:disabled {
    background-color: #9ca3af; /* gray-400 */
    cursor: not-allowed;
}

/* Poprawka dla paska przewijania, aby był zawsze widoczny w kontenerach z klasą .overflow-y-auto */
.overflow-y-auto::-webkit-scrollbar {
    display: block; /* Upewnij się, że pasek przewijania jest widoczny */
}

/* Poprawka dla kontenera z przyciskami w narzędziowni, aby się nie nakładały */
#header-controls {
    display: flex;
    justify-content: space-between; /* Rozsuwa elementy na boki */
    align-items: center;
    flex-wrap: wrap; /* Pozwala na zawijanie wierszy na mniejszych ekranach */
    gap: 1rem; /* Dodaje odstęp między grupami przycisków */
}

/* Wyrównanie grupy przycisków akcji do prawej */
#global-action-buttons {
    margin-left: auto; /* To jest kluczowa zmiana, która przesuwa wszystko w prawo */
}

/* Poprawka dla pustych list przeciągania i upuszczania */
.sortable-list {
    min-height: 150px;
}

/* Styl dla kafelka narzędzia z brakującymi komponentami */
.tool-card-missing-parts {
    background-color: #fef2f2; /* Czerwony-50 */
    border-color: #fca5a5; /* Czerwony-300 */
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); /* Czerwona poświata */
}

.dark .tool-card-missing-parts {
    background-color: #450a0a; /* Czerwony-950 */
    border-color: #7f1d1d; /* Czerwony-800 */
}

/* Style dla zakładek w formularzu narzędzi */
#tool-form-tabs .tab-btn {
    transition: all 0.2s ease-in-out;
}

#tool-form-tabs .tab-btn:hover {
    border-color: #e5e7eb; /* gray-200 */
}
.dark #tool-form-tabs .tab-btn:hover {
    border-color: #4b5563; /* gray-600 */
}

/* Styl dla wskaźnika zamiennika (ikona w rogu karty) */
.substitute-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    color: #9ca3af; /* gray-400 */
    opacity: 0.7;
    transition: opacity 0.2s ease-in-out;
}
.component-card:hover .substitute-indicator {
    opacity: 1;
}
.dark .substitute-indicator {
    color: #9ca3af; /* gray-400 */
}

/* Styl dla podświetlenia grupy zamienników */
.component-card.substitute-highlight {
    border-color: #3b82f6; /* blue-500 */
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
    transform: scale(1.03);
    z-index: 10;
}
.dark .component-card.substitute-highlight {
    border-color: #60a5fa; /* blue-400 */
}

/* Dodajemy płynne przejście do wszystkich kart komponentów */
.component-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

/* Styl dla wysuwanego panelu o dopasowanej szerokości */
#drawer.drawer-fit-content {
    width: auto;
    min-width: 280px; /* Minimalna szerokość dla czytelności */
    max-width: 90vw; /* Maksymalna szerokość, aby nie zakryć całego ekranu */
}

/* Ukrywa tylko tytuł w nagłówku panelu, zostawiając przycisk zamykania */
#drawer.drawer-no-header #drawer-title {
    display: none;
}

/* Styl dla elementu <summary> w akordeonie */
#modal-content summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#modal-content summary::after {
    content: '▼';
    font-size: 0.8em;
    transition: transform 0.2s ease-in-out;
}

#modal-content details[open] > summary::after {
    transform: rotate(180deg);
}

/* Ukrycie domyślnego znacznika dla przeglądarek Webkit (Chrome, Safari) */
#modal-content summary::-webkit-details-marker {
    display: none;
}