/* style.css - arkusz stylów dla systemu podmian załogi */

/* Ogólne style */
body {
    background-color: #f5f5f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.85rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layout dla stopki na dole */
main {
    flex: 1 0 auto;
}

footer {
    flex-shrink: 0;
    margin-top: auto;
}

/* Kompaktowy układ */
.container-fluid {
    padding: 0.5rem 1rem;
}

/* Logo w nagłówku */
.navbar-brand img {
    height: 30px;
    margin-right: 10px;
}

/* Mniejsze marginesy i paddingi */
.card {
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card-body {
    padding: 0.5rem;
}

.row {
    margin-right: -0.5rem;
    margin-left: -0.5rem;
}

.col, .col-1, .col-10, .col-11, .col-12, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, 
.col-auto, .col-lg, .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, 
.col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-auto, .col-md, .col-md-1, .col-md-10, 
.col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, 
.col-md-9, .col-md-auto, .col-sm, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, 
.col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-auto, .col-xl, .col-xl-1, 
.col-xl-10, .col-xl-11, .col-xl-12, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, 
.col-xl-8, .col-xl-9, .col-xl-auto {
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

/* Mniejsze nagłówki */
h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

h3 {
    font-size: 1.2rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
}

h5 {
    font-size: 1rem;
    margin-bottom: 0;
}

/* Bardziej kompaktowe tabele */
.table {
    margin-bottom: 0;
}

.table td, .table th {
    padding: 0.25rem 0.5rem;
    vertical-align: middle;
}

/* Bardziej kompaktowe formularze */
.form-group {
    margin-bottom: 0.5rem;
}

.form-control {
    padding: 0.25rem 0.5rem;
    height: calc(1.5em + 0.5rem + 2px);
}

.btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

/* Stylizacja tabel załóg */
.crew-table-container table {
    background-color: #fff;
}

.crew-table-container th {
    background-color: #f0f0f0;
    font-weight: 600;
}

/* Członkowie załogi */
.crew-member {
    position: relative;
    padding: 3px 6px;
    background-color: #f9f9f9;
    border-radius: 2px;
    margin: 2px 0;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.crew-member:hover {
    background-color: #f0f0f0;
}

.crew-member.highlighted {
    background-color: #ffecec;
    color: #d9534f;
    font-weight: 600;
    border-left: 3px solid #d9534f;
}

/* Akcje dla członków załogi */
.crew-actions {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
}

.crew-member:hover .crew-actions {
    display: block;
}

.crew-actions a {
    color: #6c757d;
    margin-left: 5px;
    font-size: 14px;
}

.crew-actions a:hover {
    color: #343a40;
}

.crew-actions a.toggle-highlight:hover {
    color: #d9534f;
}

/* Link dodawania załogi - naprawiony problem z podwójnym przyciskiem */
a.add-crew {
    display: block;
    text-align: center;
    padding: 5px;
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
}

.add-crew-container {
    display: flex;
    justify-content: center;
    margin-top: 5px;
    margin-bottom: 15px;
}

a.add-crew:hover {
    background-color: #f0f0f0;
}

/* Stylizacja nagłówków sekcji */
h3 {
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 8px;
}

/* Stylizacja modalnego okna dialogowego */
.modal-header {
    border-bottom: 0;
}

.modal-footer {
    border-top: 0;
}

.modal-footer .btn-secondary.mr-auto {
    margin-right: auto !important;
}

/* Sugestie wyszukiwania */
#suggestions {
    max-height: 200px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 8px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.suggestion-item:hover {
    background-color: #f8f9fa;
}

/* Instrukcja wypełniania */
.card-header.bg-success {
    background-color: #28a745 !important;
}

/* Stylizacja panelu administratora */
.admin-panel .card {
    margin-bottom: 20px;
}

.admin-panel .card-header {
    font-weight: 600;
}

.admin-panel .table {
    margin-bottom: 0;
}

/* Style dla date picker */
.ui-datepicker {
    font-size: 0.85rem;
    z-index: 1050 !important; /* Wyższy z-index, aby działał nad modalnymi oknami */
}

.date-has-entries {
    background-color: #d4edda !important;
    border: 1px solid #c3e6cb !important;
    color: #155724 !important;
    font-weight: bold;
}

.ui-datepicker-today .ui-state-default {
    border: 1px solid #007bff !important;
    background-color: #e7f2ff !important;
}

/* Responsywność - poprawiona */
@media (max-width: 767px) {
    .crew-actions {
        display: block;
        position: static;
        text-align: right;
        transform: none;
        margin-top: 5px;
    }
    
    .crew-member {
        padding: 8px;
    }
    
    .navbar-brand {
        font-size: 1rem;
        max-width: 70%;
        white-space: normal;
    }
    
    /* Lepszy układ dla OSS na małych ekranach */
    .oss-subdepartment {
        margin-bottom: 15px;
        border-bottom: 1px dashed #dee2e6;
        padding-bottom: 15px;
    }
    
    #notifySafetyOfficerBtn {
        margin-top: 10px;
        width: 100%;
    }
    
    .date-navigation {
        flex-direction: column;
    }
    
    .date-navigation .form-group {
        margin-bottom: 10px;
        width: 100%;
    }
    
    .date-navigation .btn-group {
        width: 100%;
        display: flex;
        justify-content: space-between;
    }
}

/* Style dla elementów z komentarzami */
.crew-member.has-comment {
    border-left: 3px dashed #007bff;
    padding-left: 8px;
}

/* Styl dla ikony komentarza */
.crew-actions a.add-comment {
    color: #6c757d;
}

.crew-actions a.add-comment:hover {
    color: #007bff;
}

/* Styl dla tooltip */
.tooltip-inner {
    max-width: 300px;
    padding: 8px 12px;
    text-align: left;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

[data-toggle="tooltip"] {
    cursor: pointer;
}

/* Przycisk powiadomienia Safety Officera */
#notifySafetyOfficerBtn {
    margin-left: 10px;
}

/* Style dla kart w adminie */
.admin-card {
    margin-bottom: 20px;
}

/* Poprawka na mobilnych urządzeniach */
@media (max-width: 767px) {
    #notifySafetyOfficerBtn {
        margin-bottom: 10px;
        display: block;
        width: 100%;
    }
    
    .tooltip {
        display: none !important;
    }
    
    .crew-member.has-comment:after {
        content: '\f4ad';  /* Unicode for comment icon */
        font-family: 'Font Awesome 5 Free';
        margin-left: 5px;
        color: #007bff;
    }
}

/* Style dla sekcji nawigacyjnej */
.date-navigation label {
    font-weight: 600;
    margin-right: 5px;
}

.date-navigation .input-group {
    width: auto;
}

.date-navigation .input-group-text {
    background-color: #f8f9fa;
    cursor: pointer;
}

/* Style dla ikon w elementach crew-member */
.cabin-icon {
    color: #6c757d;
    margin-left: 5px;
    font-size: 12px;
}

.cabin-icon:hover {
    color: #007bff;
}

/* POPRAWIONE STYLE DLA KOMENTARZY */
.crew-comment {
    font-style: italic;
    padding-left: 5px;
    border-left: 2px solid #dee2e6;
    max-width: 90%;
    font-size: 0.75rem; /* Nieco mniejszy font dla komentarzy */
    line-height: 1.2;
    margin-top: 2px;
    
    /* Zawijanie tekstu z ograniczeniem wysokości */
    white-space: normal; /* Pozwala na łamanie linii */
    word-wrap: break-word; /* Łamie długie słowa */
    overflow-wrap: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Ogranicza do 2 linii */
    -webkit-box-orient: vertical;
}

/* Style dla pełnego komentarza (po kliknięciu) */
.crew-comment.expanded {
    -webkit-line-clamp: unset;
    max-height: none;
    overflow: visible;
    display: block;
}

/* Dodatkowy styl dla wskaźnika "więcej" */
.crew-comment-toggle {
    color: #007bff;
    cursor: pointer;
    font-size: 0.7rem;
    text-decoration: underline;
    margin-left: 3px;
    white-space: nowrap;
}

.crew-comment-toggle:hover {
    color: #0056b3;
    text-decoration: none;
}

/* Poprawione style dla tooltipów */
.tooltip-inner {
    max-width: 250px;
    text-align: left;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    padding: 8px;
}

/* Przyciski w footerze modala */
.modal-footer .btn-danger.mr-auto {
    margin-right: auto !important;
}

/* Nowy styl dla przycisków dodaj */
.add-crew-container {
    display: flex;
    justify-content: space-between;
}

.add-crew {
    display: inline-block;
}

.date-input {
    width: 100px !important;
    cursor: default !important;
}

.date-picker-icon {
    cursor: pointer;
    background-color: #e9ecef;
}

.date-picker-group .input-group-text:hover {
    background-color: #d6d9dc;
}

.row-number {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    vertical-align: middle !important;
    border-right: 2px solid #dee2e6;
    text-align: center;
    font-size: 0.8rem;
}

td:empty {
    background-color: #f9f9f9;
    min-height: 30px;
}

/* Wyróżnienie połączonych wierszy */
.paired-row td {
    border-top: 2px solid #b8daff !important;
    border-bottom: 2px solid #b8daff !important;
}

/* Stylizacja przycisku "Pozostaw puste miejsce" */
#addEmptyRow {
    background-color: #e2e6ea;
    border-color: #dae0e5;
}

/* Help sidebar */
.help-sidebar {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100%;
    background-color: #fff;
    box-shadow: -2px 0 5px rgba(0,0,0,0.2);
    z-index: 1050;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.help-sidebar.active {
    right: 0;
}

.help-sidebar-header {
    padding: 15px;
    background-color: #007bff;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.help-sidebar-header h4 {
    margin: 0;
    font-size: 1.2rem;
}

.help-sidebar-header .close {
    color: white;
    opacity: 1;
}

.help-sidebar-content {
    padding: 15px;
}

.help-section {
    margin-bottom: 20px;
}

.help-section h5 {
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.help-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1040;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Style dla blokad edycji */
.editing-lock {
    position: absolute;
    top: 0;
    right: 0;
    background-color: rgba(255, 193, 7, 0.8);
    color: #000;
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 0 0 0 3px;
    z-index: 5;
}

.update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    border-radius: 5px;
    z-index: 1060;
    padding: 15px;
    max-width: 300px;
}

.update-notification-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.update-notification-content p {
    margin-bottom: 10px;
}

/* Lepsze wyróżnienie dni z wpisami */
.date-has-entries {
    background-color: #28a745 !important;
    border: 1px solid #28a745 !important;
    color: white !important;
    font-weight: bold;
}

/* Mocne style dla podświetlenia dat z wpisami */
.ui-datepicker .ui-datepicker-calendar .date-has-entries {
    background-color: #3498db !important;
    color: white !important;
    font-weight: bold !important;
}

.ui-datepicker .ui-datepicker-calendar .date-has-entries a {
    background-color: #3498db !important;
    color: white !important;
    font-weight: bold !important;
}

/* W przypadku gdy data jest aktualnie wybrana */
.ui-datepicker .ui-datepicker-calendar .ui-state-active.date-has-entries,
.ui-datepicker .ui-datepicker-calendar .date-has-entries.ui-state-active,
.ui-datepicker .ui-datepicker-calendar .date-has-entries a.ui-state-active {
    background-color: #1a5276 !important;
    border-color: #1a5276 !important;
    color: white !important;
}

/* Dla pewności dodajemy style dla hover */
.ui-datepicker .ui-datepicker-calendar .date-has-entries:hover,
.ui-datepicker .ui-datepicker-calendar .date-has-entries a:hover {
    background-color: #2980b9 !important;
    color: white !important;
}

/* Ukryj ikonkę domku domyślnie */
.cabin-icon-link {
    display: none;
}

/* Pokaż ikonkę domku przy najechaniu na element crew-member */
.crew-member:hover .cabin-icon-link {
    display: inline-block;
}

/* Style dla blokad edycji */
.editing-lock {
    position: absolute;
    top: 0;
    right: 0;
    background-color: rgba(255, 193, 7, 0.8);
    color: #000;
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 0 0 0 3px;
    z-index: 5;
}

/* Style dla blokad działów */
.department-lock {
    position: absolute;
    top: 5px;
    right: 10px;
    background-color: rgba(255, 193, 7, 0.9);
    color: #000;
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 3px;
    z-index: 5;
    font-weight: bold;
}

.locked-department {
    border: 2px solid #ffc107;
    position: relative;
}

.locked-department .card-body {
    opacity: 0.7;
    pointer-events: none;
}

/* Nowy styl powiadomienia o aktualizacji danych */
.update-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #d4edda;
    color: #155724;
    text-align: center;
    padding: 12px;
    z-index: 1070;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    border-bottom: 2px solid #c3e6cb;
    font-weight: bold;
}

.update-notification-content {
    display: flex;
    justify-content: center;
    align-items: center;
}

.update-notification-content p {
    margin-bottom: 0;
    margin-right: 15px;
}

.update-notification-content i {
    margin-right: 5px;
}

/* Overlay blokujący edycję */
.edit-blocker-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.edit-blocker-message {
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    text-align: center;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
    max-width: 400px;
}

.edit-blocker-message p {
    margin-bottom: 10px;
}

.edit-blocker-message p:first-child {
    font-weight: bold;
    font-size: 1.2em;
}

.edit-blocker-message i {
    color: #ffc107;
    margin-right: 5px;
    font-size: 1.5em;
}

.global-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999; /* Zawsze na wierzchu */
    min-width: 300px;
    max-width: 600px;
    padding: 15px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: notificationSlideIn 0.3s ease-out;
}

.notification-content {
    display: flex;
    align-items: center;
}

.notification-icon {
    font-size: 1.5rem;
    margin-right: 15px;
}

.notification-message {
    flex-grow: 1;
    font-weight: 500;
}

@keyframes notificationSlideIn {
    from {
        transform: translateX(-50%) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Gdy modal jest otwarty, przesuń powiadomienie niżej */
body.modal-open .global-notification {
    top: 70px;
}

/* Styl dla przycisku czyszczenia działu */
.clear-department {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    padding: 5px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-department:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

/* Dodajemy animację dla ikony kosza przy hover */
.clear-department:hover i {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(-5deg); }
    40% { transform: rotate(5deg); }
    60% { transform: rotate(-3deg); }
    80% { transform: rotate(3deg); }
}

/* Zapewnienie, że nagłówek ma pozycję relative dla poprawnego pozycjonowania ikony */
.card-header {
    position: relative;
}

/* Style dla alertów */
.alert {
    margin-bottom: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-left-width: 5px;
    position: relative;
    z-index: 1031; /* Wyższy z-index niż domyślny Bootstrap */
}

.alert-success {
    border-left-color: #28a745;
}

.alert-danger {
    border-left-color: #dc3545;
}

/* Link do instrukcji obsługi */
.instruction-section {
    margin-top: 30px;
    border-top: 1px dashed #dee2e6;
    padding-top: 20px;
}

.instruction-link {
    display: flex;
    align-items: center;
    background-color: #f8f9fa;
    padding: 12px 15px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    color: #495057;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.instruction-link:hover {
    background-color: #e9ecef;
    color: #007bff;
    border-color: #b8daff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    text-decoration: none;
}

.instruction-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #e3f2fd;
    border-radius: 50%;
    margin-right: 15px;
    color: #007bff;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.instruction-link:hover .instruction-icon {
    background-color: #007bff;
    color: white;
    transform: scale(1.1);
}

.instruction-text {
    flex-grow: 1;
    font-weight: 500;
}

.instruction-arrow {
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    color: #007bff;
}

.instruction-link:hover .instruction-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Styl dla ikony "Potrzebna kabina" */
.cabin-needed-icon {
    color: #ffc107 !important; /* Żółty kolor ostrzegawczy */
    display: inline-block !important; /* Zawsze widoczna */
}

/* Domyślnie ukryj ikony kabiny (szare/niebieskie) gdy nie ma hover */
.crew-member .cabin-icon-link {
    display: none;
}

/* Pokazuj ikony kabiny przy hover na elemencie crew-member */
.crew-member:hover .cabin-icon-link {
    display: inline-block;
}

/* ZAWSZE pokazuj ikony kabiny z klasą cabin-needed-icon (żółte ikony) - niezależnie od hover */
.crew-member .cabin-icon-link i.cabin-needed-icon {
    display: inline-block !important;
}

/* Zapewniamy, że cały link cabin-icon-link jest widoczny, jeśli ma klasę cabin-needed-icon-link */
.crew-member .cabin-needed-icon-link {
    display: inline-block !important;
}

/* Dodatkowe style dla podświetlenia żółtej ikony */
.text-warning.cabin-needed-icon {
    font-size: 1.1em; /* Nieco większa ikona */
    text-shadow: 0 0 2px rgba(0,0,0,0.2); /* Delikatny cień */
}