/**
 * Backend Responsive Table Styles
 * This file contains all responsive table styles for backend blade files
 * Mobile-first approach with card-based layout for small screens
 */

/* ============================================
   RESPONSIVE TABLE WRAPPER
   ============================================ */
.responsive-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================
   DESKTOP TABLE VIEW
   ============================================ */
.table-responsive-desktop {
    display: block;
}

/* ============================================
   MOBILE CARD VIEW
   ============================================ */
.table-responsive-mobile {
    display: none;
}

/* ============================================
   CARD STYLES (Mobile View)
   ============================================ */
.data-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.data-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #dee2e6;
}

.data-card-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0;
    color: #212529;
    word-break: break-word;
}

.data-card-badge {
    font-size: 0.75rem;
    white-space: nowrap;
    margin-left: 0.5rem;
}

.data-card-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f8f9fa;
}

.data-card-item:last-child {
    border-bottom: none;
}

.data-card-label {
    font-weight: 600;
    color: #6c757d;
    font-size: 0.875rem;
    min-width: 100px;
    flex-shrink: 0;
}

.data-card-value {
    flex: 1;
    text-align: right;
    color: #212529;
    word-break: break-word;
    font-size: 0.875rem;
}

.data-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f8f9fa;
    flex-wrap: wrap;
}

.data-card-actions .btn {
    flex: 1;
    min-width: 80px;
    font-size: 0.875rem;
}

.data-card-actions .btn-group-vertical {
    width: 100%;
}

.data-card-actions .btn-group-vertical .btn {
    width: 100%;
    margin-bottom: 0.5rem;
}

.data-card-actions .btn-group-vertical .btn:last-child {
    margin-bottom: 0;
}

/* ============================================
   PAGE HEADER RESPONSIVE
   ============================================ */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header .d-flex {
    flex-wrap: wrap;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */
@media (max-width: 767.98px) {
    /* Hide desktop table, show mobile cards */
    .table-responsive-desktop {
        display: none !important;
    }

    .table-responsive-mobile {
        display: block;
    }

    /* Page header adjustments */
    .page-header .d-flex {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .page-header .btn {
        width: 100%;
    }

    /* Touch-friendly buttons */
    .btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }

    /* Form controls on mobile */
    .form-select,
    .form-control {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Card adjustments */
    .data-card-label {
        min-width: 90px;
        font-size: 0.8rem;
    }

    .data-card-value {
        font-size: 0.8rem;
    }

    /* Badge adjustments */
    .badge {
        font-size: 0.7rem;
        padding: 0.35em 0.65em;
    }
}

@media (min-width: 768px) {
    .responsive-table-wrapper {
        overflow-x: auto;
    }

    .table-responsive-desktop {
        display: table;
        width: 100%;
    }

    .table-responsive-mobile {
        display: none;
    }
}

/* ============================================
   TABLE ENHANCEMENTS
   ============================================ */
.table {
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    white-space: nowrap;
}

.table tbody tr {
    transition: background-color 0.15s ease-in-out;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* ============================================
   ACTION BUTTONS
   ============================================ */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

@media (max-width: 767.98px) {
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* ============================================
   EMPTY STATE
   ============================================ */
.table-responsive-mobile .empty-state {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

/* ============================================
   PAGINATION RESPONSIVE
   ============================================ */
.pagination {
    flex-wrap: wrap;
    justify-content: center;
}

.pagination .page-link {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 767.98px) {
    .mobile-only {
        display: block;
    }

    .desktop-only {
        display: none;
    }
}

