/* ==========================================
   GLOBALNY NAGŁÓWEK CRM
   ========================================== */

.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 15px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    justify-content: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Menu toggle button */
.menu-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.menu-toggle:hover {
    background: #f0f0f0;
    color: #2d5a27;
}

/* Data i godzina */
.header-datetime {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 13px;
    padding: 6px 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.header-datetime i {
    color: #2d5a27;
}

.header-datetime .date {
    font-weight: 500;
}

.header-datetime .time {
    color: #999;
    border-left: 1px solid #ddd;
    padding-left: 8px;
    margin-left: 4px;
}

/* Wyszukiwarka globalna */
.global-search {
    position: relative;
    flex: 1;
    max-width: 500px;
}

.global-search input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    transition: all 0.3s;
    background: #f8f9fa;
}

.global-search input:focus {
    outline: none;
    border-color: #2d5a27;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(45, 90, 39, 0.1);
}

.global-search input::placeholder {
    color: #999;
}

.global-search .search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 14px;
}

.global-search .search-clear {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    display: none;
    font-size: 14px;
}

.global-search .search-clear:hover {
    color: #e74c3c;
}

.global-search.has-value .search-clear {
    display: block;
}

/* Dropdown wyników wyszukiwania */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: 8px;
}

.search-results.active {
    display: block;
}

.search-results-category {
    padding: 8px 15px;
    background: #f8f9fa;
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
}

.search-result-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

.search-result-item:hover,
.search-result-item.selected {
    background: #f0f7ef;
}

.search-result-item.selected {
    box-shadow: inset 3px 0 0 #2d5a27;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.search-result-icon.agreement {
    background: #e8f5e9;
    color: #27ae60;
}

.search-result-icon.sales {
    background: #e3f2fd;
    color: #3498db;
}

.search-result-icon.transport {
    background: #fff3e0;
    color: #f39c12;
}

.search-result-icon.contractor {
    background: #f3e5f5;
    color: #9b59b6;
}

.search-result-icon.package {
    background: #fce4ec;
    color: #e91e63;
}

.search-result-icon.product {
    background: #e8f5e9;
    color: #4caf50;
}

.search-result-icon.warehouse {
    background: #e0f2f1;
    color: #00897b;
}

.search-result-icon.contact {
    background: #fff8e1;
    color: #ff8f00;
}

.search-result-icon.comment {
    background: #f3e5f5;
    color: #8e24aa;
}

.search-result-icon.calendar {
    background: #e8f5e9;
    color: #2d5a27;
}

.search-result-icon.driver {
    background: #e3f2fd;
    color: #1565c0;
}

.search-result-icon.wycena {
    background: #fff3e0;
    color: #e65100;
}

.search-result-icon.order {
    background: #ede7f6;
    color: #5e35b1;
}

.search-result-content {
    flex: 1;
}

.search-result-title {
    font-weight: 500;
    color: #333;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.search-match-field {
    font-size: 10px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 400;
}

.search-result-subtitle {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-title mark {
    background: #fff3cd;
    color: #856404;
    border-radius: 2px;
    padding: 0 2px;
    font-weight: 600;
}

.search-more-results {
    padding: 8px 15px;
    font-size: 12px;
    color: #2d5a27;
    font-style: italic;
    background: #f5f9f5;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-more-results:hover {
    background: #e8f4e8;
    color: #1e3d1a;
}

.search-results-footer {
    padding: 10px 15px;
    font-size: 11px;
    color: #999;
    background: #f8f9fa;
    text-align: center;
    border-top: 1px solid #eee;
}

/* Separator między aktywnymi a zakończonymi */
.search-results-separator {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    gap: 10px;
}

.search-results-separator .separator-line {
    flex: 1;
    height: 1px;
    background: #d0d0d0;
}

.search-results-separator .separator-text {
    font-size: 11px;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.search-results-separator .separator-text i {
    color: #27ae60;
}

/* Style dla zakończonych wyników */
.search-results-category.completed {
    background: #f5f5f5;
    color: #888;
}

.search-result-item.completed {
    opacity: 0.75;
    background: #fafafa;
}

.search-result-item.completed:hover {
    opacity: 1;
    background: #f0f0f0;
}

.search-result-icon.completed {
    opacity: 0.6;
}

.search-result-item.completed .search-result-title {
    color: #666;
}

.search-result-item.completed .search-result-subtitle {
    color: #aaa;
}

.search-result-completed-badge {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #27ae60;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}

/* Rozwijana sekcja zakończonych */
.search-completed-divider {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    gap: 10px;
    cursor: pointer;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    transition: background 0.2s;
    user-select: none;
}

.search-completed-divider:hover {
    background: #f0f0f0;
}

.search-completed-divider-line {
    flex: 1;
    height: 1px;
    background: #d0d0d0;
}

.search-completed-divider-label {
    font-size: 12px;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.search-completed-divider-label i.fa-check-circle {
    color: #27ae60;
}

.search-completed-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.search-completed-divider.expanded .search-completed-arrow {
    transform: rotate(180deg);
}

.search-completed-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.search-completed-section.expanded {
    max-height: 1000px;
}

/* Info - brak aktywnych */
.search-no-active {
    padding: 15px;
    text-align: center;
    color: #888;
    font-size: 13px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.search-no-active i {
    margin-right: 6px;
    color: #2196f3;
}

.search-no-results {
    padding: 30px;
    text-align: center;
    color: #999;
}

.search-no-results i {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
}

/* Powiadomienia */
.notifications-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.notifications-btn:hover {
    background: #f0f0f0;
    color: #2d5a27;
}

.notifications-btn .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #e74c3c;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

.notifications-btn .badge:empty,
.notifications-btn .badge[data-count="0"] {
    display: none;
}

/* Dropdown powiadomień */
.notifications-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
    margin-top: 8px;
}

.notifications-dropdown.active {
    display: block;
}

.notifications-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notifications-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.notifications-header .mark-read {
    font-size: 12px;
    color: #2d5a27;
    cursor: pointer;
    background: none;
    border: none;
}

.notifications-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    gap: 12px;
}

.notification-item:hover {
    background: #f8f9fa;
}

.notification-item.unread {
    background: #f0f8ff;
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e8f5e9;
    color: #2d5a27;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-text {
    font-size: 13px;
    color: #333;
    line-height: 1.4;
}

.notification-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.notifications-empty {
    padding: 30px;
    text-align: center;
    color: #999;
}

.notifications-empty i {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
}

/* Przycisk wylogowania */
.logout-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

/* Responsywność */
@media (max-width: 1024px) {
    .header-datetime {
        display: none;
    }
    
    .global-search {
        max-width: 300px;
    }
}

@media (max-width: 768px) {
    .top-header {
        padding: 8px 15px;
    }
    
    .global-search {
        max-width: 200px;
    }
    
    .global-search input {
        padding: 8px 12px 8px 35px;
        font-size: 13px;
    }
    
    .logout-btn span {
        display: none;
    }
    
    .logout-btn {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .global-search {
        display: none;
    }
}

/* ============================================
   PULSUJĄCY PRZYCISK KONFERENCJI W HEADERZE
   ============================================ */
.header-conference-join {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: linear-gradient(135deg, #2d5a27, #4a8c3f);
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    animation: confPulse 2s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(45, 90, 39, 0.7);
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.header-conference-join:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(45, 90, 39, 0.4);
    animation: none;
    color: #fff;
    text-decoration: none;
}

.header-conference-join i {
    font-size: 14px;
}

.header-conference-join-text {
    font-weight: 700;
    letter-spacing: 0.3px;
}

.header-conference-join-creator {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.85;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes confPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(45, 90, 39, 0.7);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(45, 90, 39, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(45, 90, 39, 0);
    }
}

/* Na małych ekranach ukryj tekst twórcy */
@media (max-width: 768px) {
    .header-conference-join-creator {
        display: none;
    }
    .header-conference-join {
        padding: 8px 14px;
    }
}

@media (max-width: 480px) {
    .header-conference-join-text {
        display: none;
    }
    .header-conference-join {
        padding: 8px 10px;
        border-radius: 50%;
        width: 36px;
        height: 36px;
        justify-content: center;
    }
}
