@media (min-width: 992px) {
    .cart-page-container {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 2rem;
    }
}

@media (max-width: 1024px) {
    /* Tablet styles */
    .main-nav {
        gap: 10px;
    }
    
    .nav-item {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .nav-item i {
        margin-right: 5px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 70px;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .main-nav {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        background: white;
        flex-direction: column;
        padding: 20px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 999;
        gap: 0;
    }
    
    .main-nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-item {
        padding: 15px;
        border-bottom: 1px solid #f0f0f0;
        justify-content: flex-start;
        width: 100%;
    }
    
    .nav-item:last-child {
        border-bottom: none;
    }
    
    /* Show mobile user name only on mobile */
    .user-name-desktop {
        display: none;
    }
    
    .user-name-mobile {
        display: inline;
    }
    
    /* Adjust account link layout for mobile */
    .nav-item.account-link {
        border-radius: 8px;
        padding: 12px 15px;
        margin: 0;
        justify-content: flex-start;
        width: 100%;
    }
    
    .logo-text {
        font-size: 18px;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .providers-grid {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
    
    .provider-card {
        padding: 20px 15px;
        margin: 0 10px;
    }
    
    .provider-name {
        font-size: 1.3rem;
    }
    
    .provider-description {
        font-size: 0.85rem;
        min-height: 70px;
    }
    
    .view-bundles-btn {
        padding: 10px 20px;
    }
    
    /* UPDATED: Hide the desktop wallet specifically */
    .desktop-wallet {
        display: none;
    }
    
    /* UPDATED: Ensure the mobile wallet is displayed */
    .mobile-wallet {
        display: block;
        text-align: center;
        margin-bottom: 1rem;
        padding: 0.75rem;
        background-color: #e8f4ff;
        border-radius: 8px;
        font-weight: 600;
    }
    
    .main-content {
        padding-top: 10px;
        padding-bottom: 20px;
    }

    .cart-page-container {
        padding: 0 10px;
        gap: 1rem;
    }

    .summary-card {
        order: -1;
        margin-bottom: 1rem;
        padding: 1.2rem;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    /* Wallet section mobile styling */
    .wallet-section {
        margin-bottom: 1.5rem;
        padding: 1rem;
        background: linear-gradient(135deg, #e8f4ff 0%, #f0f8ff 100%);
        border-radius: 10px;
        border: 1px solid #d1e7ff;
    }
    
    .wallet-label {
        font-size: 0.9rem;
        color: #6c757d;
        margin-bottom: 0.5rem;
        font-weight: 500;
    }
    
    .wallet-amount {
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--text-dark);
        margin-bottom: 1rem;
    }
    
    .top-up-btn {
        width: 100%;
        padding: 10px 16px;
        background: var(--mtn-yellow);
        color: #1a1a1a;
        border: none;
        border-radius: 8px;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        transition: all 0.2s ease;
    }
    
    .top-up-btn:hover {
        background: #e6b800;
        transform: translateY(-1px);
    }
    
    .top-up-btn i {
        font-size: 1rem;
    }
    
    /* Summary details mobile styling */
    .summary-details {
        margin-bottom: 1.5rem;
        padding: 1rem;
        background: #f8f9fa;
        border-radius: 10px;
    }
    
    .total-amount, .total-count {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.75rem;
    }
    
    .total-amount:last-child, .total-count:last-child {
        margin-bottom: 0;
    }
    
    .total-amount .label, .total-count .label {
        font-size: 0.9rem;
        color: #6c757d;
        font-weight: 500;
    }
    
    .total-amount .value {
        font-size: 1.3rem;
        font-weight: 700;
        color: var(--text-dark);
    }
    
    .total-count .value {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text-dark);
    }
    
    /* Checkout button mobile styling */
    .checkout-btn {
        width: 100%;
        padding: 14px 20px;
        background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
        color: white;
        border: none;
        border-radius: 10px;
        font-size: 1.1rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        transition: all 0.2s ease;
        box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    }
    
    .checkout-btn:hover {
        background: linear-gradient(135deg, #218838 0%, #1ea085 100%);
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
    }
    
    .checkout-btn i {
        font-size: 1.2rem;
    }

    .cart-section {
        padding: 1rem;
        border-radius: 10px;
    }

    .cart-section h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
        color: var(--text-dark);
        font-weight: 600;
    }
    
    /* Back link mobile styling */
    .back-link {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: var(--mtn-yellow);
        text-decoration: none;
        font-weight: 500;
        margin-bottom: 1.5rem;
        padding: 8px 0;
        transition: color 0.2s ease;
    }
    
    .back-link:hover {
        color: #e6b800;
    }
    
    .back-link i {
        font-size: 1rem;
    }
    
    /* Mobile Table as Cards */
    .cart-table-container {
        border: none;
        overflow-x: visible;
    }
    
    .cart-table {
        min-width: 100%;
    }
    
    .cart-table thead {
        display: none;
    }

    .cart-table, .cart-table tbody, .cart-table tr {
        display: block;
        width: 100%;
    }

    .cart-table tr {
        margin-bottom: 16px;
        border: 1px solid #e0e0e0;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        padding: 0;
        background-color: #fff;
        overflow: hidden;
    }

    .cart-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 15px;
        border-bottom: 1px solid #f0f0f0;
        text-align: right;
    }

    .cart-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-dark);
        text-align: left;
        padding-right: 15px;
        flex: 1;
    }
    
    .cart-table td span {
        text-align: right;
        flex: 1;
        word-break: break-word;
    }

    .cart-table tr:last-child {
        margin-bottom: 0;
    }
    
    .cart-table td:last-child {
        border-bottom: none;
        display: flex;
        justify-content: center;
        padding: 12px 15px;
        background-color: #f9f9f9;
    }
    
    .cart-table td:last-child::before {
        display: none;
    }
    
    .remove-btn {
        padding: 8px 16px;
        background-color: #dc3545;
        color: white;
        border-radius: 6px;
        font-weight: 600;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
    
    .remove-btn:hover {
        background-color: #c82333;
    }

    .remove-btn i {
        font-size: 1rem;
    }
    
    /* Phone input styling for mobile */
    .phone-input {
        width: 100%;
        padding: 8px 12px;
        border: 1px solid #ddd;
        border-radius: 6px;
        font-size: 14px;
        background: white;
    }
    
    .phone-input:focus {
        outline: none;
        border-color: var(--mtn-yellow);
        box-shadow: 0 0 0 2px rgba(255, 203, 5, 0.2);
    }
    
    /* Empty cart styling */
    .empty-cart {
        text-align: center;
        padding: 2rem 1rem;
        background: #f8f9fa;
        border-radius: 10px;
        margin: 1rem 0;
    }
    
    .empty-cart i {
        font-size: 3rem;
        color: #6c757d;
        margin-bottom: 1rem;
        display: block;
    }
    
    .empty-cart p {
        font-size: 1.1rem;
        color: #6c757d;
        margin-bottom: 1.5rem;
    }
    
    .empty-cart .btn {
        padding: 12px 24px;
        font-size: 1rem;
        border-radius: 8px;
    }
    
    .total-amount .value {
        font-size: 1.8rem;
    }
    
    /* Back link styling */
    .back-link {
        margin-bottom: 1rem;
        padding: 8px 0;
    }
    
    .modal-content {
        padding: 1.5rem;
        width: 95%;
    }
    
    .modal-title {
        font-size: 1.3rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .order-table {
        font-size: 0.8rem;
        min-width: 100%;
    }
    
    .order-table th, .order-table td {
        padding: 0.5rem 0.25rem;
    }
    
    footer {
        padding: 20px 0;
    }
    
    main {
        padding: 1rem;
    }
    
    .order-history-section {
        padding: 1rem;
        border-radius: 8px;
    }
    
    /* Make table responsive on mobile */
    .order-table-container {
        border: 1px solid #ddd;
        border-radius: 5px;
    }
    
    .order-table th:nth-child(1),
    .order-table td:nth-child(1) {
        min-width: 120px;
    }
    
    .order-table th:nth-child(2),
    .order-table td:nth-child(2) {
        min-width: 140px;
    }
    
    .phone-prefix {
        padding: 12px 10px;
        font-size: 14px;
    }
    
    .card-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    /* Additional mobile optimizations */
    .container {
        padding: 0 15px;
    }
    
    /* Account link mobile styling for small screens */
    .nav-item.account-link {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .user-name-mobile {
        font-size: 0.9rem;
        font-weight: 600;
    }
    
    h2 {
        font-size: 1.3rem;
        margin-bottom: 1.5rem;
    }
    
    .order-table {
        font-size: 0.75rem;
    }
    
    .order-table th, 
    .order-table td {
        padding: 0.4rem 0.2rem;
    }
    
    .order-table th:nth-child(1),
    .order-table td:nth-child(1) {
        min-width: 100px;
    }
    
    .order-table th:nth-child(2),
    .order-table td:nth-child(2) {
        min-width: 120px;
    }
    
    .footer-logo {
        font-size: 1.1rem;
    }
    
    .admin-dashboard-btn {
        margin-left: 0.5rem !important;
        font-size: 0.9rem !important;
        padding: 0.4rem 1rem !important;
    }
    
    .frontend-btn {
        padding: 6px 16px !important;
        font-size: 0.8rem !important;
        border-radius: 20px !important;
        min-height: 32px !important;
    }
    
    .frontend-btn span {
        display: none;
    }
    
    .bundles-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header h1 {
        font-size: 1.8rem;
    }
}