/* ============================================
   SMS Reminder Platform - Застрахователен UI/UX Дизайн
   Професионален дизайн за застрахователна компания
   ============================================ */

:root {
    /* Цветова палитра на доверие и професионализъм */
    --insurance-blue: #003d82;
    --insurance-blue-light: #0052a3;
    --insurance-blue-dark: #002855;
    --trust-green: #00a651;
    --trust-green-light: #00c563;
    --warning-amber: #ff9800;
    --danger-red: #d32f2f;
    --neutral-gray: #6c757d;
    --bg-primary: #f5f7fa;
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow-sm: 0 2px 4px rgba(0, 61, 130, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 61, 130, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 61, 130, 0.16);
    --radius: 8px;
    --radius-lg: 12px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
    overflow-x: hidden;
    width: 100%;
}

/* ============================================
   Навигация - Професионален Header
   ============================================ */

.navbar {
    background: var(--insurance-blue) !important;
    box-shadow: var(--shadow-md);
    padding: 0.75rem 0;
    border-bottom: 3px solid var(--trust-green);
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: white !important;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: 0.5px;
}

.navbar-brand i {
    font-size: 1.5rem;
    background: var(--trust-green);
    padding: 0.5rem;
    border-radius: 6px;
}

/* --- ПРОФЕСИОНАЛНА НАВИГАЦИЯ --- */

/* Основно състояние на линковете */
.nav-link {
    color: rgba(255, 255, 255, 0.75) !important; /* Леко прозрачно бяло за неактивните */
    font-weight: 500;
    padding: 0.6rem 1.1rem !important;
    margin: 0 2px;
    border-radius: 6px !important;
    transition: all 0.25s ease-in-out !important;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Hover състояние (когато мишката е отгоре) */
.nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.1) !important; /* Много лек фон */
}

/* Active състояние (текущата страница) */
.nav-link.active {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.15) !important; /* Малко по-плътен фон */
    font-weight: 600;
}

/* Зеленият индикатор отдолу */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 5px; /* Малко над долния ръб */
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background-color: var(--trust-green); /* Твоето зелено */
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* Показване на индикатора при Hover и Active */
.nav-link:hover::after {
    width: 50%;
}

.nav-link.active::after {
    width: 70%; /* По-дълга линия за активния елемент */
}

/* Иконите в менюто */
.nav-link i {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
}

.nav-link:hover i, 
.nav-link.active i {
    color: var(--trust-green-light) !important; /* Иконата светва в зелено */
    transform: translateY(-1px);
}

/* Оправяне на Dropdown бутона да не се различава */
.navbar-nav .dropdown-toggle::after {
    vertical-align: middle;
    opacity: 0.7;
}

/* Twilio Balance Pill - Интеграция в Хедъра */
.twilio-balance-item {
    display: flex;
    align-items: center;
    margin-right: 1rem;
}

.balance-pill {
    background: rgba(255, 255, 255, 0.1); /* Полупрозрачен фон върху синия хедър */
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 0.35rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.balance-pill:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.balance-pill .status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.balance-pill .amount {
    color: #ffffff;
    font-weight: 600;
    font-family: 'Courier New', monospace; /* В тон с твоите цифри в stats-card */
}

.balance-pill .currency {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* Цветове според статуса, ползващи твоите променливи */
.balance-pill.healthy .status-indicator {
    background-color: var(--trust-green-light);
    box-shadow: 0 0 8px var(--trust-green);
}

.balance-pill.low-balance .status-indicator {
    background-color: var(--danger-red);
    box-shadow: 0 0 8px var(--danger-red);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* Профилен dropdown */
.nav-item.dropdown .nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-top: 0.5rem;
    min-width: 200px;
    z-index: 1050 !important; /* По-висок z-index от таблицата */
    position: absolute !important;
}

.dropdown-item-text {
    padding: 0.5rem 1rem;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--bg-light);
}

.dropdown-item i {
    margin-right: 0.5rem;
}

/* ============================================
   Контейнер
   ============================================ */

.main-container {
    max-width: 100%;
    margin: 2rem auto;
    padding: 0 1.5rem;
    width: 100%;
    overflow-x: hidden;
}

/* ============================================
   Статистика картички - Стил на документи
   ============================================ */

.stats-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    height: 100%;
    position: relative;
    overflow: hidden;
    border-left: 4px solid;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(0, 61, 130, 0.05) 0%, transparent 100%);
    border-radius: 0 0 0 100%;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--insurance-blue);
}

.stats-card.primary {
    border-left-color: var(--insurance-blue);
}

.stats-card.info {
    border-left-color: var(--insurance-blue-light);
}

.stats-card.warning {
    border-left-color: var(--warning-amber);
}

.stats-card.success {
    border-left-color: var(--trust-green);
}

.stats-card .card-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-card .card-title i {
    font-size: 1rem;
    color: var(--insurance-blue);
}

.stats-card h2 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--insurance-blue);
    margin: 0;
    line-height: 1.2;
    font-family: 'Courier New', monospace;
}

.stats-icon {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    font-size: 2.5rem;
    opacity: 0.15;
    color: var(--insurance-blue);
}

/* ============================================
   Основни картички - Стил на документи/Полици
   ============================================ */

.main-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    overflow: hidden;
}

.card-header-modern {
    background: linear-gradient(135deg, var(--insurance-blue) 0%, var(--insurance-blue-light) 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    border: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.card-header-modern::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--trust-green);
}

.card-header-modern.info {
    background: linear-gradient(135deg, var(--insurance-blue-light) 0%, #0066cc 100%);
}

.card-header-modern h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: 0.3px;
}

.card-header-modern i {
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem;
    border-radius: 6px;
}

.card-body-modern {
    padding: 1.5rem;
    background: var(--bg-white);
}

/* ============================================
   Таблици - Професионален стил
   ============================================ */

.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9375rem;
}

.table-modern thead {
    background: var(--bg-light);
    border-bottom: 2px solid var(--insurance-blue);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table-modern thead th {
    padding: 0.75rem 0.4rem;
    font-weight: 600;
    color: var(--insurance-blue);
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.2px;
    border-bottom: 2px solid var(--insurance-blue);
    white-space: normal;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
    line-height: 1.3;
    word-wrap: break-word;
}

.table-modern thead th:hover {
    background-color: rgba(0, 61, 130, 0.05);
}

.table-modern thead th.sortable {
    padding-right: 1.5rem;
}

.table-modern thead th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 0.5rem;
    font-size: 0.875rem;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.table-modern thead th.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: var(--insurance-blue);
}

.table-modern thead th.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: var(--insurance-blue);
}

.table-modern tbody tr {
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-white);
}

.table-modern tbody tr:hover {
    background: #f0f4f8;
    box-shadow: inset 3px 0 0 var(--insurance-blue);
}

.table-modern tbody tr:last-child {
    border-bottom: none;
}

.table-modern tbody td {
    padding: 0.75rem 0.4rem;
    vertical-align: middle;
    color: var(--text-primary);
    border-top: 1px solid var(--border-color);
    font-size: 0.8125rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Осигуряване, че всички бутони са видими */
.table-modern tbody td .btn-modern,
.table-modern tbody td .btn-icon-only,
.table-modern tbody td button {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    min-width: 2.5rem;
    min-height: 2.5rem;
}

/* Специално за бутона за история */
.view-logs {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Бутони за действия - хоризонтално подреждане */
.actions-buttons {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 0.25rem !important;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
    position: relative; /* За правилно позициониране на dropdown менютата */
}

/* Dropdown контейнер в таблицата */
.actions-buttons .dropdown {
    position: relative; /* За правилно позициониране */
}

/* Dropdown меню в таблицата - винаги видимо с висок z-index */
.table-modern .dropdown-menu {
    z-index: 9999 !important; /* Много висок z-index за да е винаги отгоре */
    position: absolute !important; /* JavaScript ще го промени на fixed когато е отворено */
    margin-top: 0.25rem;
}

/* Когато dropdown е отворен, използваме fixed позициониране */
.table-modern .dropdown-menu.show {
    position: fixed !important;
    z-index: 9999 !important;
}

.actions-buttons .btn-modern {
    flex-shrink: 0; /* Не позволяваме свиване на бутоните */
    display: inline-flex !important;
    min-width: auto;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    white-space: nowrap; /* Задържа текста на един ред */
}

.actions-buttons .btn-sm-modern {
    padding: 0.4rem 0.6rem;
    font-size: 0.7rem;
}

.actions-buttons .btn-icon-only {
    padding: 0.4rem;
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
}

.table-responsive-modern {
    border-radius: var(--radius);
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 70vh;
    border: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
    position: relative; /* За правилно позициониране на dropdown менютата */
}

/* Осигуряване, че таблицата не се скрива на десктоп */
@media (min-width: 769px) {
    .table-modern {
        width: 100%;
        table-layout: fixed; /* Fixed layout за еднаква ширина независимо от съдържанието */
        display: table !important;
        min-width: 100%; /* Минимална ширина за да се вижда всичко */
    }
    
    /* Фиксирани ширини на колоните за еднаква ширина на таблицата */
    .table-modern thead th:nth-child(1),
    .table-modern tbody td:nth-child(1) {
        width: 110px; /* Полица */
    }
    
    .table-modern thead th:nth-child(2),
    .table-modern tbody td:nth-child(2) {
        width: 100px; /* Рег. Номер */
    }
    
    .table-modern thead th:nth-child(3),
    .table-modern tbody td:nth-child(3) {
        width: 100px; /* Клиент */
    }
    
    .table-modern thead th:nth-child(4),
    .table-modern tbody td:nth-child(4) {
        width: 120px; /* Телефон */
    }
    
    .table-modern thead th:nth-child(5),
    .table-modern tbody td:nth-child(5) {
        width: 80px; /* Тип */
    }
    
    .table-modern thead th:nth-child(6),
    .table-modern tbody td:nth-child(6) {
        width: 100px; /* Начало */
    }
    
    .table-modern thead th:nth-child(7),
    .table-modern tbody td:nth-child(7) {
        width: 110px; /* Следващ падеж */
    }
    
    .table-modern thead th:nth-child(8),
    .table-modern tbody td:nth-child(8) {
        width: 110px; /* Дата за SMS */
    }
    
    .table-modern thead th:nth-child(9),
    .table-modern tbody td:nth-child(9) {
        width: 110px; /* Крайна дата */
    }
    
    .table-modern thead th:nth-child(10),
    .table-modern tbody td:nth-child(10) {
        width: 120px; /* Статус */
    }
    
    .table-modern thead th:nth-child(11),
    .table-modern tbody td:nth-child(11) {
        width: 220px; /* Действия - фиксирана ширина за да се поберат всички бутони на един ред */
        white-space: normal;
    }
    
    .table-modern thead {
        display: table-header-group !important;
    }
    
    .table-modern tbody {
        display: table-row-group !important;
    }
    
    .table-modern tbody tr {
        display: table-row !important;
    }
    
    .table-modern tbody td {
        display: table-cell !important;
    }
    
    .table-modern tbody td::before {
        display: none !important;
    }
    
    .table-responsive-modern {
        overflow-x: hidden !important; /* Премахване на хоризонтален скрол */
        overflow-y: auto;
        width: 100%;
        max-width: 100%;
    }
    
    /* Осигуряване, че таблицата не надхвърля контейнера */
    .table-modern {
        max-width: 100%;
        table-layout: fixed; /* Задържаме fixed layout за еднаква ширина */
    }
    
    /* Осигуряване, че контейнерът не причинява скрол */
    .main-container {
        max-width: 100% !important;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Осигуряване, че таблицата се вписва в контейнера */
    .table-responsive-modern {
        width: 100%;
        box-sizing: border-box;
    }
}

/* На мобилни устройства - картички стил */
@media (max-width: 768px) {
    .table-modern {
        width: 100%;
        display: block;
    }
}

.table-responsive-modern::-webkit-scrollbar {
    width: 10px;
}

.table-responsive-modern::-webkit-scrollbar-track {
    background: var(--bg-light);
}

.table-responsive-modern::-webkit-scrollbar-thumb {
    background: var(--insurance-blue);
    border-radius: 5px;
}

.table-responsive-modern::-webkit-scrollbar-thumb:hover {
    background: var(--insurance-blue-dark);
}

/* ============================================
   Статус баджове - Професионални етикети
   ============================================ */

.status-badge-modern {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 1px solid;
    white-space: nowrap;
}

.status-badge-modern i {
    font-size: 0.875rem;
}

.status-pending,
.status-expiring-soon {
    background: #fff3cd;
    color: #856404;
    border-color: #ffc107;
}

.status-paid,
.status-active {
    background: #d4edda;
    color: #155724;
    border-color: var(--trust-green);
}

.status-future {
    background: #d1ecf1;
    color: #0c5460;
    border-color: var(--insurance-blue-light);
}

.status-expired,
.status-overdue {
    background: #f8d7da;
    color: #721c24;
    border-color: var(--danger-red);
}

/* ============================================
   Бутони - Професионални действия
   ============================================ */

.btn-modern {
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    border: 1px solid;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.8125rem;
}

.btn-modern:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-success-modern {
    background: var(--trust-green);
    color: white;
    border-color: var(--trust-green);
}

.btn-success-modern:hover {
    background: #008f47;
    border-color: #008f47;
    color: white;
}

.btn-primary-modern {
    background: var(--insurance-blue);
    color: white;
    border-color: var(--insurance-blue);
}

.btn-primary-modern:hover {
    background: var(--insurance-blue-dark);
    border-color: var(--insurance-blue-dark);
    color: white;
}

.btn-info-modern {
    background: var(--insurance-blue-light);
    color: white;
    border-color: var(--insurance-blue-light);
}

.btn-info-modern:hover {
    background: var(--insurance-blue);
    border-color: var(--insurance-blue);
    color: white;
}

.btn-danger-modern {
    background: var(--danger-red);
    color: white;
    border-color: var(--danger-red);
}

.btn-danger-modern:hover {
    background: #b71c1c;
    border-color: #b71c1c;
    color: white;
}

.btn-warning-modern {
    background: var(--warning-amber);
    color: white;
    border-color: var(--warning-amber);
}

.btn-warning-modern:hover {
    background: #f57c00;
    border-color: #f57c00;
    color: white;
}

.btn-secondary-modern {
    background: var(--neutral-gray);
    color: white;
    border-color: var(--neutral-gray);
}

.btn-secondary-modern:hover {
    background: #5a6268;
    border-color: #5a6268;
    color: white;
}

.btn-secondary-modern.dropdown-toggle::after {
    margin-left: 0.5rem;
}

.dropdown-menu {
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0;
    z-index: 1050 !important; /* По-висок z-index от таблицата */
    position: absolute !important;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: var(--bg-light);
}

.dropdown-item i {
    margin-right: 0.5rem;
    width: 1.2rem;
}

.btn-sm-modern {
    padding: 0.4rem 0.75rem;
    font-size: 0.7rem;
    white-space: nowrap;
}

.btn-icon-only {
    padding: 0.375rem;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 0.875rem;
}

.btn-icon-only i {
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

/* ============================================
   Модални прозорци - Документи стил
   ============================================ */

.modal-content-modern {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header-modern {
    background: linear-gradient(135deg, var(--insurance-blue) 0%, var(--insurance-blue-light) 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    border: none;
    border-radius: 0;
    position: relative;
}

.modal-header-modern::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--trust-green);
}

.modal-header-modern .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.modal-header-modern .btn-close:hover {
    opacity: 1;
}

.modal-body-modern {
    padding: 1.5rem;
    background: var(--bg-white);
}

/* ============================================
   Алерти - Професионални известия
   ============================================ */

.alert-modern {
    border-radius: var(--radius);
    border: 1px solid;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.alert-modern.alert-success {
    background: #d4edda;
    border-color: var(--trust-green);
    color: #155724;
}

.alert-modern.alert-danger {
    background: #f8d7da;
    border-color: var(--danger-red);
    color: #721c24;
}

.alert-modern.alert-info {
    background: #d1ecf1;
    border-color: var(--insurance-blue-light);
    color: #0c5460;
}

.alert-modern.alert-warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.alert-modern i {
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* ============================================
   Форматиране на данни
   ============================================ */

.date-badge {
    background: var(--bg-light);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

.date-badge i {
    font-size: 0.875rem;
    color: var(--insurance-blue);
}

.phone-number {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--insurance-blue);
    font-size: 0.8125rem;
    white-space: nowrap;
}

.policy-number {
    font-weight: 700;
    color: var(--insurance-blue);
    font-family: 'Courier New', monospace;
    font-size: 0.8125rem;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* ============================================
   Празно състояние
   ============================================ */

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    color: var(--insurance-blue);
    opacity: 0.3;
    margin-bottom: 1.5rem;
}

.empty-state h5 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-weight: 600;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ============================================
   Форми - Професионален стил
   ============================================ */

.form-control,
.form-control-modern {
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.875rem 1.125rem;
    font-size: 0.9375rem;
    transition: all 0.3s ease;
    background: var(--bg-white);
    color: var(--text-primary);
    width: 100%;
    font-family: inherit;
    line-height: 1.5;
}

.form-control:hover,
.form-control-modern:hover {
    border-color: var(--insurance-blue-light);
    box-shadow: 0 2px 8px rgba(0, 61, 130, 0.08);
}

.form-control:focus,
.form-control-modern:focus {
    outline: none;
    border-color: var(--insurance-blue);
    box-shadow: 0 0 0 0.25rem rgba(0, 61, 130, 0.15);
    background: var(--bg-white);
}

.form-control::placeholder,
.form-control-modern::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.form-control-lg,
.form-control-modern-lg {
    padding: 1rem 1.25rem;
    font-size: 1rem;
}

.form-label,
.form-label-modern {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
    display: block;
}

/* Специални стилове за различни типове input */
input[type="number"].form-control-modern {
    -moz-appearance: textfield;
}

input[type="number"].form-control-modern::-webkit-outer-spin-button,
input[type="number"].form-control-modern::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="password"].form-control-modern {
    letter-spacing: 0.1em;
}

/* Form check switch - подобрен стил */
.form-check.form-switch {
    padding-left: 3rem;
    margin-bottom: 0;
}

.form-check-input {
    width: 3rem;
    height: 1.5rem;
    margin-top: 0.25rem;
    margin-left: -3rem;
    background-color: var(--neutral-gray);
    border: 2px solid var(--border-color);
    border-radius: 2rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--trust-green);
    border-color: var(--trust-green);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 166, 81, 0.25);
}

.form-check-label {
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1200px) {
    .table-modern {
        font-size: 0.875rem;
    }
    
    .table-modern thead th,
    .table-modern tbody td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 992px) {
    .stats-card h2 {
        font-size: 2rem;
    }
    
    .table-modern thead th {
        font-size: 0.7rem;
        padding: 0.75rem 0.5rem;
    }
    
    .table-modern tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8125rem;
    }
}

@media (max-width: 768px) {
    .main-container {
        padding: 0 1rem;
        margin: 1rem auto;
    }
    
    .stats-card {
        margin-bottom: 1rem;
    }
    
    .stats-card h2 {
        font-size: 1.75rem;
    }
    
    .stats-card .card-title {
        font-size: 0.75rem;
    }
    
    .card-header-modern h4 {
        font-size: 1.125rem;
    }
    
    .table-responsive-modern {
        max-height: 60vh;
    }
    
    .table-modern {
        font-size: 0.8125rem;
    }
    
    /* На мобилни устройства - картички стил */
    .table-modern thead {
        display: none;
    }
    
    .table-modern tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
        padding: 1rem;
        background: var(--bg-white);
        box-shadow: var(--shadow-sm);
    }
    
    /* Скрити редове на мобилни също трябва да останат скрити - МНОГО СИЛНИ ПРАВИЛА */
    .table-modern tbody tr[data-search-hidden="true"],
    .table-modern tbody tr.search-hidden {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        max-height: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        overflow: hidden !important;
        opacity: 0 !important;
    }
    
    .table-modern tbody tr[data-search-hidden="true"] td,
    .table-modern tbody tr.search-hidden td {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }
    
    .table-modern tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none;
        border-bottom: 1px solid var(--bg-light);
        flex-wrap: wrap;
    }
    
    .table-modern tbody td[data-label="Действия"] {
        justify-content: flex-start;
        gap: 0.5rem;
        border-bottom: none;
        padding-top: 0.75rem;
    }
    
    .table-modern tbody td:last-child {
        border-bottom: none;
    }
    
    .table-modern tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--insurance-blue);
        text-transform: uppercase;
        font-size: 0.7rem;
        letter-spacing: 0.5px;
        margin-right: 1rem;
        flex-shrink: 0;
        min-width: 120px;
    }
    
    /* Скриване на празни етикети */
    .table-modern tbody td:empty::before {
        display: none;
    }
    
    /* За колоната с действия - показваме всички бутони */
    .table-modern tbody td[data-label="Действия"]::before {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .table-modern tbody td[data-label="Действия"] .d-flex {
        width: 100%;
        justify-content: flex-start;
    }
    
    /* Осигуряване, че всички бутони са видими на мобилни */
    .table-modern tbody td[data-label="Действия"] .btn-modern,
    .table-modern tbody td[data-label="Действия"] .btn-icon-only,
    .table-modern tbody td[data-label="Действия"] button {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 2.5rem;
        height: 2.5rem;
    }
    
    .btn-icon-only {
        width: 2.5rem;
        height: 2.5rem;
        padding: 0.5rem;
        font-size: 1rem;
    }
    
    .d-flex.gap-2 {
        flex-wrap: wrap;
        gap: 0.5rem !important;
        justify-content: center;
    }
    
    .d-flex.gap-2 .btn-modern {
        flex: 0 0 auto;
        min-width: 2.5rem;
    }
    
    /* Бутоните за действия остават хоризонтални дори на мобилни */
    .actions-buttons {
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .actions-buttons .btn-modern {
        flex-shrink: 0;
    }
    
    .status-badge-modern {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
    
    .date-badge {
        font-size: 0.8125rem;
        padding: 0.25rem 0.5rem;
    }
    
    .policy-number,
    .phone-number {
        font-size: 0.875rem;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1rem;
    }
    
    .navbar-brand i {
        font-size: 1.25rem;
        padding: 0.375rem;
    }
    
    .stats-card {
        padding: 1rem;
    }
    
    .stats-card h2 {
        font-size: 1.5rem;
    }
    
    .card-body-modern {
        padding: 1rem;
    }
    
    .card-header-modern {
        padding: 1rem;
    }
    
    .card-header-modern h4 {
        font-size: 1rem;
    }
    
    .btn-modern {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 0.9375rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-body-modern {
        padding: 1rem;
    }
}

/* ============================================
   Анимации
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ============================================
   Зареждане
   ============================================ */

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(0, 61, 130, 0.2);
    border-radius: 50%;
    border-top-color: var(--insurance-blue);
    animation: spin 0.6s linear infinite;
}

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

/* ============================================
   Търсачка - Интерактивна
   ============================================ */

.search-container {
    margin-bottom: 1.5rem;
}

.search-input-group {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    background: var(--bg-white);
}

.search-input-group:focus-within {
    border-color: var(--insurance-blue);
    box-shadow: 0 0 0 0.25rem rgba(0, 61, 130, 0.15);
}

.search-icon {
    background: var(--bg-light);
    border: none;
    padding: 0.875rem 1.125rem;
    color: var(--insurance-blue);
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-input {
    border: none !important;
    padding: 0.875rem 1.125rem;
    font-size: 0.9375rem;
    flex: 1;
    box-shadow: none !important;
}

.search-input:focus {
    border: none !important;
    box-shadow: none !important;
    outline: none;
}

.clear-search-btn {
    border: none !important;
    border-left: 1px solid var(--border-color) !important;
    border-radius: 0 !important;
    padding: 0.875rem 1rem;
    background: var(--bg-light) !important;
    color: var(--text-muted) !important;
    transition: all 0.2s ease;
}

.clear-search-btn:hover {
    background: var(--danger-red) !important;
    color: white !important;
}

.search-results-info {
    margin-top: 0.75rem;
    padding-left: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.search-results-info small {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-results-info i {
    color: var(--insurance-blue);
}

/* Анимация при филтриране */
.table-modern tbody tr {
    transition: opacity 0.2s ease;
}

/* Скриване на редове при търсене - използваме data-атрибут за по-надеждно скриване */
.table-modern tbody tr[data-search-hidden="true"],
.table-modern tbody tr.search-hidden {
    display: none !important;
}

/* Осигуряване, че скритите редове остават скрити на всички екрани */
@media (min-width: 769px) {
    .table-modern tbody tr[data-search-hidden="true"],
    .table-modern tbody tr.search-hidden {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .table-modern tbody tr[data-search-hidden="true"],
    .table-modern tbody tr.search-hidden {
        display: none !important;
    }
}

/* Highlight на намерените резултати */
.search-highlight {
    background-color: #ffeb3b;
    color: var(--text-primary);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    animation: highlightPulse 0.3s ease;
}

@keyframes highlightPulse {
    0% {
        background-color: #fff9c4;
        transform: scale(1);
    }
    50% {
        background-color: #ffeb3b;
        transform: scale(1.05);
    }
    100% {
        background-color: #ffeb3b;
        transform: scale(1);
    }
}

/* ============================================
   Допълнителни елементи за застрахователна компания
   ============================================ */

.insurance-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.insurance-badge i {
    color: var(--insurance-blue);
}

.code-block {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--insurance-blue);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: var(--insurance-blue);
    display: inline-block;
}


/* ФИКС ЗА DROPDOWN МЕНЮТО В ХЕДЪРА */

/* 1. Премахваме рязането само за контейнера в навигацията */
.navbar .main-container {
    overflow: visible !important;
    margin: 0 auto; /* Премахваме margin-а, който в хедъра не е нужен */
}

/* 2. Уверяваме се, че колапсът на Bootstrap не реже съдържанието */
.navbar-collapse {
    overflow: visible !important;
}

/* 3. Корекция на dropdown позиционирането */
.navbar .dropdown-menu {
    position: absolute !important; /* Гарантира, че излиза от потока */
    top: 100%; /* Застава точно под бутона */
    right: 0;  /* Подравнява се вдясно */
    left: auto;
    margin-top: 5px; /* Малко разстояние от лентата */
    background-color: var(--bg-white) !important;
    z-index: 2000 !important; /* Да е над всичко останало */
}

/* 4. Фикс за мобилната версия */
@media (max-width: 991px) {
    .navbar-collapse {
        background: var(--insurance-blue);
        padding-bottom: 1rem;
    }
}


/* Модерен банер за нисък баланс */
.balance-alert-banner {
    background: linear-gradient(90deg, #fff5f5 0%, #fff 100%);
    border-left: 5px solid #dc3545;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-top: 20px;
    animation: slideInDown 0.5s ease-out;
}

.alert-icon-wrapper {
    width: 45px;
    height: 45px;
    background-color: #dc3545;
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 15px;
    flex-shrink: 0;
}

.btn-recharge {
    background-color: #dc3545;
    color: white;
    border-radius: 8px;
    padding: 8px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-recharge:hover {
    background-color: #bb2d3b;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}