/* Mobile Responsive Table Styles */
@media screen and (max-width: 768px) {
    /* Force table to not be like a table anymore */
    .table-responsive table,
    .table-responsive thead,
    .table-responsive tbody,
    .table-responsive th,
    .table-responsive td,
    .table-responsive tr {
        display: block;
    }

    /* Hide table headers (but not display: none;, for accessibility) */
    .table-responsive thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .table-responsive tbody tr {
        border: 1px solid #e0e0e0;
        border-radius: 12px;
        margin-bottom: 20px;
        background: white;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        padding: 15px;
        transition: transform 0.3s ease;
    }
    
    .table-responsive tbody tr:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    }

    .table-responsive td {
        border: none;
        border-bottom: 1px dashed #e9ecef;
        position: relative;
        padding: 12px 10px 12px 45% !important;
        white-space: normal;
        text-align: right !important;
        min-height: 45px;
        font-size: 14px;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        width: 100%;
        box-sizing: border-box;
    }

    .table-responsive td:last-child {
        border-bottom: none;
    }

    .table-responsive td:before {
        position: absolute;
        top: 50%;
        left: 10px;
        transform: translateY(-50%);
        width: 40%;
        padding-right: 10px;
        white-space: normal;
        font-weight: 700;
        color: #495057;
        content: attr(data-label);
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        text-align: left;
        background: #f8f9fa;
        padding: 4px 8px;
        border-radius: 4px;
        border-left: 3px solid #667eea;
    }

    /* Special handling for amount cells */
    .table-responsive td.amount-cell {
        text-align: right !important;
        font-weight: 700;
    }
    
    .table-responsive td.amount-cell:before {
        background: #f0f9ff;
        border-left-color: #28a745;
    }

    /* Badge adjustments for mobile */
    .agent-badge,
    .status-badge,
    .badge {
        display: inline-block;
        max-width: 100%;
        word-break: break-word;
        white-space: normal !important;
        font-size: 12px;
        padding: 6px 12px;
    }
    
    /* Specific badge styling for mobile */
    .status-badge {
        min-width: auto;
        width: auto;
        display: inline-block;
    }
    
    /* User ID badge */
    .agent-badge {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    /* User type badge */
    .badge {
        font-size: 12px;
        padding: 6px 12px;
    }

    /* Summary cards adjustments */
    .summary-cards-container {
        grid-template-columns: 1fr !important;
        gap: 12px;
        padding: 0 5px;
    }

    .summary-card {
        margin-bottom: 10px;
        padding: 15px;
    }
    
    .summary-icon {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .summary-label {
        font-size: 11px;
    }
    
    .summary-value {
        font-size: 20px;
    }

    /* Filter bar adjustments */
    .filter-bar {
        flex-direction: column;
        border-radius: 20px;
        padding: 15px;
        gap: 8px;
        margin: 15px 0;
    }

    .filter-btn {
        width: 100%;
        justify-content: center;
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .filter-btn i {
        font-size: 14px;
    }

    /* DataTable controls adjustments */
    .dataTables_length,
    .dataTables_filter,
    .dataTables_info,
    .dataTables_paginate {
        float: none !important;
        text-align: center !important;
        margin: 15px 0 !important;
        width: 100%;
    }
    
    .dataTables_filter input {
        width: 100%;
        max-width: 300px;
        margin: 10px auto 0;
        display: block;
    }
    
    .dataTables_length select {
        margin: 0 5px;
    }

    .dt-buttons {
        float: none !important;
        text-align: center;
        margin: 10px 0;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }

    .dt-buttons .btn {
        margin: 2px;
        padding: 8px 15px;
        font-size: 12px;
        flex: 0 1 auto;
    }
    
    /* Pagination on mobile */
    .dataTables_paginate {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }
    
    .dataTables_paginate .paginate_button {
        padding: 8px 12px;
        margin: 2px;
        font-size: 12px;
    }
    
    /* Table container */
    .table-card {
        padding: 15px 10px;
        margin-top: 15px;
    }
    
    .table-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .table-header h4 {
        font-size: 16px;
        margin-bottom: 5px;
    }
    
    /* No data message on mobile */
    .no-data-message {
        padding: 30px 15px;
    }
    
    .no-data-icon {
        font-size: 40px;
    }
    
    .no-data-message h3 {
        font-size: 18px;
    }
    
    .no-data-message p {
        font-size: 14px;
    }
}

/* Small mobile devices (up to 480px) */
@media screen and (max-width: 480px) {
    .table-responsive td {
        padding: 10px 0px 12px 33% !important;
        font-size: 13px;
        min-height: 40px;
    }
    
    .table-responsive td:before {
        font-size: 11px;
        padding: 3px 6px;
        width: 35%;
    }
    
    .agent-badge,
    .status-badge,
    .badge {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .summary-card {
        padding: 12px;
    }
    
    .summary-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .summary-value {
        font-size: 18px;
    }
    
    .filter-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* Tablet adjustments */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .summary-cards-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }
    
    .filter-bar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .filter-btn {
        margin: 0;
        flex: 0 1 auto;
    }
    
    /* Adjust table for tablet */
    .table-responsive td {
        padding: 10px 8px;
        font-size: 12px;
    }
}

/* Desktop styles */
.summary-cards-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.summary-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.summary-icon {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.summary-icon.bg-purple-100 {
    background: linear-gradient(135deg, #9f7aea 0%, #6b46c1 100%);
}

.summary-icon.bg-yellow-100 {
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
}

.summary-icon.bg-blue-100 {
    background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
}

.summary-icon.bg-red-100 {
    background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
}

.summary-icon.bg-green-100 {
    background: linear-gradient(135deg, #34d399 0%, #059669 100%);
}

.summary-details {
    flex: 1;
}

.summary-label {
    display: block;
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.summary-value {
    display: block;
    font-size: 26px;
    font-weight: 700;
    color: #2d3748;
    line-height: 1.2;
}

/* DataTable specific fixes */
table.dataTable {
    width: 100% !important;
    border-collapse: collapse !important;
    border-radius: 12px;
    overflow: hidden;
}

table.dataTable thead th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    font-size: 13px;
    padding: 15px 8px;
    white-space: nowrap;
    border: none !important;
    text-align: left;
}

table.dataTable tbody td {
    vertical-align: middle;
    padding: 12px 8px;
    font-size: 13px;
    border-bottom: 1px solid #e9ecef;
}

table.dataTable tbody tr:hover {
    background-color: #f8f9ff !important;
}

/* Button container fixes */
.dt-buttons {
    float: left;
    margin-right: 10px;
}

.dt-buttons .btn {
    margin-right: 5px;
    border-radius: 30px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    transition: all 0.3s ease;
}

.dt-buttons .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-success {
    background: linear-gradient(135deg, #34d399 0%, #059669 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #9ca3af 0%, #4b5563 100%);
    color: white;
}

/* Search box styling */
.dataTables_filter {
    float: right;
    text-align: right;
}

.dataTables_filter label {
    font-weight: 500;
    color: #4a5568;
}

.dataTables_filter input {
    border: 2px solid #e2e8f0;
    border-radius: 30px;
    padding: 8px 16px;
    margin-left: 10px;
    font-size: 13px;
    transition: all 0.3s ease;
    width: 250px;
}

.dataTables_filter input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Length menu styling */
.dataTables_length {
    float: left;
    margin-bottom: 15px;
}

.dataTables_length label {
    font-weight: 500;
    color: #4a5568;
}

.dataTables_length select {
    border: 2px solid #e2e8f0;
    border-radius: 30px;
    padding: 8px 30px 8px 12px;
    margin: 0 5px;
    font-size: 13px;
    background: white;
    cursor: pointer;
}

/* Info and pagination styling */
.dataTables_info {
    float: left;
    padding-top: 20px;
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
}

.dataTables_paginate {
    float: right;
    padding-top: 15px;
}

.dataTables_paginate .paginate_button {
    padding: 8px 14px;
    margin-left: 5px;
    border-radius: 30px;
    border: 2px solid #e2e8f0;
    background: white;
    color: #4a5568 !important;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dataTables_paginate .paginate_button:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    border-color: transparent;
    transform: translateY(-2px);
}

.dataTables_paginate .paginate_button.current {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    border-color: transparent;
}

/* Filter Button Styles */
.filter-bar {
    display: flex;
    gap: 12px;
    margin: 25px 0;
    flex-wrap: wrap;
    justify-content: center;
    padding: 15px 20px;
    background: #f8fafc;
    border-radius: 50px;
    border: 1px solid #e2e8f0;
}

.filter-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    color: #4a5568;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e2e8f0;
}

.filter-btn i {
    font-size: 14px;
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
    color: #667eea;
}

.filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
}

.filter-btn.active:hover {
    color: white;
}

/* Badge Styles */
.badge {
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    text-align: center;
}

.badge-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.badge-info {
    background: linear-gradient(135deg, #17ead9 0%, #6078ea 100%);
    color: white;
}

/* Amount cell styling */
.amount-cell {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    text-align: right;
}

.credit-amount {
    color: #059669;
}

/* Status styling */
.status-badge {
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    text-align: center;
    min-width: 85px;
}

.status-active {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: #1e4620;
    border: 1px solid #28a745;
}

.status-inactive {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #721c24;
    border: 1px solid #dc3545;
}

/* Agent badge */
.agent-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
}

/* Table container */
.table-card {
    background: white;
    border-radius: 20px;
    padding: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    margin-top: 25px;
    border: 1px solid #f0f0f0;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.table-header h4 {
    margin: 0;
    color: #2d3748;
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
}

/* No data message */
.no-data-message {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    margin-top: 25px;
}

.no-data-content {
    max-width: 400px;
    margin: 0 auto;
}

.no-data-icon {
    font-size: 60px;
    color: #cbd5e0;
    margin-bottom: 20px;
}

.no-data-message h3 {
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 22px;
    font-weight: 700;
}

.no-data-message p {
    color: #718096;
    margin: 0;
    font-size: 16px;
}

/* Loading animation */
.loading-animation {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loading-content {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.loading-spinner {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 25px;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-ring:nth-child(2) {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    border-top-color: #764ba2;
    animation-duration: 1.5s;
}

.spinner-ring:nth-child(3) {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border-top-color: #f687b3;
    animation-duration: 2s;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content h3 {
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 20px;
    font-weight: 700;
}

.loading-content p {
    color: #718096;
    font-size: 14px;
}