@import url('/css/variables.css');

/* Matrix-inspired Dark Theme Dashboard */

/* Prevent horizontal overflow */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* Matrix Header Icon Layout */
/* Header right column positioning */
.matrix-header .col-auto {
    position: relative;
    overflow: visible;
}

/* Header Icons Container */
.header-icons {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative; /* Make this a positioning context */
}

.header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0; /* Prevent icons from shrinking */
}

.header-icon i {
    font-size: 1.25rem;
    color: var(--matrix-green);
    transition: all 0.3s ease;
}

.header-icon:hover {
    background: rgba(76, 175, 80, 0.2);
    border-color: var(--matrix-green-accent);
    transform: translateY(-2px);
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(105, 240, 174, 0.3);
}

.header-icon:hover i {
    color: var(--matrix-green-accent);
    text-shadow: 0 0 8px var(--matrix-green-accent);
}

.header-icon.active {
    background: rgba(76, 175, 80, 0.25);
    border-color: var(--matrix-green);
    box-shadow: 
        0 2px 12px rgba(0, 0, 0, 0.3),
        0 0 15px rgba(76, 175, 80, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.header-icon.active i {
    color: var(--matrix-green-accent);
    text-shadow: 0 0 10px var(--matrix-green-accent);
}

/* Tooltip-like behavior using title attribute - enhanced with CSS */
.header-icon[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -2.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(16, 24, 32, 0.95);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    z-index: 1002;
    border: 1px solid rgba(76, 175, 80, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    opacity: 0;
    animation: tooltipFade 0.3s ease forwards;
    max-width: calc(100vw - 2rem); /* Prevent tooltip overflow */
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes tooltipFade {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}
.matrix-header {
    background: linear-gradient(135deg, 
        rgba(16, 24, 32, 0.95), 
        rgba(16, 24, 32, 0.98));
    border-bottom: 2px solid var(--matrix-green);
    backdrop-filter: blur(10px);
    box-shadow: 
        0 2px 20px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(76, 175, 80, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 0;
    overflow: visible; /* Allow dropdowns to extend outside */
}

.matrix-logo {
    display: flex;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    color: var(--matrix-green);
}

.matrix-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
    margin-right: 1rem;
}

.matrix-version {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(76, 175, 80, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

/* User Dropdown Container */
.user-info-compact {
    position: absolute;
    top: 100%;
    right: 0; /* Position relative to user icon */
    z-index: 1001;
    width: 0; /* Prevent affecting layout */
    height: 0; /* Prevent affecting layout */
    overflow: visible;
}

/* User Select - inherits stats-dropdown styling */
.user-list {
    width: 100%;
}

.user-option {
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(76, 175, 80, 0.1);
    user-select: none;
}

.user-option:last-child {
    border-bottom: none;
}

.user-option:hover {
    background: rgba(76, 175, 80, 0.15);
    color: var(--matrix-green-accent);
    transform: translateX(5px);
    box-shadow: inset 4px 0 0 var(--matrix-green);
}

.user-option.selected {
    background: rgba(76, 175, 80, 0.2);
    color: var(--matrix-green-accent);
    font-weight: 600;
    box-shadow: inset 4px 0 0 var(--matrix-green);
}

/* Statistics Info Compact */
.stats-info-compact {
    position: relative;
    display: flex;
    align-items: center;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
}

/* Statistics Display (clickable area) */
.stats-display {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 6px;
    transition: all 0.3s ease;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.2);
    min-width: 140px;
    justify-content: space-between;
}

.stats-display:hover {
    background: rgba(76, 175, 80, 0.15);
    border-color: var(--matrix-green-accent);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 20px rgba(105, 240, 174, 0.3),
        0 4px 15px rgba(0, 0, 0, 0.4);
}

.stats-display.active {
    background: rgba(76, 175, 80, 0.2);
    border-color: var(--matrix-green);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 15px rgba(76, 175, 80, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

.stats-icon {
    color: var(--matrix-green-accent);
    font-size: 1.1rem;
    margin-right: 0.5rem;
}

.stats-label {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* Stats Dropdown Container */
.stats-info-compact {
    position: absolute;
    top: 100%;
    right: 4rem; /* Position relative to stats icon */
    z-index: 1001;
    width: 0; /* Prevent affecting layout */
    height: 0; /* Prevent affecting layout */
    overflow: visible;
}

.stats-dropdown {
    position: absolute;
    top: 0.5rem;
    right: 0;
    background: rgba(16, 24, 32, 0.95);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 8px;
    width: clamp(280px, 90vw, 450px); /* Responsive width that doesn't overflow */
    max-width: calc(100vw - 2rem); /* Ensure it never exceeds viewport */
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 8px 25px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(76, 175, 80, 0.2);
    backdrop-filter: blur(10px);
    padding: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top right; /* Ensure transform doesn't cause overflow */
}

.stats-dropdown.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 1, 1);
}

.stats-dropdown:not(.hidden) {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Stats Summary Cards in Header */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
}

.stats-summary .summary-card {
    background: rgba(76, 175, 80, 0.05);
    border: 1px solid rgba(76, 175, 80, 0.2);
    border-radius: 6px;
    padding: 0.75rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stats-summary .summary-card:hover {
    background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.stats-summary .summary-card .card-body {
    padding: 0;
}

.stats-summary .summary-card i {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.stats-summary .summary-card .display-6 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.stats-summary .summary-card .text-muted {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* User Display (clickable area) */
.user-display {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 6px;
    transition: all 0.3s ease;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    justify-content: space-between;
}

.user-display:hover {
    background: rgba(76, 175, 80, 0.15);
    border-color: var(--matrix-green-accent);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 20px rgba(105, 240, 174, 0.3),
        0 4px 15px rgba(0, 0, 0, 0.4);
}

.user-display.active {
    background: rgba(76, 175, 80, 0.2);
    border-color: var(--matrix-green);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 15px rgba(76, 175, 80, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.3);
}

.user-icon {
    color: var(--matrix-green-accent);
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

.user-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.dropdown-arrow {
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.user-display.active .dropdown-arrow {
    transform: rotate(180deg);
}

.user-select-compact {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    border-radius: 0 0 6px 6px;
    border-top: none;
    transition: all 0.3s ease;
    z-index: 1001;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.user-select-compact.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
}

.user-select-compact:not(.hidden) {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Adjust container top margin to account for fixed header */
.container {
    margin-top: 2rem;
}

/* Responsive header adjustments */
@media (max-width: 768px) {
    .matrix-header {
        padding: 0.75rem 0;
    }
    
    .matrix-title {
        font-size: 1.2rem;
        letter-spacing: 1px;
        margin-right: 0.5rem;
    }
    
    .matrix-version {
        font-size: 0.7rem;
        padding: 0.15rem 0.4rem;
    }
    
    .header-icon {
        width: 2.25rem;
        height: 2.25rem;
    }
    
    .header-icon i {
        font-size: 1.1rem;
    }
    
    .stats-dropdown {
        width: clamp(250px, 85vw, 350px);
        right: 0;
    }
}

@media (max-width: 576px) {
    .matrix-header .row {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .matrix-title {
        font-size: 1rem;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .header-icons {
        justify-content: center;
        gap: 1.5rem;
    }
    
    .header-icon {
        width: 2rem;
        height: 2rem;
    }
    
    .header-icon i {
        font-size: 1rem;
    }
    
    .stats-info-compact {
        right: 0;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .stats-dropdown {
        width: clamp(220px, 90vw, 280px);
        left: 0;
        right: auto;
        transform: none;
    }
    
    .stats-dropdown.hidden {
        transform: translateY(-10px);
    }
    
    .stats-dropdown:not(.hidden) {
        transform: translateY(0);
    }
    
    .user-info-compact {
        right: 0;
        left: 50%;
        transform: translateX(-50%);
    }
    
    /* Ensure dropdowns don't extend beyond screen on mobile */
    .stats-summary {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.5rem;
    }
}

/* Enhanced glow effects for Matrix theme */
.matrix-logo:hover .matrix-title {
    text-shadow: 
        0 0 15px rgba(76, 175, 80, 0.8),
        0 0 30px rgba(76, 175, 80, 0.4),
        0 0 45px rgba(76, 175, 80, 0.2);
    transition: text-shadow 0.3s ease;
}

/* Category Badge Styles - Allow dynamic category colors to override */
.category-badge {
    display: inline-block;
    padding: 0.35rem 0.8rem;
    /* Background and color will be set dynamically from CSS variables */
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    border-width: 1px;
    border-style: solid;
}

.category-badge:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
    opacity: 0.9;
}

/* Clickable elements common styles */
.category-clickable,
.amount-clickable,
.date-clickable {
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: all 0.3s ease;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    /* Убираем бордеры в неактивном состоянии */
    background: transparent;
    border: 1px solid transparent;
}

.category-clickable {
    /* Category gets dynamic background from chart colors */
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: all 0.3s ease;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
}

.amount-clickable {
    /* Прозрачный фон для суммы */
    background: transparent;
    border: 1px solid transparent;
    /* Цвет суммы будет определяться классом валюты */
}

.date-clickable {
    /* Прозрачный фон для даты */
    background: transparent;
    border: 1px solid transparent;
}

.category-clickable:hover {
    transform: translateY(-1px);
    filter: brightness(1.15);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.amount-clickable:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 15px rgba(255, 255, 255, 0.1);
}

.amount-clickable:hover .currency-label {
    opacity: 1;
}

.date-clickable:hover {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 193, 7, 0.25));
    border-color: rgba(255, 193, 7, 0.5);
    transform: translateY(-1px);
    box-shadow: 
        0 4px 12px rgba(255, 193, 7, 0.3),
        inset 0 1px 0 rgba(255, 193, 7, 0.4),
        0 0 15px rgba(255, 193, 7, 0.2);
}

/* Edit icons - только для категории */
.category-edit-icon {
    opacity: 0;
    font-size: 0.7rem;
    transition: opacity 0.3s ease;
    margin-left: 0.3rem;
}

.category-clickable:hover .category-edit-icon {
    opacity: 0.7;
}

/* Editing state */
.editing {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Quick edit form elements */
.quick-edit-select,
.quick-edit-input {
    background: rgba(26, 26, 26, 0.95) !important;
    border: 2px solid #00ff41 !important;
    color: #e0e0e0 !important;
    border-radius: 4px !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 12px !important;
    padding: 4px 8px !important;
    box-shadow: 
        0 0 15px rgba(0, 255, 65, 0.4),
        inset 0 1px 0 rgba(0, 255, 65, 0.2) !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    z-index: 9999 !important;
}

.quick-edit-select {
    min-width: 200px !important;
    max-height: none !important;
    overflow: visible !important;
}

.quick-edit-input {
    min-width: 100px !important;
}

.quick-edit-select:focus,
.quick-edit-input:focus {
    outline: none !important;
    box-shadow: 
        0 0 20px rgba(0, 255, 65, 0.6),
        inset 0 1px 0 rgba(0, 255, 65, 0.3) !important;
    border-color: rgba(0, 255, 255, 0.8) !important;
    z-index: 10000 !important;
}

/* Ensure dropdown is visible */
.quick-edit-select {
    appearance: auto !important;
    -webkit-appearance: menulist !important;
    -moz-appearance: menulist !important;
}

.quick-edit-select option {
    background: #1a1a1a !important;
    color: #e0e0e0 !important;
    padding: 8px 12px !important;
    border: none !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    min-height: 30px !important;
}

.quick-edit-select option:hover,
.quick-edit-select option:focus,
.quick-edit-select option:checked {
    background: rgba(0, 255, 65, 0.15) !important;
    color: #00ff41 !important;
}

/* Force table cell to not clip dropdown */
.editing {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
    position: relative !important;
    z-index: 9998 !important;
}

/* Ensure table row doesn't clip */
table tbody tr {
    position: relative;
}

.editing select {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 10001 !important;
    box-shadow: 
        0 0 25px rgba(0, 255, 65, 0.6),
        0 8px 32px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(0, 255, 65, 0.3) !important;
}

/* Table container: allow horizontal scroll, vertical overflow for dropdowns */
.table-responsive {
    overflow-x: auto;
    overflow-y: visible;
}

/* Table cells: clip long text by default, specific cells can override */
table td {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ensure dropdown is always on top */
.quick-edit-select[size] {
    position: absolute !important;
    z-index: 10002 !important;
    background: rgba(15, 15, 15, 0.98) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 2px solid #00ff41 !important;
    border-radius: 8px !important;
    box-shadow: 
        0 0 30px rgba(0, 255, 65, 0.7),
        0 10px 40px rgba(0, 0, 0, 0.9),
        inset 0 1px 0 rgba(0, 255, 65, 0.4) !important;
    max-height: 280px !important;
    overflow-y: auto !important;
}

/* Enhanced animations */
@keyframes quickEditGlow {
    0%, 100% {
        box-shadow: 
            0 2px 8px rgba(0, 255, 65, 0.2),
            inset 0 1px 0 rgba(0, 255, 65, 0.3);
    }
    50% {
        box-shadow: 
            0 4px 12px rgba(0, 255, 65, 0.4),
            inset 0 1px 0 rgba(0, 255, 65, 0.4),
            0 0 20px rgba(0, 255, 65, 0.3);
    }
}

.category-clickable:active,
.amount-clickable:active,
.date-clickable:active {
    animation: quickEditGlow 0.6s ease;
    transform: translateY(0);
}

/* Amount-specific styles */
.amount-clickable {
    font-weight: bold;
    font-size: 1rem;
    color: var(--matrix-kzt) !important; /* Мягкий синий цвет */
}

/* Currency label styles - цвет определяется классом валюты */
.currency-label {
    font-weight: 600;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    opacity: 0.8;
    text-transform: uppercase;
}

/* Date-specific styles */
.date-clickable {
    font-size: 0.9rem;
    color: #a0a0a0 !important; /* Мягкий серый цвет вместо ярко-желтого */
}

.date-clickable:hover {
    color: #ffc107 !important; /* Приятный желтый при hover */
}

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&family=Orbitron:wght@400;700;900&display=swap');

/* Enhanced Matrix Modal Styles */
.matrix-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.4s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.matrix-modal-overlay.show {
  opacity: 1;
}

.matrix-modal {
  background: linear-gradient(135deg, 
    rgba(26, 26, 26, 0.95) 0%, 
    rgba(17, 17, 17, 0.98) 50%, 
    rgba(26, 26, 26, 0.95) 100%);
  border: 2px solid var(--matrix-green);
  border-radius: 16px;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  box-shadow: 
    0 25px 80px rgba(0, 0, 0, 0.7),
    0 0 50px var(--matrix-green-glow),
    inset 0 1px 0 rgba(0, 255, 65, 0.3),
    inset 0 -1px 0 rgba(0, 255, 65, 0.1);
  max-width: 520px;
  width: 90%;
  transform: scale(0.7) translateY(100px) rotateX(15deg);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.matrix-modal-overlay.show .matrix-modal {
  transform: scale(1) translateY(0) rotateX(0deg);
}

.matrix-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(0, 255, 65, 0.15), 
    transparent);
  animation: modalScan 4s ease-in-out infinite;
}

.matrix-modal::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(0, 255, 65, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(0, 255, 255, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 1;
}

@keyframes modalScan {
  0% { left: -100%; }
  50% { left: 100%; }
  100% { left: 100%; }
}

.matrix-modal-header {
  padding: 1.8rem 2.5rem 1.5rem;
  border-bottom: 1px solid rgba(0, 255, 65, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 255, 65, 0.08);
  position: relative;
  z-index: 2;
}

.matrix-modal-header h4 {
  margin: 0;
  color: var(--text-secondary);
  font-family: var(--font-futuristic);
  font-size: 1.4rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.matrix-modal-close {
  background: none;
  border: none;
  color: var(--matrix-green);
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  position: relative;
  z-index: 3;
}

.matrix-modal-close:hover {
  background: var(--btn-delete-hover);
  color: var(--btn-delete);
  box-shadow: 0 0 15px rgba(239, 83, 80, 0.3);
  transform: rotate(90deg);
}

.matrix-modal-body {
  padding: 2.5rem;
  position: relative;
  z-index: 2;
}

.delete-warning {
  text-align: center;
}

.delete-warning i {
  font-size: 4rem;
  color: var(--matrix-yellow);
  margin-bottom: 1.5rem;
  text-shadow: 
    0 0 25px rgba(255, 255, 0, 0.6),
    0 0 50px rgba(255, 255, 0, 0.3);
  animation: pulseWarning 2.5s ease-in-out infinite;
}

@keyframes pulseWarning {
  0%, 100% { 
    transform: scale(1);
    text-shadow: 
      0 0 25px rgba(255, 255, 0, 0.6),
      0 0 50px rgba(255, 255, 0, 0.3);
  }
  50% { 
    transform: scale(1.1);
    text-shadow: 
      0 0 35px rgba(255, 255, 0, 0.8),
      0 0 70px rgba(255, 255, 0, 0.5);
  }
}

.text-truncate {
    display: block; /* Ensure it takes up the full width */
    white-space: nowrap; /* Prevent text from wrapping to the next line */
    overflow: hidden; /* Hide any overflowing content */
    text-overflow: ellipsis; /* Add an ellipsis (...) when text is truncated */
}

.delete-warning p {
  color: var(--matrix-white);
  margin-bottom: 1.5rem;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  line-height: 1.6;
}

.expense-preview {
  background: linear-gradient(135deg, 
    rgba(76, 175, 80, 0.08) 0%, 
    rgba(76, 175, 80, 0.04) 100%);
  border: 1px solid var(--matrix-green);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  color: var(--matrix-green);
  font-family: var(--font-mono);
  word-break: break-word;
  position: relative;
  overflow: hidden;
  box-shadow: 
    inset 0 1px 0 rgba(76, 175, 80, 0.15),
    0 0 8px rgba(76, 175, 80, 0.1);
}

.expense-preview::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent, 
    var(--matrix-green), 
    transparent);
  animation: previewGlow 3s ease-in-out infinite;
}

@keyframes previewGlow {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.warning-text {
  color: var(--matrix-red) !important;
  font-size: 1rem;
  font-style: italic;
  font-weight: 500;
  text-shadow: 0 0 10px rgba(255, 0, 64, 0.3);
}

.matrix-modal-footer {
  padding: 1.5rem 2.5rem 2rem;
  border-top: 1px solid rgba(0, 255, 65, 0.3);
  display: flex;
  gap: 1.2rem;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 2;
}

/* Enhanced Matrix Button Styles */
.btn-matrix-secondary {
  background: linear-gradient(135deg, 
    rgba(76, 175, 80, 0.08) 0%, 
    rgba(76, 175, 80, 0.12) 100%);
  border: 2px solid var(--matrix-green);
  color: var(--matrix-green);
  font-family: var(--font-futuristic);
  font-weight: 600;
  padding: 0.8rem 1.8rem;
  border-radius: 10px;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.15);
}

.btn-matrix-secondary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 255, 255, 0.2), 
    transparent);
  transition: left 0.5s ease;
}

.btn-matrix-secondary:hover::before {
  left: 100%;
}

.btn-matrix-secondary:hover {
  background: linear-gradient(135deg, 
    rgba(76, 175, 80, 0.15) 0%, 
    rgba(76, 175, 80, 0.2) 100%);
  box-shadow: 0 6px 25px rgba(76, 175, 80, 0.25);
  color: var(--matrix-green-light);
  transform: translateY(-3px);
  border-color: var(--matrix-green-light);
}

.btn-matrix-danger {
  background: linear-gradient(135deg, 
    rgba(239, 83, 80, 0.12) 0%, 
    rgba(239, 83, 80, 0.15) 100%);
  border: 2px solid var(--btn-delete);
  color: var(--btn-delete);
  font-family: var(--font-futuristic);
  font-weight: 600;
  padding: 0.8rem 1.8rem;
  border-radius: 10px;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(239, 83, 80, 0.2);
}

.btn-matrix-danger::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 255, 255, 0.2), 
    transparent);
  transition: left 0.5s ease;
}

.btn-matrix-danger:hover::before {
  left: 100%;
}

.btn-matrix-danger:hover {
  background: linear-gradient(135deg, 
    rgba(239, 83, 80, 0.2) 0%, 
    rgba(239, 83, 80, 0.25) 100%);
  box-shadow: 0 6px 25px rgba(239, 83, 80, 0.3);
  color: #ff6b6b;
  transform: translateY(-3px);
  border-color: #ff6b6b;
}

/* Enhanced Matrix Notifications */
.matrix-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--glass-bg);
  border: 2px solid var(--matrix-green);
  border-radius: 12px;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  padding: 1.2rem 1.8rem;
  max-width: 420px;
  z-index: 10000;
  transform: translateX(450px);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 
    0 15px 40px rgba(0, 0, 0, 0.4),
    0 0 15px rgba(76, 175, 80, 0.15);
  position: relative;
  overflow: hidden;
}

.matrix-notification::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(76, 175, 80, 0.05), 
    transparent);
  animation: notificationScan 4s ease-in-out infinite;
}

@keyframes notificationScan {
  0% { left: -100%; }
  50% { left: 100%; }
  100% { left: 100%; }
}

.matrix-notification.show {
  transform: translateX(0) scale(1);
}

.matrix-notification.matrix-notification-success {
  border-color: var(--matrix-green);
  box-shadow: 
    0 15px 40px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(76, 175, 80, 0.2);
}

.matrix-notification.matrix-notification-error {
  border-color: var(--btn-delete);
  box-shadow: 
    0 15px 40px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(239, 83, 80, 0.25);
}

.matrix-notification.matrix-notification-error::before {
  background: linear-gradient(90deg, 
    transparent, 
    rgba(239, 83, 80, 0.05), 
    transparent);
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--matrix-white);
  font-family: var(--font-mono);
  font-size: 1rem;
  position: relative;
  z-index: 2;
}

.notification-content i {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.matrix-notification-success .notification-content i {
  color: var(--matrix-green);
  text-shadow: 
    0 0 15px var(--matrix-green-glow),
    0 0 30px rgba(0, 255, 65, 0.3);
}

.matrix-notification-error .notification-content i {
  color: var(--matrix-red);
  text-shadow: 
    0 0 15px rgba(255, 0, 64, 0.5),
    0 0 30px rgba(255, 0, 64, 0.3);
}

.notification-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: none;
  border: none;
  color: var(--matrix-gray);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 6px;
  transition: all 0.3s ease;
  z-index: 3;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-close:hover {
  color: var(--matrix-red);
  background: rgba(255, 0, 64, 0.15);
  box-shadow: 0 0 10px rgba(255, 0, 64, 0.3);
  transform: rotate(90deg);
}

/* Fixed Table Layout - Comprehensive Fix */
.table-responsive {
  border-radius: 12px;
  overflow-x: auto;
  overflow-y: visible;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-width: 100%;
  min-height: 200px;
  position: relative;
}

@keyframes tableScan {
  0%, 100% { left: -100%; }
  50% { left: 100%; }
}

/* Table Structure */
.table {
  margin-bottom: 0;
  width: 100%;
  min-width: 810px; /* Decreased width for 6 columns instead of 7 */
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text-primary);
  font-family: var(--font-mono);
  background: transparent;
}

/* Fixed Column Widths */
.table th:nth-child(1), .table td:nth-child(1) { width: 130px; } /* Date */
.table th:nth-child(2), .table td:nth-child(2) { width: 130px; } /* Amount */
.table th:nth-child(3), .table td:nth-child(3) { width: 225px; } /* Category - 1.5x wider */
.table th:nth-child(4), .table td:nth-child(4) { width: 120px; } /* Tags */
.table th:nth-child(5), .table td:nth-child(5) { width: auto; min-width: 310px; } /* Description - expanded */
.table th:nth-child(6), .table td:nth-child(6) { width: 160px; } /* Actions - wider for 3 buttons */

/* Table Cell Styling */
.table th,
.table td {
  border: none;
  border-bottom: 1px solid rgba(76, 175, 80, 0.08);
  padding: 0.75rem 0.5rem;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Description column can wrap */
.table th:nth-child(5), .table td:nth-child(5) {
  white-space: normal;
  word-wrap: break-word;
  padding-right: 1rem;
}

/* Header Styling */
.table th {
  background: rgba(76, 175, 80, 0.08);
  color: var(--text-secondary);
  font-family: var(--font-futuristic);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.85rem;
  border-bottom: 2px solid var(--matrix-green);
  position: sticky;
  top: 0;
  z-index: 10;
}

.table th:first-child {
  border-top-left-radius: 12px;
}

.table th:last-child {
  border-top-right-radius: 12px;
}

/* Body Row Styling */
.table tbody {
  background: rgba(26, 26, 26, 0.4);
}

.table tbody tr {
  background: var(--card-bg-gradient-start);
  transition: all 0.2s ease;
  border: none;
  position: relative;
}

.table tbody tr:nth-child(odd) {
  background: var(--card-bg-gradient-end);
}



.table tbody tr:last-child td {
  border-bottom: 2px solid var(--matrix-green);
}

.table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 12px;
}

.table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 12px;
}

/* Enhanced Action Buttons Container */
.actions-container {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
  padding: 0.25rem 0;
}

.btn-action {
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  font-size: 0.8rem;
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.btn-outline-primary.btn-action {
  border-color: var(--btn-edit);
  color: var(--btn-edit);
  background: rgba(38, 166, 154, 0.08);
}

.btn-outline-primary.btn-action:hover {
  background: var(--btn-edit-hover);
  border-color: var(--btn-edit);
  box-shadow: 0 0 8px rgba(38, 166, 154, 0.3);
  color: var(--btn-edit);
}

.btn-outline-danger.btn-action {
  border-color: var(--btn-delete);
  color: var(--btn-delete);
  background: rgba(239, 83, 80, 0.08);
}

.btn-outline-danger.btn-action:hover {
  background: var(--btn-delete-hover);
  border-color: var(--btn-delete);
  box-shadow: 0 0 8px rgba(239, 83, 80, 0.3);
  color: var(--btn-delete);
}

.btn-outline-success.btn-action {
  border-color: rgba(0, 255, 65, 0.6);
  color: var(--matrix-green);
  background: rgba(0, 255, 65, 0.05);
}

.btn-outline-success.btn-action:hover {
  background: rgba(76, 175, 80, 0.12);
  border-color: var(--matrix-green);
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.25);
  color: var(--matrix-green);
}

.btn-outline-secondary.btn-action {
  border-color: rgba(128, 128, 128, 0.4);
  color: var(--matrix-gray);
  background: rgba(128, 128, 128, 0.05);
  opacity: 0.6;
}

.btn-outline-secondary.btn-action:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

/* Investment Table Column Widths */
.table[data-table="investments"] th:nth-child(1),
.table[data-table="investments"] td:nth-child(1) { width: 130px; } /* Type */
.table[data-table="investments"] th:nth-child(2),
.table[data-table="investments"] td:nth-child(2) { width: 200px; } /* Name */
.table[data-table="investments"] th:nth-child(3),
.table[data-table="investments"] td:nth-child(3) { width: 170px; } /* Invested */
.table[data-table="investments"] th:nth-child(4),
.table[data-table="investments"] td:nth-child(4) { width: 80px; }  /* Rate */
.table[data-table="investments"] th:nth-child(5),
.table[data-table="investments"] td:nth-child(5) { width: 120px; } /* Income */
.table[data-table="investments"] th:nth-child(6),
.table[data-table="investments"] td:nth-child(6) { width: 110px; } /* Actions */

/* Investment Link Styles */
.investment-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  background: rgba(0, 188, 212, 0.1);
  border: 1px solid rgba(0, 188, 212, 0.3);
  border-radius: 6px;
  color: var(--matrix-cyan);
  text-decoration: none;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  transition: all 0.3s ease;
  max-width: 150px;
}

.investment-link:hover {
  background: rgba(0, 188, 212, 0.2);
  border-color: var(--matrix-cyan);
  color: var(--matrix-cyan);
  box-shadow: 0 0 10px rgba(0, 188, 212, 0.3);
  transform: translateY(-1px);
  text-decoration: none;
}

.investment-link .investment-type-icon {
  font-size: 0.8rem;
  opacity: 0.9;
}

.investment-link .investment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100px;
}

/* Investment Analytics Modal Styles */
#investmentAnalyticsModal .modal-content {
  background: var(--matrix-bg);
  border: 1px solid var(--matrix-green);
  box-shadow: 0 0 30px rgba(0, 255, 65, 0.2);
}

#investmentAnalyticsModal .modal-header {
  background: linear-gradient(135deg, rgba(16, 24, 32, 0.98), rgba(16, 24, 32, 0.95));
  border-bottom: 1px solid var(--matrix-green);
}

#investmentAnalyticsModal .modal-title {
  color: var(--matrix-green);
  font-family: var(--font-mono);
}

#investmentAnalyticsModal .modal-footer {
  border-top: 1px solid rgba(0, 255, 65, 0.2);
}

#investmentAnalyticsModal .card {
  border: 1px solid rgba(0, 255, 65, 0.2);
}

#investmentAnalyticsModal .card-header {
  background: rgba(0, 255, 65, 0.05);
  border-bottom: 1px solid rgba(0, 255, 65, 0.2);
}

#investmentAnalyticsModal .card-header h6 {
  color: var(--matrix-green);
  margin: 0;
}

/* Receipt Modal Styles */
.receipt-modal {
  max-width: 800px;
  width: 95%;
}

.receipt-body {
  text-align: center;
  max-height: 70vh;
  overflow-y: auto;
}

.loading-receipt {
  padding: 2rem;
  color: var(--matrix-green);
}

.loading-receipt i {
  font-size: 2rem;
  margin-bottom: 1rem;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Actions column alignment */
.table td:last-child {
  text-align: center;
  padding: 0.5rem;
}

/* Category Badge Improvements */
.category-badge {
  background: rgba(0, 255, 65, 0.2);
  color: var(--matrix-green);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  border: 1px solid rgba(0, 255, 65, 0.3);
  white-space: nowrap;
}

/* Source Badge Improvements */
.source-telegram {
  background: rgba(0, 255, 255, 0.2);
  color: var(--matrix-cyan);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(0, 255, 255, 0.3);
}

.source-websocket_test {
  background: rgba(255, 255, 0, 0.2);
  color: var(--matrix-yellow);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255, 255, 0, 0.3);
}

/* Import CSS Variables */


* {
  box-sizing: border-box;
}

body {
  background: var(--matrix-bg);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 300;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  position: relative;
}

/* Matrix Background Animation - Softened */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 80%, rgba(76, 175, 80, 0.02) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(79, 195, 247, 0.02) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(76, 175, 80, 0.01) 0%, transparent 50%);
  z-index: -2;
  animation: matrixGlow 12s ease-in-out infinite alternate;
}

@keyframes matrixGlow {
  0% { opacity: 0.3; }
  100% { opacity: 0.6; }
}

/* Scrolling Code Animation - Softened */
body::after {
  content: '01001000 01100101 01101100 01101100 01101111 00100000 01001101 01100001 01110100 01110010 01101001 01111000';
  position: fixed;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(76, 175, 80, 0.02);
  white-space: pre;
  z-index: -1;
  animation: matrixScroll 40s linear infinite;
  pointer-events: none;
  line-height: 2;
}

@keyframes matrixScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(50%); }
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

/* Headers */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-futuristic);
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.5rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
  color: var(--matrix-green-accent);
  text-shadow: 0 0 15px rgba(105, 240, 174, 0.4);
}

h1::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--matrix-green), transparent);
  opacity: 0.7;
}

/* Cards */
.card {
  background: linear-gradient(135deg, 
    var(--card-bg-gradient-start) 0%, 
    var(--card-bg-gradient-end) 100%);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(76, 175, 80, 0.08);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(76, 175, 80, 0.05), transparent);
  transition: left 0.5s ease;
}

.card:hover::before {
  left: 100%;
}

.card:hover {
  border-color: var(--matrix-green);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.4),
    0 0 15px rgba(76, 175, 80, 0.15),
    inset 0 1px 0 rgba(76, 175, 80, 0.12);
  transform: translateY(-2px);
}

.card-header {
  background: rgba(76, 175, 80, 0.06);
  border-bottom: 1px solid var(--card-border);
  padding: 1rem 1.5rem;
  font-family: var(--font-futuristic);
  font-weight: 700;
  color: var(--text-secondary);
}

.card-body {
  padding: 1.5rem;
}

/* Summary Cards */
.summary-card {
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--matrix-green), var(--matrix-cyan));
  opacity: 0.6;
}

.summary-card .card-body {
  padding: 2rem 1rem;
}

.summary-card i {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--matrix-green);
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.display-6 {
  font-family: var(--font-futuristic);
  font-size: 2rem;
  font-weight: 700;
  color: var(--matrix-green);
}

/* Forms */
.form-control, .form-select {
  background: var(--matrix-bg-tertiary);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
  background: var(--matrix-bg-tertiary);
  border-color: var(--matrix-green);
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.2);
  color: var(--text-primary);
  outline: none;
}

.form-select option {
  background: var(--matrix-bg-tertiary);
  color: var(--text-primary);
  padding: 8px 12px;
}

.form-select option:hover,
.form-select option:focus,
.form-select option:checked {
  background: rgba(76, 175, 80, 0.1);
  color: var(--matrix-green);
}

.form-control::placeholder {
  color: var(--matrix-gray);
}

.form-label {
  color: var(--text-secondary);
  font-family: var(--font-futuristic);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* Buttons */
.btn {
  font-family: var(--font-futuristic);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  border: none;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--matrix-green), var(--matrix-green-dark));
  color: var(--matrix-bg);
  box-shadow: 0 4px 15px rgba(0, 255, 65, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--matrix-green-light), var(--matrix-green));
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.25);
  transform: translateY(-2px);
}

.btn-outline-primary {
  background: transparent;
  border: 2px solid var(--matrix-green);
  color: var(--matrix-green);
}

.btn-outline-primary:hover {
  background: var(--matrix-green);
  color: var(--matrix-bg);
  box-shadow: 0 0 15px rgba(76, 175, 80, 0.2);
}

.btn-danger {
  background: linear-gradient(135deg, var(--btn-delete), #d32f2f);
  color: white;
  box-shadow: 0 4px 15px rgba(239, 83, 80, 0.25);
}

.btn-success {
  background: linear-gradient(135deg, var(--matrix-green), var(--matrix-green-dark));
  color: var(--matrix-bg);
  box-shadow: 0 4px 15px rgba(0, 255, 65, 0.3);
}

/* Table styles consolidated above - no duplicates */

/* Table body cell styling - consolidated */

/* Table wrapper and basic structure - no duplicates */

/* Enhanced category badges for table */
.table .category-badge {
  background: linear-gradient(45deg, var(--matrix-green), var(--matrix-green-dark));
  color: var(--matrix-bg);
  border: 1px solid var(--matrix-green);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
  transition: all 0.2s ease;
  display: inline-block;
}

.table .category-badge:hover {
  background: linear-gradient(45deg, var(--matrix-cyan), var(--matrix-green));
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
  /* Remove transform to prevent layout shift */
  /* transform: scale(1.05); */
}

/* Source badges styling */
.table .source-telegram {
  background: linear-gradient(45deg, var(--matrix-cyan), #0099cc);
  color: var(--matrix-bg);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 1px solid var(--matrix-cyan);
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

.table .source-websocket_test {
  background: linear-gradient(45deg, var(--matrix-yellow), #cccc00);
  color: var(--matrix-bg);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 1px solid var(--matrix-yellow);
  box-shadow: 0 0 8px rgba(255, 255, 0, 0.3);
}

/* Action button styles consolidated above */

/* Amount styling in table */
.table .amount-large { 
  color: var(--matrix-red);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 0, 64, 0.5);
  font-family: var(--font-futuristic);
}

.table .amount-medium { 
  color: var(--matrix-yellow);
  font-weight: 600;
  text-shadow: 0 0 8px rgba(255, 255, 0, 0.3);
  font-family: var(--font-futuristic);
}

.table .amount-small { 
  color: var(--matrix-green);
  font-weight: 500;
  text-shadow: 0 0 5px rgba(0, 255, 65, 0.3);
  font-family: var(--font-futuristic);
}

/* Date styling */
.table .text-muted {
  color: rgba(224, 224, 224, 0.7) !important;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* Currency styling in table */
.table .currency-kzt { 
  color: var(--matrix-kzt);
  font-weight: 600;
  text-shadow: 0 0 5px rgba(79, 195, 247, 0.3);
}

.table .currency-rub { 
  color: var(--currency-rub);
  font-weight: 600;
  text-shadow: 0 0 5px rgba(215, 168, 110, 0.3);
}

.table .currency-usd { 
  color: var(--currency-usd);
  font-weight: 600;
  text-shadow: 0 0 5px rgba(129, 199, 132, 0.3);
}

.table .currency-eur { 
  color: var(--currency-eur);
  font-weight: 600;
  text-shadow: 0 0 5px rgba(166, 178, 141, 0.3);
}

.table .currency-egp { 
  color: var(--currency-egp);
  font-weight: 600;
  text-shadow: 0 0 5px rgba(243, 156, 18, 0.3);
}

.table .currency-other { 
  color: var(--currency-other);
  font-weight: 600;
  text-shadow: 0 0 5px rgba(176, 188, 197, 0.3);
}

.table .currency-other { 
  color: var(--currency-other);
  font-weight: 600;
  text-shadow: 0 0 5px rgba(176, 190, 197, 0.3);
}

/* No data state for table */
.table tbody .text-center.text-muted {
  background: rgba(26, 26, 26, 0.8);
  color: var(--matrix-gray) !important;
}

.table tbody .text-center.text-muted i {
  color: var(--matrix-green);
  text-shadow: 0 0 10px var(--matrix-green-glow);
}

/* Badges */
.badge {
  font-family: var(--font-mono);
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.category-badge {
  background: linear-gradient(45deg, var(--matrix-green), var(--matrix-green-dark));
  color: var(--matrix-bg);
  border: 1px solid var(--matrix-green);
}

.source-telegram {
  background: linear-gradient(45deg, var(--matrix-cyan), #0099cc);
  color: var(--matrix-bg);
}

.source-websocket_test {
  background: linear-gradient(45deg, var(--matrix-yellow), #cccc00);
  color: var(--matrix-bg);
}

/* Currency Colors */
.currency-kzt { color: var(--matrix-kzt); }
.currency-rub { color: var(--currency-rub); }
.currency-usd { color: var(--currency-usd); }
.currency-eur { color: var(--currency-eur); }
.currency-egp { color: var(--currency-egp); }
.currency-other { color: var(--currency-other); }

/* Amount Colors */
.amount-large { 
  color: var(--matrix-red);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 0, 64, 0.5);
}
.amount-medium { 
  color: var(--matrix-yellow);
  font-weight: 500;
}
.amount-small { 
  color: var(--matrix-green);
}

/* Alerts */
.alert {
  border: none;
  border-radius: 12px;
  font-family: var(--font-mono);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.alert-success {
  background: rgba(76, 175, 80, 0.12);
  color: var(--matrix-green);
  border: 1px solid var(--matrix-green);
}

.alert-danger {
  background: rgba(239, 83, 80, 0.12);
  color: var(--btn-delete);
  border: 1px solid var(--btn-delete);
}

.alert-info {
  background: rgba(79, 195, 247, 0.12);
  color: var(--matrix-cyan);
  border: 1px solid var(--matrix-cyan);
}

/* Loading State */
.loading {
  position: relative;
  opacity: 0.7;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 65, 0.1), transparent);
  animation: loadingShimmer 1.5s ease-in-out infinite;
}

@keyframes loadingShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Pagination */
.page-link {
  background: rgba(26, 26, 26, 0.8);
  border: 1px solid var(--matrix-border);
  color: var(--matrix-green);
  font-family: var(--font-mono);
  transition: all 0.3s ease;
}

.page-link:hover {
  background: var(--matrix-green);
  border-color: var(--matrix-green);
  color: var(--matrix-bg);
  box-shadow: 0 0 15px var(--matrix-green-glow);
}

.page-item.active .page-link {
  background: var(--matrix-green);
  border-color: var(--matrix-green);
  color: var(--matrix-bg);
  box-shadow: 0 0 20px var(--matrix-green-glow);
}

/* Modal */
.modal-content {
  background: var(--matrix-bg-secondary);
  border: 1px solid var(--matrix-green);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px var(--matrix-green-glow);
}

.modal-header {
  border-bottom: 1px solid var(--matrix-border);
  background: rgba(0, 255, 65, 0.1);
}

.modal-title {
  color: var(--matrix-green);
  font-family: var(--font-futuristic);
  font-weight: 700;
}

.btn-close {
  filter: invert(1) hue-rotate(120deg);
}

/* Chart Containers */
.chart-container {
  position: relative;
  background: radial-gradient(circle at center, rgba(0, 255, 65, 0.05) 0%, rgba(26, 26, 26, 0.9) 70%);
  border-radius: 12px;
  padding: 1rem;
  border: 2px solid rgba(0, 255, 65, 0.3);
  box-shadow: 
    inset 0 0 20px rgba(0, 255, 65, 0.1),
    0 0 30px rgba(0, 255, 65, 0.1);
  overflow: hidden;
  height: 300px;
  max-height: 300px;
}

/* Enhanced card styling for charts */
.card:has(.chart-container) {
  background: linear-gradient(135deg, 
    rgba(26, 26, 26, 0.95) 0%, 
    rgba(17, 17, 17, 0.95) 100%
  );
  border: 1px solid rgba(0, 255, 65, 0.4);
}

.card:has(.chart-container):hover {
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.6),
    0 0 30px rgba(0, 255, 65, 0.3),
    inset 0 1px 0 rgba(0, 255, 65, 0.2);
}

/* No Data Message */
.text-muted {
  color: var(--matrix-gray) !important;
}

/* Responsive Design Improvements */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
  
  .table {
    min-width: 700px;
    font-size: 0.85rem;
  }
  
  .table th,
  .table td {
    padding: 0.5rem 0.25rem;
  }
  
  .table th:nth-child(1), .table td:nth-child(1) { width: 110px; } /* Date */
  .table th:nth-child(2), .table td:nth-child(2) { width: 110px; } /* Amount */
  .table th:nth-child(3), .table td:nth-child(3) { width: 180px; } /* Category - 1.5x wider */
  .table th:nth-child(4), .table td:nth-child(4) { width: 100px; } /* Tags */
  .table th:nth-child(5), .table td:nth-child(5) { width: auto; min-width: 250px; } /* Description - expanded */
  .table th:nth-child(6), .table td:nth-child(6) { width: 140px; } /* Actions */
  
  .btn-action {
    min-width: 32px;
    height: 32px;
    padding: 0.25rem;
    font-size: 0.75rem;
  }
  
  .actions-container {
    gap: 4px;
  }
}

@media (max-width: 576px) {
  .table {
    min-width: 540px;
    font-size: 0.8rem;
  }
  
  .table th,
  .table td {
    padding: 0.4rem 0.2rem;
  }
  
  .table th {
    font-size: 0.75rem;
  }
  
  .table th:nth-child(1), .table td:nth-child(1) { width: 90px; } /* Date */
  .table th:nth-child(2), .table td:nth-child(2) { width: 90px; } /* Amount */
  .table th:nth-child(3), .table td:nth-child(3) { width: 150px; } /* Category - 1.5x wider */
  .table th:nth-child(4), .table td:nth-child(4) { width: 80px; } /* Tags */
  .table th:nth-child(5), .table td:nth-child(5) { width: auto; min-width: 180px; } /* Description - expanded */
  .table th:nth-child(6), .table td:nth-child(6) { width: 120px; } /* Actions */
  
  h1 {
    font-size: 2rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .summary-card .card-body {
    padding: 1.5rem 0.5rem;
  }
  
  .table {
    font-size: 0.875rem;
  }
  
  body::after {
    font-size: 10px;
  }
}

/* Dark scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--matrix-bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--matrix-green);
  border-radius: 4px;
  opacity: 0.8;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--matrix-green-light);
}

/* Tag Autocomplete Dropdown */
.tag-autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--matrix-bg-tertiary);
  border: 1px solid var(--card-border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tag-dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(76, 175, 80, 0.1);
}

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

.tag-dropdown-item:hover,
.tag-dropdown-item.active {
  background: var(--hover-bg);
  color: var(--text-secondary);
}

.tag-dropdown-item strong {
  color: var(--matrix-green);
  font-weight: 600;
}

/* Inline autocomplete preview */
#expenseTags[data-has-preview="true"] {
  position: relative;
}

#expenseTags[data-has-preview="true"]::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 16px;
  bottom: 0;
  pointer-events: none;
  font-family: inherit;
  font-size: inherit;
  padding: inherit;
  color: var(--text-muted);
  opacity: 0.6;
  z-index: -1;
}

/* TAB hint */
.tab-hint {
  position: absolute;
  top: -25px;
  right: 0;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--matrix-bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

#expenseTags:focus + .tab-hint,
#expenseTags[data-has-preview="true"] + .tab-hint {
  opacity: 1;
}

/* Form field container positioning */
.mb-3 {
  position: relative;
}

/* Selection */
::selection {
  background: rgba(76, 175, 80, 0.2);
  color: var(--text-primary);
}

/* Matrix Grid Background - Softened */
.matrix-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -3;
  opacity: 0.015;
  background-image: 
    linear-gradient(90deg, var(--matrix-green) 1px, transparent 1px),
    linear-gradient(180deg, var(--matrix-green) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: matrixGridShift 30s linear infinite;
}

@keyframes matrixGridShift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}

/* Enhanced Button Effects */
.btn-action {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  margin: 0 0.125rem;
  font-family: var(--font-mono);
}

.btn-action:hover {
  box-shadow: 0 0 15px var(--matrix-green-glow);
}



/* Enhanced Live Indicator */
#liveIndicator {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1050;
  font-size: 0.875rem;
  border-radius: 20px;
  padding: 0.75rem 1.25rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Text Glow Effects */
.text-glow {
  text-shadow: 0 0 10px var(--matrix-green-glow);
}

/* Matrix Terminal Effect */
.terminal-text {
  font-family: var(--font-mono);
  color: var(--matrix-green);
  text-shadow: 0 0 5px var(--matrix-green-glow);
  background: rgba(0, 0, 0, 0.8);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--matrix-green);
}

/* Custom Select Arrows */
.form-select {
  background-image: none;
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  padding-right: 2.5rem;
}

/* Enhanced Card Animations */
@keyframes cardPulse {
  0%, 100% {
    box-shadow: 
      0 8px 32px rgba(0, 0, 0, 0.3),
      inset 0 1px 0 rgba(0, 255, 65, 0.1);
  }
  50% {
    box-shadow: 
      0 12px 40px rgba(0, 0, 0, 0.4),
      0 0 20px var(--matrix-green-glow),
      inset 0 1px 0 rgba(0, 255, 65, 0.2);
  }
}

.card.pulse {
  animation: cardPulse 3s ease-in-out infinite;
}

/* Matrix Numbers Animation for Empty States */
.matrix-numbers {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.matrix-numbers::before {
  content: '01010101 11001100 00110011 10101010';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 200%;
  font-family: var(--font-mono);
  font-size: 14px;
  color: rgba(0, 255, 65, 0.1);
  white-space: pre-wrap;
  animation: numbersFlow 15s linear infinite;
}

@keyframes numbersFlow {
  0% { transform: translateY(0); }
  100% { transform: translateY(50%); }
}

/* Custom Chart Legend */
.chart-legend {
  margin-top: 10px;
  max-height: 150px;
  overflow-y: auto;
  padding: 10px;
}

/* Tag Styles */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-badge {
  background: linear-gradient(135deg, 
    rgba(0, 255, 65, 0.2) 0%, 
    rgba(0, 255, 65, 0.1) 100%);
  border: 1px solid var(--matrix-green);
  border-radius: 12px;
  padding: 3px 8px;
  color: var(--matrix-green);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-shadow: 0 0 5px var(--matrix-green-glow);
  box-shadow: 
    inset 0 1px 0 rgba(0, 255, 65, 0.1),
    0 0 5px rgba(0, 255, 65, 0.1);
  transition: all 0.3s ease;
}

.tag-badge:hover {
  background: linear-gradient(135deg, 
    rgba(0, 255, 65, 0.3) 0%, 
    rgba(0, 255, 65, 0.15) 100%);
  box-shadow: 
    0 0 10px var(--matrix-green-glow),
    inset 0 0 5px rgba(0, 255, 65, 0.2);
  transform: translateY(-1px);
}

/* Responsive adjustments for tags */
@media (max-width: 768px) {
  .tag-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
  }
  
  .tags-container {
    gap: 3px;
  }
}

/* ===========================================
   Tab Navigation Styling
   =========================================== */

.nav-tabs {
  border-bottom: 2px solid var(--matrix-green);
  gap: 0.5rem;
}

.nav-tabs .nav-link {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(16, 24, 32, 0.6);
  border: 1px solid rgba(76, 175, 80, 0.3);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 0.75rem 1.5rem;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-tabs .nav-link:hover {
  color: var(--matrix-green-accent);
  background: rgba(76, 175, 80, 0.1);
  border-color: var(--matrix-green);
}

.nav-tabs .nav-link.active {
  color: var(--matrix-green-accent);
  background: linear-gradient(180deg, 
    rgba(76, 175, 80, 0.2) 0%, 
    rgba(16, 24, 32, 0.95) 100%);
  border-color: var(--matrix-green);
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
  box-shadow: 
    0 -2px 10px rgba(76, 175, 80, 0.2),
    inset 0 1px 0 rgba(76, 175, 80, 0.3);
}

.nav-tabs .nav-link i {
  margin-right: 0.5rem;
}

.tab-content {
  padding-top: 1.5rem;
}

.tab-pane {
  animation: fadeIn 0.3s ease-out;
}

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

/* Income specific styling */
#income-pane .text-success {
  color: #4caf50 !important;
  text-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
}

#income-pane .badge.bg-success {
  background: linear-gradient(135deg, 
    rgba(76, 175, 80, 0.8) 0%, 
    rgba(56, 142, 60, 0.8) 100%) !important;
  border: 1px solid #4caf50;
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

/* Income table column widths */
#income-pane .table th:nth-child(1),
#income-pane .table td:nth-child(1) {
  width: 100px;
}

#income-pane .table th:nth-child(2),
#income-pane .table td:nth-child(2) {
  width: 140px;
}

#income-pane .table th:nth-child(3),
#income-pane .table td:nth-child(3) {
  width: 210px;
}

#income-pane .table th:nth-child(4),
#income-pane .table td:nth-child(4) {
  width: auto;
  min-width: 200px;
}

#income-pane .table th:nth-child(5),
#income-pane .table td:nth-child(5) {
  width: 150px;
}

/* Responsive tabs */
@media (max-width: 768px) {
  .nav-tabs .nav-link {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
  }
  
  .nav-tabs .nav-link span {
    display: none;
  }
}

/* ===== RESPONSIVE TABLE/CARDS SYSTEM ===== */

/* Text truncation utilities */
.truncate-name {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.truncate-desc {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .truncate-name {
    max-width: 280px;
  }
  .truncate-desc {
    max-width: 200px;
  }
}

/* Table/Cards view toggle visibility */
.table-view {
  display: block;
}

.cards-view {
  display: none;
}

@media (max-width: 575.98px) {
  .table-view {
    display: none;
  }
  .cards-view {
    display: block;
  }
}

/* Manual override classes */
.force-table .table-view {
  display: block !important;
}
.force-table .cards-view {
  display: none !important;
}
.force-cards .table-view {
  display: none !important;
}
.force-cards .cards-view {
  display: block !important;
}

/* View toggle button */
.view-toggle-btn {
  background: transparent;
  border: 1px solid var(--matrix-green);
  color: var(--matrix-green);
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.view-toggle-btn:hover {
  background: rgba(0, 255, 65, 0.1);
  box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}

.view-toggle-btn.active {
  background: rgba(0, 255, 65, 0.2);
}

/* ===== CARD LAYOUT STYLES ===== */

.table-card {
  border: 1px solid var(--matrix-green);
  background: linear-gradient(135deg, rgba(16, 24, 32, 0.95) 0%, rgba(10, 18, 26, 0.98) 100%);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  position: relative;
  transition: all 0.2s ease;
}

.table-card:hover {
  border-color: #00ff41;
  box-shadow: 0 0 15px rgba(0, 255, 65, 0.2);
}

.table-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(0, 255, 65, 0.2);
}

.table-card-header .card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.table-card-header .card-type {
  font-size: 0.7rem;
}

.table-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.table-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-card-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table-card-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-card-amount {
  font-size: 1.1rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.table-card-amount.positive {
  color: #4caf50;
}

.table-card-amount.negative {
  color: #f44336;
}

.table-card-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(0, 255, 65, 0.1);
}

.table-card-name {
  font-size: 1rem;
  font-weight: 500;
  color: var(--matrix-green);
  margin-bottom: 0.25rem;
}

.table-card-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Card empty state */
.cards-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.cards-empty i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  display: block;
}

/* ===== ACTIONS DROPDOWN ===== */

.actions-dropdown {
  position: relative;
  display: inline-block;
}

.actions-dropdown-trigger {
  background: transparent;
  border: 1px solid rgba(0, 255, 65, 0.5);
  color: var(--matrix-green);
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.actions-dropdown-trigger:hover {
  background: rgba(0, 255, 65, 0.1);
  border-color: var(--matrix-green);
}

.actions-dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 160px;
  background: rgba(16, 24, 32, 0.98);
  border: 1px solid var(--matrix-green);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 255, 65, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.actions-dropdown.open .actions-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.actions-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.actions-dropdown-item:hover {
  background: rgba(0, 255, 65, 0.1);
  color: var(--matrix-green);
}

.actions-dropdown-item i {
  width: 16px;
  text-align: center;
}

.actions-dropdown-item.text-danger {
  color: #f44336;
}

.actions-dropdown-item.text-danger:hover {
  background: rgba(244, 67, 54, 0.1);
  color: #ff5252;
}

.actions-dropdown-item.text-success {
  color: #4caf50;
}

.actions-dropdown-item.text-success:hover {
  background: rgba(76, 175, 80, 0.1);
  color: #69f0ae;
}

.actions-dropdown-item.text-info {
  color: #00bcd4;
}

.actions-dropdown-item.text-info:hover {
  background: rgba(0, 188, 212, 0.1);
  color: #4dd0e1;
}

.actions-dropdown-item.text-warning {
  color: #ff9800;
}

.actions-dropdown-item.text-warning:hover {
  background: rgba(255, 152, 0, 0.1);
  color: #ffb74d;
}

.actions-dropdown-divider {
  height: 1px;
  background: rgba(0, 255, 65, 0.2);
  margin: 0.25rem 0;
}

/* Mobile card optimizations */
@media (max-width: 575.98px) {
  .table-card {
    padding: 0.875rem;
    margin-bottom: 0.625rem;
  }
  
  .table-card-amount {
    font-size: 1rem;
  }
  
  .table-card-label {
    font-size: 0.65rem;
  }
  
  .table-card-value {
    font-size: 0.85rem;
  }
  
  .actions-dropdown-trigger {
    padding: 0.5rem 0.7rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .actions-dropdown-item {
    padding: 0.75rem 1rem;
    min-height: 44px;
  }
}
