/* ==========================================
   📢 NOTIFICATIONS SYSTEM STYLES
   Стилі для системи сповіщень та новин
   ========================================== */

/* ==========================================
   � КНОПКА ЗВОРОТНОГО ЗВ'ЯЗКУ (НАВБАР)
   ========================================== */
.btn-contact-fab {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white !important;
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-contact-fab:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-contact-fab:active {
    transform: translateY(0);
}

.btn-contact-fab i {
    font-size: 1rem;
}

/* Мобільна версія - тільки іконка */
@media (max-width: 767px) {
    .btn-contact-fab {
        padding: 8px 10px;
        border-radius: 10px;
    }
    
    .btn-contact-fab i {
        font-size: 1.1rem;
    }
}

/* ==========================================
   �📢 БАНЕР ОГОЛОШЕНЬ
   ========================================== */
.announcement-banner {
    background: linear-gradient(135deg, #8b1538, #a91d3a);
    color: white;
    padding: 12px 20px;
    text-align: center;
    font-size: 0.95rem;
    position: relative;
    z-index: 1040;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.announcement-banner .btn-close-white {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.announcement-banner .btn-close-white:hover {
    opacity: 1;
}

/* Темний хрестик для світлого фону */
.announcement-banner .btn-close:not(.btn-close-white) {
    opacity: 0.7;
}

.announcement-banner .btn-close:not(.btn-close-white):hover {
    opacity: 1;
}

.announcement-banner .btn-light {
    background: rgba(255,255,255,0.9);
    border: none;
    color: #333;
    font-weight: 500;
}

.announcement-banner .btn-light:hover {
    background: #fff;
}

.announcement-banner .btn-light {
    padding: 4px 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ==========================================
   🔔 ПАНЕЛЬ СПОВІЩЕНЬ (НОВИЙ ДИЗАЙН)
   ========================================== */
.notification-panel {
    width: 360px;
    max-height: 480px;
    border: none;
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2), 
                0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 1050 !important;
    /* Bootstrap керує display через .show клас */
}

/* Коли dropdown відкритий - flexbox */
.notification-panel.show {
    display: flex;
    flex-direction: column;
}

/* Фіксована шапка */
.notification-panel-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
    color: white;
    padding: 14px 16px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.notification-panel-header .fw-bold {
    font-size: 0.95rem;
}

.notification-panel-header .btn-link {
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.notification-panel-header .btn-link:hover {
    color: white !important;
    text-decoration: none;
}

.notification-panel-header .badge {
    font-size: 0.65rem;
    padding: 3px 6px;
}

/* Скролюваний список */
.notification-panel-body {
    flex: 1;
    overflow-y: auto;
    max-height: 320px;
    background: #fafbfc;
}

/* Кастомний скролбар */
.notification-panel-body::-webkit-scrollbar {
    width: 6px;
}

.notification-panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.notification-panel-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.notification-panel-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Фіксований футер */
.notification-panel-footer {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.notification-panel-footer .btn {
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 10px 16px;
}

/* Пустий стан */
.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: #6b7280;
}

.notification-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-empty-icon i {
    font-size: 1.8rem;
    color: #9ca3af;
}

.notification-empty .fw-medium {
    color: #374151;
}

/* Елемент сповіщення */
.notification-item {
    padding: 14px 16px;
    background: white;
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.2s ease;
    white-space: normal;
    cursor: pointer;
    text-decoration: none !important;
    display: block;
}

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

.notification-item:hover {
    background-color: #f9fafb;
}

/* Непрочитані - виділення */
.notification-item.unread {
    background: linear-gradient(90deg, #fef3c7 0%, #fffbeb 100%);
    border-left: 3px solid #f59e0b;
}

.notification-item.unread:hover {
    background: linear-gradient(90deg, #fde68a 0%, #fef3c7 100%);
}

/* Іконка типу сповіщення */
.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon.info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #2563eb;
}

.notification-icon.success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #059669;
}

.notification-icon.warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}

.notification-icon.error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.notification-icon.promo {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    color: #7c3aed;
}

.notification-icon i {
    font-size: 1.1rem;
}

/* Контент */
.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #111827;
    margin-bottom: 2px;
    line-height: 1.3;
}

.notification-text {
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-time {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ==========================================
   📱 МОБІЛЬНА АДАПТАЦІЯ ПАНЕЛІ
   ========================================== */
@media (max-width: 575px) {
    .notification-panel {
        width: calc(100vw - 20px);
        max-width: 360px;
        right: 10px !important;
        left: auto !important;
        max-height: 70vh;
    }
    
    .notification-panel-body {
        max-height: 50vh;
    }
}

/* ==========================================
   🔔 СТАРИЙ DROPDOWN (для сумісності)
   ========================================== */
.notification-dropdown {
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    z-index: 1050 !important;
}

.notification-dropdown .dropdown-header {
    background: linear-gradient(135deg, #198754 0%, #20c997 100%);
    color: white;
    padding: 14px 16px;
    font-size: 0.95rem;
}

.notification-dropdown .dropdown-header .btn-link {
    color: rgba(255,255,255,0.9) !important;
    text-decoration: none;
    font-size: 0.8rem;
}

.notification-dropdown .dropdown-header .btn-link:hover {
    color: white !important;
}

.notification-dropdown .dropdown-divider {
    margin: 0;
}

/* Елемент сповіщення */
.notification-item {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f1f1;
    transition: all 0.2s ease;
    white-space: normal;
    cursor: pointer;
}

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

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

/* Непрочитані - світлий жовтий фон */
.notification-item.unread {
    background-color: #fff9e6;
    border-left: 3px solid #ffc107;
}

.notification-item.unread:hover {
    background-color: #fff3cd;
}

/* Іконка типу сповіщення */
.notification-item .notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.notification-item .notification-icon.info { background: #e3f2fd; color: #1976d2; }
.notification-item .notification-icon.success { background: #e8f5e9; color: #388e3c; }
.notification-item .notification-icon.warning { background: #fff3e0; color: #f57c00; }
.notification-item .notification-icon.error { background: #ffebee; color: #d32f2f; }
.notification-item .notification-icon.promo { background: #f3e5f5; color: #7b1fa2; }

.notification-item .notification-content {
    flex: 1;
    min-width: 0;
}

.notification-item .notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #212529;
    margin-bottom: 2px;
    line-height: 1.3;
}

.notification-item .notification-text {
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-item .notification-time {
    font-size: 0.7rem;
    color: #9e9e9e;
    margin-top: 4px;
}

/* ==========================================
   🔔 ДЗВІНОЧОК СПОВІЩЕНЬ (ЗБІЛЬШЕНИЙ)
   ========================================== */

/* Кнопка дзвіночка - яскрава, помітна */
.notification-bell-btn {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 12px;
    color: white !important;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.notification-bell-btn:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    color: white !important;
}

.notification-bell-btn i {
    font-size: 1.3rem;
}

/* Badge - яскравий червоний */
.notification-badge-custom {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    color: white;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 10px;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    animation: badgeBounce 2s infinite;
    display: none; /* Показується через JS */
}

@keyframes badgeBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* 🔔 Анімація дзвіночка при новому сповіщенні */
.notification-bell-ring {
    animation: bellRing 1s ease-in-out;
}

.notification-bell-ring i {
    color: white !important;
}

@keyframes bellRing {
    0% { transform: rotate(0); }
    10% { transform: rotate(20deg); }
    20% { transform: rotate(-20deg); }
    30% { transform: rotate(15deg); }
    40% { transform: rotate(-15deg); }
    50% { transform: rotate(10deg); }
    60% { transform: rotate(-10deg); }
    70% { transform: rotate(5deg); }
    80% { transform: rotate(-5deg); }
    90% { transform: rotate(2deg); }
    100% { transform: rotate(0); }
}

/* Hover анімація */
.notification-bell-btn:hover i {
    animation: bellHover 0.3s ease;
}

@keyframes bellHover {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(10deg); }
    75% { transform: rotate(-10deg); }
}

/* Мобільна адаптація */
@media (max-width: 991px) {
    .notification-bell-btn {
        width: 40px;
        height: 40px;
    }
    
    .notification-bell-btn i {
        font-size: 1.2rem;
    }
    
    .notification-badge-custom {
        min-width: 18px;
        height: 18px;
        font-size: 0.65rem;
        line-height: 18px;
        top: -3px;
        right: -3px;
    }
}

/* ==========================================
   📋 DROPDOWN СПОВІЩЕНЬ
   ========================================== */

/* Дзвоник на мобільних пристроях */
@media (max-width: 991px) {
    /* Контейнер з дзвіночком та гамбургером */
    .navbar .d-flex.order-lg-last {
        gap: 8px;
    }
    
    #notificationCenter {
        margin-right: 0 !important;
    }
    
    #notificationBell {
        padding: 6px 10px !important;
        background: rgba(255,255,255,0.1);
        border-radius: 8px;
    }
    
    #notificationBell i {
        font-size: 1.25rem !important;
        color: white;
    }
    
    #notificationBadge {
        top: 2px !important;
        right: 2px !important;
        font-size: 0.55rem;
        padding: 2px 4px;
        min-width: 14px;
        height: 14px;
    }
    
    /* Dropdown на мобільних */
    .notification-dropdown {
        position: fixed !important;
        top: 56px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-width: none !important;
        transform: none !important;
    }
}

/* Дзвоник */
#notificationBell:hover i {
    animation: ring 0.3s ease;
}

@keyframes ring {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(15deg); }
    50% { transform: rotate(-15deg); }
    75% { transform: rotate(10deg); }
}

/* Пустий стан */
.notification-empty {
    padding: 30px 20px;
    text-align: center;
    color: #9e9e9e;
}

.notification-empty i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* Кнопка "Всі сповіщення" */
.notification-dropdown .dropdown-item.text-success {
    padding: 12px 16px;
    font-weight: 500;
}

/* ==========================================
   📦 СЕКЦІЯ ПОСЛУГ
   ========================================== */
#services-section {
    display: none; /* Приховано за замовчуванням, показується для гостей */
}

.service-card {
    border-radius: 16px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12) !important;
}

.service-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: 50%;
}

.service-icon i {
    transition: transform 0.3s ease;
}

.service-card:hover .service-icon i {
    transform: scale(1.1);
}

.service-price {
    font-size: 1.1rem;
}

/* ==========================================
   📰 СЕКЦІЯ НОВИН
   ========================================== */
#news-section {
    display: none; /* Приховано за замовчуванням, показується для гостей */
}

/* Горизонтальний скрол для новин */
.news-horizontal-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 4px 16px 4px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #198754 #e9ecef;
}

.news-horizontal-scroll::-webkit-scrollbar {
    height: 6px;
}

.news-horizontal-scroll::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 3px;
}

.news-horizontal-scroll::-webkit-scrollbar-thumb {
    background: #198754;
    border-radius: 3px;
}

.news-horizontal-scroll::-webkit-scrollbar-thumb:hover {
    background: #157347;
}

/* Картка новини */
.news-card {
    flex: 0 0 auto;
    width: 340px;
    min-width: 300px;
    max-width: 400px;
    border-radius: 16px;
    transition: all 0.3s ease;
    scroll-snap-align: start;
    border: none;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    background: #fff;
}

.news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.news-card .card-body {
    padding: 20px;
    min-height: 180px;
}

.news-card .card-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #212529;
}

.news-card .card-text {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0;
}

.news-card .news-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.news-card .news-type-badge {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.news-card .news-date {
    font-size: 0.75rem;
    color: #9e9e9e;
}

.news-card .card-footer {
    background: transparent;
    border-top: 1px solid #f1f1f1;
    padding: 12px 20px;
}

/* Типи новин - кольори */
.news-type-badge.news { background: #e3f2fd; color: #1976d2; }
.news-type-badge.promo { background: #fff3e0; color: #f57c00; }
.news-type-badge.update { background: #e8f5e9; color: #388e3c; }
.news-type-badge.alert { background: #ffebee; color: #d32f2f; }

/* Порожній стан */
.news-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #9e9e9e;
    width: 100%;
}

.news-empty-state i {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ==========================================
   📰 МОДАЛЬНЕ ВІКНО НОВИНИ
   ========================================== */
#newsModal .modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

#newsModal .modal-header {
    padding: 24px 24px 12px;
}

#newsModal .modal-title {
    font-size: 1.4rem;
    line-height: 1.4;
}

#newsModal .modal-body {
    padding: 12px 24px 24px;
}

#newsModal .news-content {
    font-size: 1rem;
    line-height: 1.7;
    color: #333;
}

#newsModal .modal-footer {
    padding: 16px 24px 24px;
}

@media (max-width: 768px) {
    #newsModal .modal-dialog {
        margin: 10px;
    }
    
    #newsModal .modal-title {
        font-size: 1.2rem;
    }
}

/* ==========================================
   📱 МОБІЛЬНА АДАПТАЦІЯ
   ========================================== */
@media (max-width: 768px) {
    /* Банер на мобільних */
    .announcement-banner {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    
    .announcement-banner .container-fluid > div {
        flex-wrap: nowrap !important;
        gap: 8px !important;
    }
    
    .announcement-banner #announcement-banner-text {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 60%;
    }
    
    .announcement-banner .btn-light {
        padding: 4px 10px;
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .announcement-banner .btn-close {
        width: 20px;
        height: 20px;
        padding: 0;
    }
    
    /* Dropdown сповіщень на мобільних */
    .notification-dropdown {
        width: calc(100vw - 20px) !important;
        max-width: 340px !important;
        right: -10px !important;
        max-height: 70vh !important;
    }
    
    .notification-item {
        padding: 12px;
    }
    
    .notification-item .notification-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .notification-item .notification-title {
        font-size: 0.85rem;
    }
    
    .notification-item .notification-text {
        font-size: 0.75rem;
        -webkit-line-clamp: 2;
    }
    
    .notification-item .notification-time {
        font-size: 0.65rem;
    }
    
    /* Секції новин та послуг */
    #services-section,
    #news-section {
        padding: 30px 0;
    }
    
    .service-icon {
        width: 60px;
        height: 60px;
    }
    
    .service-icon i {
        font-size: 1.5rem !important;
    }
    
    /* Картки новин */
    .news-card {
        margin-bottom: 1rem;
    }
    
    .news-card .card-body {
        padding: 1rem;
    }
}

/* Маленькі екрани (iPhone SE, etc) */
@media (max-width: 375px) {
    .announcement-banner {
        padding: 8px 10px;
        font-size: 0.75rem;
    }
    
    .announcement-banner #announcement-banner-text {
        max-width: 50%;
    }
    
    .announcement-banner .btn-light {
        padding: 3px 8px;
        font-size: 0.7rem;
    }
    
    .notification-dropdown {
        width: calc(100vw - 16px) !important;
        right: -8px !important;
    }
    
    .notification-dropdown .dropdown-header {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}

/* ==========================================
   🎨 ТЕМНА ТЕМА (якщо буде)
   ========================================== */
@media (prefers-color-scheme: dark) {
    .notification-dropdown {
        background: #2d2d2d;
        color: #fff;
    }
    
    .notification-dropdown .dropdown-header {
        background: #1a1a1a;
        color: #fff;
    }
    
    .notification-item:hover {
        background-color: #3d3d3d;
    }
    
    .notification-item.unread {
        background-color: #4a4528;
        border-left: 3px solid #ffc107;
    }
    
    .notification-item.unread .notification-title,
    .notification-item.unread .notification-text,
    .notification-item.unread .notification-time {
        color: #fff !important;
    }
}

/* ==========================================
   📱 PWA STANDALONE MODE
   ========================================== */
@media all and (display-mode: standalone) {
    /* Банер враховує safe area на iPhone */
    .announcement-banner {
        padding-top: calc(12px + env(safe-area-inset-top, 0px));
    }
    
    /* Dropdown не виходить за межі екрану */
    .notification-dropdown {
        max-height: calc(70vh - env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* iOS Safe Area для банера */
@supports (padding-top: env(safe-area-inset-top)) {
    .announcement-banner {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }
}
