/* ═══════════ HISTORY ═══════════ */

/* Search Bar */
.search-bar-container {
    padding: 8px 16px;
    background: transparent;
    border: none;
    position: sticky;
    top: calc(var(--safe-top) + 64px);
    z-index: 800;
}

@media (max-height: 700px) {
    .search-bar-container {
        top: calc(var(--safe-top) + 60px);
    }
}

@media (max-height: 600px) {
    .search-bar-container {
        top: calc(var(--safe-top) + 56px);
    }
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
    font-size: 14px;
    pointer-events: none;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 44px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), 0 4px 12px rgba(0, 0, 0, 0.1);
    background: var(--bg-elevated);
}

.search-input::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    border: none;
    color: #ef4444;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.search-clear-btn:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.05);
}

.search-clear-btn:active {
    transform: scale(0.95);
}

/* Filters Panel */
.filters-panel {
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease, opacity 0.2s ease;
    background: transparent;
    border-bottom: none;
}

.filters-panel.collapsed {
    max-height: 0;
    padding: 0 16px;
    opacity: 0;
}

.filters-panel:not(.collapsed) {
    max-height: 300px;
    padding: 0 16px 12px;
    opacity: 1;
}

.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.select-filter {
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
}

.select-filter:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: var(--bg-elevated);
}
    font-size: 14px;
    appearance: none;
    cursor: pointer;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-amount-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.input-filter {
    flex: 1;
    padding: 10px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    min-width: 0;
}

.input-filter:focus {
    outline: none;
    border-color: var(--accent);
}

.filter-separator {
    color: var(--text-muted);
    font-size: 14px;
}

.btn-reset-filters {
    padding: 10px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-reset-filters:hover {
    background: var(--red);
    border-color: var(--red);
    color: white;
}

/* Active filters chips */
.active-filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
}

.filter-chip-label {
    color: var(--text-muted);
}

.filter-chip-value {
    color: var(--text-primary);
    font-weight: 500;
}

.filter-chip-remove {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.filter-chip-remove:hover {
    background: var(--red);
    color: white;
}

.tx-history {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.date-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.date-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-left: 4px;
}

.btn-load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    margin-top: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-load-more:hover:not(:disabled) {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.btn-load-more:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Transaction Item (History) */
.transaction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.2s;
}

.transaction-item:hover {
    border-color: var(--accent);
}

.transaction-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.transaction-icon.expense {
    background: var(--red-soft);
    color: var(--red);
}

.transaction-icon.income {
    background: var(--green-soft);
    color: var(--green);
}

.transaction-info {
    flex: 1;
    min-width: 0;
}

.transaction-category {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.transaction-description {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transaction-amount {
    text-align: right;
    flex-shrink: 0;
}

.transaction-value {
    font-size: 15px;
    font-weight: 700;
}

.transaction-value.expense {
    color: var(--red);
}

.transaction-value.income {
    color: var(--green);
}
