/* Mobile Responsive Styles for Porosi.mk */
/* Comprehensive mobile-first responsive design */

/* =========================================
   Global Mobile Styles
   ========================================= */

/* Touch-friendly tap targets */
@media (max-width: 768px) {
    .btn, button, .nav-link, .dropdown-item, a.list-group-item {
        min-height: 44px;
        padding-top: 10px;
        padding-bottom: 10px;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Page titles */
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.35rem;
    }
    
    h3, h4, h5 {
        font-size: 1.15rem;
    }
    
    /* Cards */
    .card {
        border-radius: 12px;
        margin-bottom: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Forms */
    .form-control, .form-select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }
    
    .form-label {
        font-size: 0.9rem;
        font-weight: 600;
    }
    
    /* Buttons */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
    }
    
    .btn-group .btn, .btn-group-sm .btn {
        padding: 0.5rem 0.65rem;
    }
    
    /* Tables - hide on very small screens */
    .table-responsive {
        margin: 0 -1rem;
        width: calc(100% + 2rem);
    }
    
    /* Flex utility for mobile */
    .flex-column-mobile {
        flex-direction: column !important;
    }
    
    /* Hide on mobile */
    .d-mobile-none {
        display: none !important;
    }
    
    /* Show only on mobile */
    .d-mobile-block {
        display: block !important;
    }
    
    /* Full width on mobile */
    .w-mobile-100 {
        width: 100% !important;
    }
    
    /* Spacing adjustments */
    .mt-4, .my-4 {
        margin-top: 1rem !important;
    }
    
    .mb-4, .my-4 {
        margin-bottom: 1rem !important;
    }
    
    .py-4 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
}

/* =========================================
   Vendor Profile Page
   ========================================= */

@media (max-width: 768px) {
    /* Stack columns on mobile */
    .vendor-profile .col-md-8,
    .vendor-profile .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Profile header responsive */
    .vendor-profile .card-header {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    
    .vendor-profile .card-header h4 {
        font-size: 1.25rem;
        margin-bottom: 0;
    }
    
    .vendor-profile .card-header .btn {
        width: 100%;
    }
    
    /* Business info layout */
    .vendor-profile .row.mb-4 .col-md-3,
    .vendor-profile .row.mb-4 .col-md-9,
    .vendor-profile .row.mb-4 .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 1rem;
    }
    
    /* Logo centered on mobile */
    .vendor-profile .col-md-3 {
        text-align: center;
    }
    
    .vendor-profile .col-md-3 img,
    .vendor-profile .col-md-3 .bg-secondary {
        margin: 0 auto;
    }
    
    /* Quick actions full width */
    .vendor-profile .d-grid .btn {
        font-size: 0.9rem;
        padding: 0.75rem;
    }
    
    /* Profile completion list */
    .vendor-profile .progress {
        height: 1.5rem;
    }
}

/* =========================================
   Vendor Profile Edit Page
   ========================================= */

@media (max-width: 768px) {
    /* Stack form columns */
    .vendor-edit .col-md-6,
    .vendor-edit .col-md-4,
    .vendor-edit .col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Map container */
    .map-container {
        height: 280px !important;
    }
    
    .map-controls {
        flex-wrap: wrap;
    }
    
    .map-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    /* Logo upload section */
    .vendor-edit .row .col-md-4 img,
    .vendor-edit .row .col-md-4 .bg-light {
        max-height: 120px;
        width: 120px;
        margin: 0 auto 1rem;
    }
    
    /* Form buttons */
    .vendor-edit .d-flex.justify-content-between {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .vendor-edit .d-flex.justify-content-between .btn {
        width: 100%;
    }
    
    /* Help card */
    .vendor-edit .col-md-4 .card {
        margin-top: 1rem;
    }
}

/* =========================================
   Products Manage Page
   ========================================= */

@media (max-width: 991px) {
    /* Header responsive */
    .products-manage .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch !important;
    }
    
    .products-manage .d-flex.justify-content-between h1 {
        font-size: 1.25rem;
        text-align: center;
    }
    
    .products-manage .d-flex.justify-content-between .btn {
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    /* Show mobile cards */
    .products-manage .mobile-product-cards {
        display: block !important;
    }
    
    /* Product card mobile styles */
    .mobile-product-card {
        background: white;
        border-radius: 12px;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        border: 1px solid #e5e7eb;
    }
    
    .mobile-product-card .product-header {
        display: flex;
        align-items: center;
        gap: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .mobile-product-card .product-image {
        width: 60px;
        height: 60px;
        border-radius: 8px;
        object-fit: cover;
    }
    
    .mobile-product-card .product-info h6 {
        margin: 0;
        font-size: 1rem;
        font-weight: 600;
    }
    
    .mobile-product-card .product-info small {
        color: #6b7280;
    }
    
    .mobile-product-card .product-details {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        margin-bottom: 0.75rem;
        padding: 0.75rem;
        background: #f9fafb;
        border-radius: 8px;
    }
    
    .mobile-product-card .product-details .detail-item {
        display: flex;
        flex-direction: column;
    }
    
    .mobile-product-card .product-details .detail-label {
        font-size: 0.75rem;
        color: #6b7280;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .mobile-product-card .product-details .detail-value {
        font-weight: 600;
        color: #111827;
    }
    
    .mobile-product-card .product-actions {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .mobile-product-card .product-actions .btn {
        flex: 1;
        min-width: calc(50% - 0.25rem);
        padding: 0.5rem;
        font-size: 0.85rem;
    }
}

/* =========================================
   Dashboard Pages (all roles)
   ========================================= */

@media (max-width: 768px) {
    /* Stats cards */
    .dashboard-stats .col-md-3,
    .dashboard-stats .col-md-4,
    .dashboard-stats .col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
        padding: 0.25rem;
    }
    
    .dashboard-stats .card-body {
        padding: 0.75rem;
        text-align: center;
    }
    
    .dashboard-stats h2, 
    .dashboard-stats h3 {
        font-size: 1.5rem;
    }
    
    .dashboard-stats p,
    .dashboard-stats small {
        font-size: 0.75rem;
    }
    
    /* Dashboard grid layout */
    .dashboard .col-md-6,
    .dashboard .col-md-4,
    .dashboard .col-lg-4,
    .dashboard .col-lg-6,
    .dashboard .col-lg-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Order list items */
    .order-list .list-group-item {
        padding: 0.75rem;
    }
    
    .order-list .d-flex {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* =========================================
   Order Pages
   ========================================= */

@media (max-width: 768px) {
    /* Order cards */
    .order-card {
        padding: 1rem;
    }
    
    .order-card .row {
        flex-direction: column;
    }
    
    .order-card .col-md-6,
    .order-card .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Order items list */
    .order-items .d-flex {
        flex-wrap: wrap;
    }
    
    .order-items img {
        width: 50px !important;
        height: 50px !important;
    }
    
    /* Order status timeline */
    .order-timeline {
        padding-left: 1.5rem;
    }
    
    .order-timeline::before {
        left: 0.75rem;
    }
}

/* =========================================
   Cart Page
   ========================================= */

@media (max-width: 768px) {
    .cart-item {
        padding: 1rem;
    }
    
    .cart-item img {
        width: 60px !important;
        height: 60px !important;
    }
    
    .cart-summary {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 1rem;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
        margin: 0 -15px;
        width: calc(100% + 30px);
    }
}

/* =========================================
   Checkout Page with Map
   ========================================= */

@media (max-width: 768px) {
    .checkout-map-container {
        height: 250px !important;
    }
    
    .checkout-form .col-md-6,
    .checkout-form .col-md-8,
    .checkout-form .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* =========================================
   Driver Dashboard
   ========================================= */

@media (max-width: 768px) {
    .driver-dashboard .delivery-card {
        padding: 1rem;
    }
    
    .driver-dashboard .delivery-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .driver-dashboard .delivery-actions .btn {
        width: 100%;
    }
    
    .driver-dashboard .map-container {
        height: 200px !important;
    }
}

/* =========================================
   Admin Pages
   ========================================= */

@media (max-width: 768px) {
    /* Admin sidebar */
    .admin-sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    
    /* Admin stats */
    .admin-stats .col-md-3,
    .admin-stats .col-lg-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    /* Admin tables */
    .admin-table th:nth-child(n+4),
    .admin-table td:nth-child(n+4) {
        display: none;
    }
}

/* =========================================
   Product Detail Page
   ========================================= */

@media (max-width: 768px) {
    .product-detail .col-md-6,
    .product-detail .col-lg-5,
    .product-detail .col-lg-7 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .product-detail .product-image {
        max-height: 300px;
        margin-bottom: 1rem;
    }
    
    .product-detail .quantity-selector {
        width: 100%;
        justify-content: center;
        margin-bottom: 1rem;
    }
    
    .product-detail .add-to-cart-btn {
        width: 100%;
    }
}

/* =========================================
   Search & Filter Pages
   ========================================= */

@media (max-width: 768px) {
    .search-filters {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: white;
        padding: 1rem;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
    }
    
    .search-input {
        font-size: 16px !important;
    }
    
    .filter-chips {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .filter-chip {
        display: inline-block;
        margin-right: 0.5rem;
    }
}

/* =========================================
   Modal Adjustments
   ========================================= */

@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 16px;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 0;
    }
}

/* =========================================
   Navbar Mobile Adjustments
   ========================================= */

@media (max-width: 991px) {
    .navbar-collapse {
        background: white;
        padding: 1rem;
        border-radius: 12px;
        margin-top: 0.5rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .navbar .dropdown-menu {
        border: none;
        box-shadow: none;
        padding-left: 1rem;
    }
    
    .navbar .nav-link {
        padding: 0.75rem 1rem;
    }
}

/* =========================================
   Footer Mobile Adjustments
   ========================================= */

@media (max-width: 768px) {
    footer {
        padding: 2rem 1rem;
    }
    
    footer .col-md-3,
    footer .col-md-4,
    footer .col-lg-3 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 1.5rem;
        text-align: center;
    }
    
    footer .social-links {
        justify-content: center;
    }
}

/* =========================================
   Utility Classes for Mobile
   ========================================= */

@media (max-width: 768px) {
    /* Text alignment */
    .text-mobile-center {
        text-align: center !important;
    }
    
    .text-mobile-left {
        text-align: left !important;
    }
    
    /* Padding adjustments */
    .p-mobile-2 {
        padding: 0.5rem !important;
    }
    
    .p-mobile-3 {
        padding: 1rem !important;
    }
    
    /* Margin adjustments */
    .m-mobile-0 {
        margin: 0 !important;
    }
    
    .mb-mobile-3 {
        margin-bottom: 1rem !important;
    }
    
    /* Gap adjustments */
    .gap-mobile-2 {
        gap: 0.5rem !important;
    }
    
    /* Order for flex items */
    .order-mobile-1 {
        order: 1 !important;
    }
    
    .order-mobile-2 {
        order: 2 !important;
    }
}

/* =========================================
   Safe Area for iOS
   ========================================= */

@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
    
    .modal-footer,
    .cart-summary,
    .checkout-actions {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* =========================================
   Print Styles (Hide on Print)
   ========================================= */

@media print {
    .navbar, footer, .map-container, .btn, .dropdown-menu {
        display: none !important;
    }
}
