/* Mobile-First Responsive Data Display System */

/* Card-based layout for replacing tables */
.data-cards-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.data-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem;
    margin-bottom: 0.5rem;
    transition: box-shadow 0.2s ease;
}

.data-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.data-card-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.data-card-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #495057;
    margin: 0;
}

.data-card-actions {
    display: flex;
    gap: 0.5rem;
}

.data-card-body {
    display: grid;
    gap: 0.5rem;
}

.data-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
}

.data-field-label {
    font-weight: 500;
    color: #6c757d;
    font-size: 0.9rem;
    min-width: 100px;
}

.data-field-value {
    color: #495057;
    font-weight: 400;
    text-align: right;
    flex: 1;
}

/* Status indicators */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-paid { background-color: #d4edda; color: #155724; }
.status-pending { background-color: #fff3cd; color: #856404; }
.status-overdue { background-color: #f8d7da; color: #721c24; }
.status-active { background-color: #d1ecf1; color: #0c5460; }

/* Amount styling */
.amount-positive { color: #28a745; font-weight: 600; }
.amount-negative { color: #dc3545; font-weight: 600; }
.amount-neutral { color: #495057; font-weight: 600; }

/* Tablet and Desktop Grid Layout */
@media (min-width: 768px) {
    .data-cards-container {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 1.5rem;
    }
    
    .data-card {
        margin-bottom: 0;
    }
    
    /* Compact view option for desktop */
    .data-cards-container.compact {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
    }
    
    .data-cards-container.compact .data-card {
        padding: 0.75rem;
    }
}

@media (min-width: 992px) {
    .data-cards-container {
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    }
    
    .data-cards-container.compact {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

/* List view toggle for desktop */
.data-cards-container.list-view {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.data-cards-container.list-view .data-card {
    padding: 0.75rem 1rem;
}

.data-cards-container.list-view .data-card-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

/* Search and filter section */
.data-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
}

@media (min-width: 768px) {
    .data-controls {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .data-controls-left,
    .data-controls-right {
        display: flex;
        align-items: center;
        gap: 1rem;
    }
}

/* View toggle buttons */
.view-toggle {
    display: flex;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    overflow: hidden;
}

.view-toggle-btn {
    padding: 0.5rem 1rem;
    background: white;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.view-toggle-btn:hover {
    background: #f8f9fa;
}

.view-toggle-btn.active {
    background: #007bff;
    color: white;
}

.view-toggle-btn:not(:last-child) {
    border-right: 1px solid #dee2e6;
}

/* Loading and empty states */
.data-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    color: #6c757d;
}

.data-empty {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.data-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Responsive improvements for existing table-responsive areas */
.table-responsive {
    display: none; /* Hide tables by default */
}

.data-cards-container.show {
    display: flex;
}

/* Show tables only on large screens if table toggle is active */
@media (min-width: 1200px) {
    .table-view-active .table-responsive {
        display: block;
    }
    
    .table-view-active .data-cards-container {
        display: none;
    }
}

/* Sort indicators */
.sort-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.sort-header:hover {
    color: #007bff;
}

.sort-icon {
    font-size: 0.8rem;
    opacity: 0.5;
}

.sort-header.active .sort-icon {
    opacity: 1;
    color: #007bff;
}

/* Action buttons in cards */
.card-action-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 0.25rem;
    border: 1px solid;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-action-btn.btn-primary {
    border-color: #007bff;
    color: #007bff;
}

.card-action-btn.btn-primary:hover {
    background: #007bff;
    color: white;
}

.card-action-btn.btn-danger {
    border-color: #dc3545;
    color: #dc3545;
}

.card-action-btn.btn-danger:hover {
    background: #dc3545;
    color: white;
}

.card-action-btn.btn-warning {
    border-color: #ffc107;
    color: #856404;
}

.card-action-btn.btn-warning:hover {
    background: #ffc107;
    color: #212529;
}

/* Responsive typography */
@media (max-width: 576px) {
    .data-card-title {
        font-size: 1rem;
    }
    
    .data-field-label {
        font-size: 0.85rem;
        min-width: 80px;
    }
    
    .data-field-value {
        font-size: 0.9rem;
    }
    
    .card-action-btn {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }
}

/* Receipt image rotation and viewport styles */
.receipt-viewport {
    display: flex;
    align-items: center;
    justify-content: center;
}

.receipt-image-edit {
    max-width: none !important;
    max-height: none !important;
    width: auto;
    height: auto;
    transition: transform 0.3s ease;
}

/* Ensure rotated images don't cause layout issues */
.receipt-viewport.rotated {
    overflow: hidden;
}

.receipt-viewport img {
    object-fit: contain;
}

/* Image controls styling */
.btn-group .btn-outline-success {
    border-color: #28a745;
    color: #28a745;
}

.btn-group .btn-outline-success:hover {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

/* Rotation and zoom level badges */
.badge.bg-info {
    background-color: #17a2b8 !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}