/* ============================================ */
/* MOBILE RESPONSIVE STYLES - IMPROVED VERSION  */
/* ============================================ */

/* Base Mobile Styles (max-width: 768px) */
@media (max-width: 768px) {
    /* ===== GENERAL ===== */
    .container {
        padding-left: 15px;
        padding-right: 15px;
        width: 100%;
    }
    
    body {
        font-size: 14px;
        overflow-x: hidden;
    }
    
    /* ===== TYPOGRAPHY ===== */
    h1, .h1 { font-size: 1.75rem; }
    h2, .h2 { font-size: 1.5rem; }
    h3, .h3 { font-size: 1.25rem; }
    h4, .h4 { font-size: 1.1rem; }
    h5, .h5 { font-size: 1rem; }
    h6, .h6 { font-size: 0.9rem; }
    
    /* ===== NAVBAR ===== */
    .navbar {
        padding: 10px 0;
    }
    
    .nav-brand {
        font-size: 1.2rem;
    }
    
    .navbar-collapse {
        background: white;
        padding: 15px;
        border-radius: 10px;
        margin-top: 10px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .navbar-nav {
        margin: 0;
        padding: 0;
    }
    
    .nav-item {
        margin: 5px 0;
    }
    
    .nav-link {
        padding: 10px 15px !important;
    }
    
    /* ===== SIDEBAR (Dashboards) ===== */
    .sidebar,
    .admin-sidebar,
    .user-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 280px;
        height: 100vh;
        transition: left 0.3s ease;
        z-index: 1050;
        overflow-y: auto;
    }
    
    .sidebar.active,
    .admin-sidebar.active,
    .user-sidebar.active {
        left: 0;
    }
    
    /* Sidebar overlay */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
        display: none;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Mobile menu toggle button */
    .mobile-menu-toggle {
        display: block;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1060;
        background: var(--primary-gradient, linear-gradient(135deg, #667eea, #764ba2));
        border: none;
        color: white;
        width: 45px;
        height: 45px;
        border-radius: 12px;
        font-size: 1.2rem;
        box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    }
    
    /* Adjust main content when sidebar is hidden */
    .content-wrapper,
    .admin-main-content,
    .user-main-content {
        margin-left: 0 !important;
        padding: 70px 15px 20px 15px !important;
    }
    
    /* ===== TABLES ===== */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Convert tables to cards on mobile */
    .table-responsive-card thead {
        display: none;
    }
    
    .table-responsive-card tr {
        display: block;
        margin-bottom: 16px;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        background: white;
        padding: 12px;
    }
    
    .table-responsive-card td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .table-responsive-card td:last-child {
        border-bottom: none;
    }
    
    .table-responsive-card td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 15px;
        color: #4b5563;
        font-size: 0.85rem;
    }
    
    /* ===== CARDS & GRID ===== */
    .row {
        margin-left: -8px;
        margin-right: -8px;
    }
    
    [class*="col-"] {
        padding-left: 8px;
        padding-right: 8px;
        margin-bottom: 16px;
    }
    
    /* Product cards */
    .product-card {
        margin-bottom: 16px;
    }
    
    .product-image img {
        height: 150px !important;
        object-fit: cover;
    }
    
    .product-title {
        font-size: 0.9rem;
    }
    
    .product-price .current-price {
        font-size: 1rem;
    }
    
    /* Dashboard cards */
    .dashboard-card,
    .stat-card,
    .card {
        margin-bottom: 16px;
        padding: 16px;
    }
    
    /* Stats grid - 2 columns on mobile */
    .stats-grid,
    .row.g-4 {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    /* ===== BUTTONS ===== */
    .btn, 
    button,
    .action-btn,
    .btn-add-to-cart,
    .btn-book-vet,
    .btn-message-vet,
    .pay-now-btn,
    .review-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 6px 12px;
    }
    
    .btn-lg {
        min-height: 52px;
        padding: 12px 24px;
    }
    
    /* Button groups - stack vertically */
    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    /* ===== FORMS ===== */
    input, 
    select, 
    textarea,
    .form-control,
    .form-select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 10px 12px;
    }
    
    .form-label {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }
    
    /* ===== MODALS ===== */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        border-radius: 16px;
    }
    
    .modal-body {
        padding: 20px;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    /* Login modal on mobile */
    .modal-content-landscape {
        max-width: 95% !important;
        margin: 10px auto;
    }
    
    .modal-body-landscape {
        flex-direction: column;
    }
    
    .modal-brand-side {
        display: none;
    }
    
    .modal-forms-side {
        padding: 20px;
    }
    
    /* ===== CONSULTATION CARDS ===== */
    .consultation-card,
    .appointment-card {
        padding: 16px;
    }
    
    .consultation-card .row,
    .appointment-card .row {
        flex-direction: column;
    }
    
    .consultation-card .col-md-2,
    .consultation-card .col-md-3,
    .appointment-card .col-md-2,
    .appointment-card .col-md-3 {
        width: 100%;
        margin-bottom: 12px;
        text-align: left;
    }
    
    .appointment-actions {
        width: 100%;
        justify-content: flex-start;
        margin-top: 12px;
    }
    
    /* ===== MESSAGES PAGE ===== */
    .chat-wrapper {
        flex-direction: column;
        height: calc(100vh - 120px);
    }
    
    .conversations-sidebar {
        width: 100%;
        height: 280px;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .chat-area {
        height: calc(100% - 280px);
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .message-delete-btn {
        opacity: 1;
        width: 28px;
        height: 28px;
    }
    
    .message-item.own-message .message-delete-btn {
        left: -38px;
    }
    
    .message-item:not(.own-message) .message-delete-btn {
        right: -38px;
    }
    
    /* ===== VIDEO CALL PAGE ===== */
    #local-video-container {
        width: 100px;
        height: 75px;
        bottom: 70px;
        right: 10px;
    }
    
    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .controls-bar {
        bottom: 15px;
        gap: 10px;
    }
    
    /* ===== CHECKOUT PAGE ===== */
    .checkout-container .row {
        flex-direction: column;
    }
    
    .checkout-card {
        padding: 16px;
    }
    
    .payment-method {
        padding: 12px;
    }
    
    /* ===== FOOTER ===== */
    footer {
        text-align: center;
    }
    
    footer .row > div {
        margin-bottom: 24px;
    }
    
    .footer-bottom-links {
        justify-content: center;
        margin-top: 12px;
    }
    
    .copyright {
        text-align: center;
    }
}

/* ============================================ */
/* SMALL MOBILE (max-width: 480px)             */
/* ============================================ */
@media (max-width: 480px) {
    .hero-section h1,
    .hero-title {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .product-image img {
        height: 120px !important;
    }
    
    .product-title {
        font-size: 0.85rem;
    }
    
    /* Stack buttons */
    .hero-buttons,
    .cta-buttons,
    .button-group {
        flex-direction: column;
    }
    
    .hero-buttons .btn,
    .cta-buttons .btn,
    .button-group .btn {
        width: 100%;
        margin: 5px 0;
    }
    
    /* Filter sidebar */
    .filter-sidebar {
        position: static;
        margin-bottom: 20px;
    }
    
    .filter-widget {
        margin-bottom: 20px;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .page-link {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    
    /* Star ratings */
    .rating-stars i {
        font-size: 0.8rem;
    }
    
    /* Video call */
    #local-video-container {
        width: 80px;
        height: 60px;
    }
}

/* ============================================ */
/* TABLET (768px - 992px)                      */
/* ============================================ */
@media (min-width: 768px) and (max-width: 992px) {
    .container {
        max-width: 100%;
        padding: 0 20px;
    }
    
    .col-md-3 {
        width: 33.333%;
    }
    
    .col-md-4 {
        width: 50%;
    }
    
    .product-image img {
        height: 180px !important;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-card .row {
        margin: 0;
    }
}

/* ============================================ */
/* UTILITY CLASSES FOR RESPONSIVE              */
/* ============================================ */
.hide-on-mobile {
    display: inherit;
}

.show-on-mobile {
    display: none;
}

@media (max-width: 768px) {
    .hide-on-mobile {
        display: none !important;
    }
    
    .show-on-mobile {
        display: block !important;
    }
    
    .text-center-mobile {
        text-align: center !important;
    }
    
    .flex-column-mobile {
        flex-direction: column !important;
    }
    
    .w-100-mobile {
        width: 100% !important;
    }
    
    .mt-2-mobile {
        margin-top: 10px !important;
    }
    
    .mb-2-mobile {
        margin-bottom: 10px !important;
    }
}

/* Touch-friendly tap targets */
button,
a,
input[type="checkbox"],
input[type="radio"],
.close-btn,
.action-btn {
    cursor: pointer;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Prevent horizontal scroll */
body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}