/*
 * Fabilive Responsive Fixes — A8 UI/UX Pass
 * Mobile-first responsive enhancements
 * Does NOT alter business logic — presentation only
 */

/* ========== BASE: Typography & Touch Targets ========== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Touch-friendly interactive elements (min 44px per WCAG) */
a, button, .btn, input[type="submit"], input[type="button"],
.nav-link, .dropdown-item, .list-group-item-action {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* ========== RESPONSIVE TABLES ========== */
.table-responsive-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.table-responsive-auto table {
    min-width: 600px;
}

/* ========== IMAGE OPTIMIZATION ========== */
img {
    max-width: 100%;
    height: auto;
}

.product-image, .listing-image, .gallery-image {
    object-fit: cover;
    width: 100%;
    border-radius: 8px;
}

/* ========== LOADING STATES ========== */
.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #3498db;
    animation: spin 0.8s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== EMPTY STATES ========== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #6c757d;
}

.empty-state i, .empty-state .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

/* ========== VOICE NOTE PLAYER ========== */
.voice-note-player {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: #f0f2f5;
    border-radius: 20px;
    max-width: 300px;
}

.voice-note-player .play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0d6efd;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.voice-note-player .waveform {
    flex: 1;
    height: 24px;
    background: linear-gradient(90deg, #0d6efd 0%, #6ea8fe 100%);
    border-radius: 4px;
    opacity: 0.3;
}

.voice-note-player .duration {
    font-size: 0.75rem;
    color: #6c757d;
    white-space: nowrap;
}

/* ========== FORM IMPROVEMENTS ========== */
.form-control, .form-select {
    min-height: 44px;
    font-size: 1rem;
}

.file-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.file-upload-area:hover {
    border-color: #0d6efd;
}

/* ========== BUTTON SPACING ========== */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-buttons .btn {
    white-space: nowrap;
}

/* ========== ORDER TRACKING TIMELINE ========== */
.order-timeline {
    position: relative;
    padding-left: 2rem;
}

.order-timeline::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dee2e6;
}

.order-timeline .timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
    padding-left: 1rem;
}

.order-timeline .timeline-item::before {
    content: '';
    position: absolute;
    left: -1.35rem;
    top: 0.25rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #dee2e6;
    border: 2px solid white;
}

.order-timeline .timeline-item.active::before {
    background: #198754;
}

/* ========== MOBILE RESPONSIVE ========== */

/* Extra small devices (phones, < 576px) */
@media (max-width: 575.98px) {
    .container, .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    h1, .h1 { font-size: 1.5rem; }
    h2, .h2 { font-size: 1.25rem; }
    h3, .h3 { font-size: 1.1rem; }

    .btn { font-size: 0.9rem; padding: 0.5rem 1rem; }

    /* Stack buttons vertically on small screens */
    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    /* Full-width cards on mobile */
    .card {
        margin-left: -12px;
        margin-right: -12px;
        border-radius: 0;
    }

    /* Navigation improvements */
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
    }

    /* Product grid: single column */
    .product-grid {
        grid-template-columns: 1fr;
    }
}

/* Small devices (landscape phones, 576–767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Medium devices (tablets, 768–991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Large devices (desktops, 992px+) */
@media (min-width: 992px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========== PRODUCT GRID ========== */
.product-grid {
    display: grid;
    gap: 1rem;
}

.product-card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* ========== CHAT LABEL FIX ========== */
/* "Chat with Delivery Agent" instead of "Chat with delivery boy" — handled in Blade */

/* ========== PRINT FRIENDLY ========== */
@media print {
    .no-print, .sidebar, .navbar, .footer {
        display: none !important;
    }

    .table-responsive-auto {
        overflow: visible;
    }

    .table-responsive-auto table {
        min-width: auto;
    }
}
