/* View Customers Page Styles */

.main-container {
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #60a5fa;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 32px;
    transition: color 0.3s ease;
}

.back-btn:hover {
    color: #3b82f6;
    text-decoration: none;
}

.page-title {
    font-size: 36px;
    font-weight: 800;
    color: #f1f5f9;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #60a5fa, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-subtitle {
    color: #94a3b8;
    font-size: 16px;
    margin-bottom: 40px;
}

.table-container {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Table styling */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #1e293b;
    color: #f1f5f9;
    border-radius: 8px;
    overflow: hidden;
}
.table-header th {
    background: #334155;
    color: #f7fafc;
    font-weight: 600;
    padding: 12px 8px;
    cursor: pointer;
    user-select: none;
    border-bottom: 2px solid #475569;
}
.table-header th a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}
.table-header th.sorted {
    background: #475569;
}
.table-row {
    transition: background 0.2s;
}
.table-row:hover {
    background: #334155;
}
.table-cell {
    padding: 10px 8px;
    border-bottom: 1px solid #475569;
}

#customersTable {
    table-layout: fixed;
    width: 100%;
}

#customersTable th,
#customersTable td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#customersTable th {
    /* Optional: set min-widths for important columns */
    min-width: 120px;
}

.points-badge {
    background: #2563eb;
    color: #fff;
    border-radius: 6px;
    padding: 4px 10px;
    font-weight: 600;
    display: inline-block;
    min-width: 48px;
    text-align: center;
}

.no-results {
    text-align: center;
    color: #cbd5e1;
    margin: 40px 0;
}

.no-results-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* Enhanced Pagination Styling */
.pagination {
    margin-top: 24px;
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 0;
    list-style: none;
}
.page-item {
    margin: 0 2px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(30, 41, 59, 0.08);
    transition: box-shadow 0.2s;
}
.page-item.active {
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.15);
}
.page-link {
    color: #f1f5f9;
    background: linear-gradient(135deg, #1e293b 60%, #334155 100%);
    border: 1px solid #64748b;
    border-radius: 8px;
    padding: 8px 18px;
    font-weight: 600;
    font-size: 15px;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    text-decoration: none;
    display: block;
}
.page-link:hover, .page-item.active .page-link {
    background: linear-gradient(135deg, #2563eb 60%, #a855f7 100%);
    border-color: #2563eb;
    color: #fff;
}
.page-item.disabled .page-link {
    color: #64748b;
    background: #334155;
    border-color: #334155;
    pointer-events: none;
    opacity: 0.7;
}

/* Dashboard Flex Layout */
.dashboard-flex-row {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: stretch;
}

/* Remove the dashboard-left and dashboard-right containers */
.dashboard-flex-row .card {
    flex: 1 1 300px;      /* Each card gets equal space with 300px minimum */
    min-width: 250px;
    max-width: 500px;
}

/* Special styling for the progress card (third card) */
.dashboard-flex-row .card:last-child {
    flex: 2 1 400px;      /* Progress card gets more space */
    min-width: 350px;
}

/* Progress bar card compactness improvements */
.dashboard-flex-row .card:last-child .card-body p {
    margin-bottom: 0.5rem;
}

.dashboard-flex-row .card:last-child .progress {
    margin-bottom: 0;
}

/* Mobile Responsive Styles */
@media (max-width: 1200px) {
    .main-container {
        padding: 30px;
    }
    
    .page-title {
        font-size: 32px;
    }
    
    .dashboard-flex-row .card:last-child {
        flex: 1 1 350px;
        min-width: 300px;
    }
}

/* Tablet-specific styles (iPad and similar devices) */
@media (min-width: 768px) and (max-width: 1024px) {
    .dashboard-flex-row .card:last-child {
        max-height: 160px !important;
        overflow: hidden;
    }
    
    .dashboard-flex-row .card:last-child .card-body {
        padding: 0.85rem 1rem 0.7rem 1rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .progress {
        height: 20px !important;
        margin-top: 8px;
        margin-bottom: 0 !important;
    }
    
    .progress-bar span {
        font-size: 13px;
    }
    
    .dashboard-flex-row .card:last-child .card-body p {
        margin-bottom: 0.3rem;
        font-size: 0.95rem;
    }
}

/* iPad-specific styles */
@media only screen and (device-width: 768px) or (device-width: 810px) or (device-width: 834px) or (device-width: 1024px) {
    .dashboard-flex-row .card:last-child {
        max-height: 150px !important;
        min-height: 0 !important;
    }
    
    .dashboard-flex-row .card:last-child .card-body {
        max-height: 150px !important;
        padding: 0.8rem !important;
    }
    
    .progress {
        height: 18px !important;
    }
}

@media (max-width: 900px) {
    .dashboard-flex-row {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .dashboard-flex-row .card {
        max-width: 100%;
        min-width: 0;
        flex: 1 1 auto;
    }
    
    .page-title {
        font-size: 28px;
    }
    
    .page-subtitle {
        font-size: 15px;
        margin-bottom: 30px;
    }
}

@media (max-width: 768px) {
    .main-container {
        padding: 20px;
    }
    
    .page-title {
        font-size: 24px;
        text-align: center;
        margin-bottom: 12px;
    }
    
    .page-subtitle {
        font-size: 14px;
        text-align: center;
        margin-bottom: 25px;
    }

    .table-container {
        padding: 16px;
        border-radius: 16px;
    }

    .table-header th,
    .table-cell {
        padding: 12px 8px;
        font-size: 13px;
    }
    
    .pagination {
        gap: 2px;
        flex-wrap: wrap;
    }
    
    .page-link {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    /* Dashboard cards mobile styling */
    .dashboard-flex-row {
        gap: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Progress card - reduce size to match other cards */
    .dashboard-flex-row .card:last-child .card-body {
        padding: 0.75rem 0.75rem 0.5rem 0.75rem;
    }
    
    .card-title {
        font-size: 1.5rem;
    }
    
    .card-text {
        font-size: 0.9rem;
    }
    
    /* Progress bar mobile adjustments */
    .progress {
        height: 18px !important;
        margin-top: 8px;
        margin-bottom: 0 !important;
    }
    
    .progress-bar span {
        font-size: 12px;
    }
    
    /* Reduce text size and spacing for the progress card */
    .dashboard-flex-row .card:last-child .card-body p {
        margin-bottom: 0.25rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .main-container {
        padding: 15px;
    }
    
    .page-title {
        font-size: 20px;
        margin-bottom: 8px;
    }
    
    .page-subtitle {
        font-size: 13px;
        margin-bottom: 20px;
    }
    
    .table-container {
        padding: 12px;
        border-radius: 12px;
    }
    
    .table-header th,
    .table-cell {
        padding: 10px 6px;
        font-size: 12px;
    }
    
    /* Make table horizontally scrollable on very small screens */
    .table-responsive {
        border-radius: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 500px;
    }
    
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
        gap: 1px;
    }
    
    .page-link {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 40px;
        text-align: center;
    }
    
    /* Welcome message mobile adjustments */
    h2.text-center {
        font-size: 1.3rem;
        margin-bottom: 1.5rem;
    }
    
    .card-title {
        font-size: 1.3rem;
    }
    
    .card-text {
        font-size: 0.85rem;
    }
    
    /* Alert styling for mobile */
    .alert {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .alert h4 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    /* Badge adjustments for mobile */
    .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
    
    .points-badge {
        padding: 3px 8px;
        font-size: 12px;
        min-width: 40px;
    }
    
    /* Further reduce the progress card padding */
    .dashboard-flex-row .card:last-child .card-body {
        padding: 0.5rem 0.5rem 0.4rem 0.5rem;
    }
    
    /* Make progress bar even smaller for mobile */
    .progress {
        height: 15px !important;
        margin-top: 4px;
    }
    
    .progress-bar span {
        font-size: 10px;
    }
    
    /* Fix the excessive height issue in mobile views */
    .dashboard-flex-row .card:last-child {
        max-height: 140px !important; /* Set strict height limit */
        overflow: hidden; /* Prevent content from expanding the card */
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 10px;
    }
    
    h2.text-center {
        font-size: 1.2rem;
        line-height: 1.3;
    }
    
    .dashboard-flex-row {
        gap: 0.75rem;
    }
    
    .card {
        border-radius: 12px;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    /* Smallest progress card padding for very small screens */
    .dashboard-flex-row .card:last-child .card-body {
        padding: 0.4rem 0.4rem 0.3rem 0.4rem;
    }
    
    /* Smallest progress bar for very small screens */
    .progress {
        height: 12px !important;
        margin-top: 3px;
    }
    
    .progress-bar span {
        font-size: 9px;
        line-height: 1;
    }
    
    /* Minimal text for very small screens */
    .dashboard-flex-row .card:last-child .card-body p {
        margin-bottom: 0.2rem;
        font-size: 0.8rem;
        line-height: 1.2;
    }
    
    /* Stricter height control for iPhone 12/13 and similar devices */
    .dashboard-flex-row .card:last-child {
        max-height: 110px !important;
        height: auto !important;
    }
    
    /* Force the progress bar card to have similar height to other cards */
    .dashboard-flex-row .card:last-child .card-body {
        display: flex;
        flex-direction: column;
        justify-content: center;
        height: auto !important;
        min-height: 0 !important;
        max-height: 110px !important;
        box-sizing: border-box;
    }
    
    .table-container {
        padding: 10px;
    }
    
    /* Stack pagination items vertically if needed */
    .pagination {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .pagination .page-item {
        display: inline-block;
        margin: 0 2px;
    }
    
    .pagination .page-item:first-child,
    .pagination .page-item:last-child {
        order: -1;
        margin-bottom: 8px;
    }
}

/* iPhone-specific fixes */
@media only screen and (device-width: 428px) or (device-width: 390px) or (device-width: 414px) {
    .dashboard-flex-row .card:last-child {
        max-height: 100px !important;
    }
    
    .dashboard-flex-row .card:last-child .card-body {
        padding: 0.3rem !important;
        max-height: 100px !important;
    }
    
    .progress {
        height: 10px !important;
        margin-top: 2px !important;
        margin-bottom: 0 !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .page-link,
    .back-btn,
    .table-header th {
        min-height: 44px; /* Minimum touch target size */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .table-row:hover {
        background: inherit; /* Remove hover effects on touch devices */
    }
}

.dashboard-header .form-select.form-select-sm {
    height: 37px;           /* Match .btn-sm height */
    min-height: 37px;
    padding-top: 0;         /* Remove extra vertical padding */
    padding-bottom: 0;
    padding-left: 1rem;
    padding-right: 1rem;
    box-shadow: 0 0 8px rgba(88, 80, 160, 0.15);
}

.dashboard-header .form-select.form-select-sm:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 2px #2563eb33;
}