/* Buchungen View Styles */
/* Base: 1rem = 10px */

.buchungen-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 1.4rem;
    line-height: 1.5;
    color: #2c3e50;
    background: #ffffff;
    border-radius: 0.8rem;
    box-shadow: 0 0.2rem 1rem rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin: 2rem 0;
}

/* Header */
.buchungen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 0.1rem solid #dee2e6;
}

.buchungen-header h2 {
    margin: 0;
    font-size: 2.4rem;
    font-weight: 600;
    color: #2c3e50;
}

.view-toggle {
    display: flex;
    background: #ffffff;
    border-radius: 0.6rem;
    padding: 0.3rem;
    box-shadow: 0 0.2rem 0.8rem rgba(0, 0, 0, 0.1);
}

.view-btn {
    padding: 1rem 2rem;
    border: none;
    background: transparent;
    font-size: 1.3rem;
    font-weight: 500;
    color: #6c757d;
    border-radius: 0.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.view-btn:hover {
    color: #495057;
    background: #f8f9fa;
}

.view-btn.active {
    background: #007bff;
    color: #ffffff;
    box-shadow: 0 0.2rem 0.4rem rgba(0, 123, 255, 0.3);
}

/* Filters */
.buchungen-filters {
    padding: 2rem 2.5rem;
    background: #ffffff;
    border-bottom: 0.1rem solid #e9ecef;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 15rem;
}

.filter-group label {
    font-size: 1.2rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.filter-group input,
.filter-group select {
    padding: 0 1.2rem;
    border: 0.1rem solid #ced4da;
    border-radius: 0.4rem;
    font-size: 1.4rem;
    background: #ffffff;
    transition: all 0.2s ease;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.btn-secondary {
    padding: 0.8rem 1.6rem;
    background: #6c757d;
    color: #ffffff;
    border: none;
    border-radius: 0.4rem;
    font-size: 1.3rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-0.1rem);
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #6c757d;
    font-size: 1.4rem;
}

.loading-spinner {
    width: 2rem;
    height: 2rem;
    border: 0.2rem solid #e9ecef;
    border-top: 0.2rem solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Table Container */
.buchungen-table-container {
    overflow-x: auto;
    background: #ffffff;
}

/* Table Styles */
.buchungen-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.3rem;
    background: #ffffff;
}

.buchungen-table thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.buchungen-table th {
    padding: 1.5rem 1.2rem;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 0.2rem solid #dee2e6;
    white-space: nowrap;
}

.buchungen-table td {
    padding: 1.2rem;
    border-bottom: 0.1rem solid #e9ecef;
    vertical-align: top;
    transition: background-color 0.15s ease;
}

.buchungen-table tbody tr:hover td {
    background: #f8f9fa;
}

.buchungen-table tbody tr.selected td {
    background: #e3f2fd;
    border-color: #bbdefb;
}

.buchungen-table tbody tr.hover td {
    background: #f5f5f5;
}

/* Amount Styling */
.amount {
    text-align: right;
    font-weight: 500;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
}

.amount.income {
    color: #28a745;
}

.amount.expense {
    color: #dc3545;
}

.amount.balance.positive {
    color: #28a745;
    font-weight: 600;
}

.amount.balance.negative {
    color: #dc3545;
    font-weight: 600;
}

/* Simple View Specific */
.simple-view th:nth-child(4),
.simple-view th:nth-child(5),
.simple-view th:nth-child(6) {
    text-align: right;
}

/* Double Entry View Specific */
.double-entry-view th:nth-child(6) {
    text-align: right;
}

/* Summary */
.buchungen-summary {
    display: flex;
    justify-content: space-around;
    padding: 2rem 2.5rem;
    background: #f8f9fa;
    border-top: 0.1rem solid #dee2e6;
    margin-top: 2rem;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.summary-item .label {
    font-size: 1.2rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.summary-item .amount {
    font-size: 1.8rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* Error States */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d;
    font-size: 1.6rem;
    background: #ffffff;
}

.buchungen-error {
    text-align: center;
    padding: 4rem 2rem;
    background: #ffffff;
    color: #dc3545;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-message {
    font-size: 1.6rem;
    margin-bottom: 2rem;
}

.retry-btn {
    padding: 1rem 2rem;
    background: #007bff;
    color: #ffffff;
    border: none;
    border-radius: 0.4rem;
    font-size: 1.4rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.retry-btn:hover {
    background: #0056b3;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .filter-row {
        gap: 1.5rem;
    }
    
    .filter-group {
        min-width: 12rem;
    }
}

@media (max-width: 992px) {
    .buchungen-header {
        flex-direction: column;
        gap: 2rem;
        align-items: stretch;
    }
    
    .view-toggle {
        align-self: center;
    }
    
    .filter-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .buchungen-summary {
        flex-direction: column;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .buchungen-wrapper {
        margin: 1rem 0;
        border-radius: 0;
        box-shadow: none;
    }
    
    .buchungen-header {
        padding: 1.5rem;
    }
    
    .buchungen-header h2 {
        font-size: 2rem;
    }
    
    .buchungen-filters {
        padding: 1.5rem;
    }
    
    .view-btn {
        padding: 0.8rem 1.5rem;
        font-size: 1.2rem;
    }
    
    /* Mobile Table */
    .buchungen-table.mobile-view {
        font-size: 1.2rem;
    }
    
    .buchungen-table.mobile-view th,
    .buchungen-table.mobile-view td {
        padding: 0.8rem 0.6rem;
    }
    
    .buchungen-table.mobile-view th {
        font-size: 1.1rem;
    }
    
    /* Hide some columns on mobile for simple view */
    .simple-view.mobile-view th:nth-child(2),
    .simple-view.mobile-view td:nth-child(2) {
        display: none;
    }
    
    /* Stack summary items */
    .buchungen-summary {
        padding: 1.5rem;
    }
    
    .summary-item .amount {
        font-size: 1.6rem;
    }
}

@media (max-width: 480px) {
    .buchungen-header {
        padding: 1rem;
    }
    
    .buchungen-filters {
        padding: 1rem;
    }
    
    .view-btn {
        padding: 0.6rem 1rem;
        font-size: 1.1rem;
    }
    
    .buchungen-table {
        font-size: 1.1rem;
    }
    
    .buchungen-table th,
    .buchungen-table td {
        padding: 0.6rem 0.4rem;
    }
    
    /* Further hide columns on very small screens */
    .simple-view.mobile-view th:nth-child(3),
    .simple-view.mobile-view td:nth-child(3) {
        max-width: 10rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Print Styles */
@media print {
    .buchungen-header .view-toggle,
    .buchungen-filters,
    .loading {
        display: none !important;
    }
    
    .buchungen-wrapper {
        box-shadow: none;
        border: 0.1rem solid #000;
    }
    
    .buchungen-table {
        font-size: 1.2rem;
    }
    
    .buchungen-table th,
    .buchungen-table td {
        padding: 0.5rem;
        border: 0.1rem solid #000;
    }
    
    .amount.income {
        color: #000;
    }
    
    .amount.expense {
        color: #000;
    }
    
    .amount.balance {
        color: #000;
        font-weight: bold;
    }
}

/* Accessibility */
.buchungen-table:focus-within {
    outline: 0.2rem solid #007bff;
    outline-offset: 0.2rem;
}

.view-btn:focus,
.btn-secondary:focus,
.filter-group input:focus,
.filter-group select:focus {
    outline: 0.2rem solid #007bff;
    outline-offset: 0.2rem;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .buchungen-table th {
        border-bottom-width: 0.3rem;
    }
    
    .buchungen-table td {
        border-bottom-width: 0.2rem;
    }
    
    .view-btn.active {
        border: 0.2rem solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .view-btn,
    .btn-secondary,
    .buchungen-table td,
    .loading-spinner {
        transition: none;
        animation: none;
    }
}