/* ============================================
   LISTING PAGE STYLES - FULLY MOBILE RESPONSIVE
   ChikakuMarket
   ============================================ */

:root {
    --primary: #7B2CBF;
    --primary-light: #9D4EDD;
    --primary-dark: #5A189A;
    --secondary: #F77F00;
    --success: #10B981;
    --warning: #EF4444;
    --dark: #1A1A1A;
    --gray: #6B7280;
    --gray-light: #E5E7EB;
    --light: #FFFFFF;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --radius-md: 12px;
    --radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #F9FAFB;
    color: var(--dark);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Header */
.header {
    background: var(--light);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1rem;
}

.logo-text {
    display: none;
}

.nav-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.nav-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.sell-btn {
    background: linear-gradient(135deg, var(--secondary), #FF9E00);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: transform 0.2s;
}

.sell-btn span {
    display: none;
}

.sell-btn i {
    font-size: 0.9rem;
}

.profile-link {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
    color: var(--dark);
    padding: 0.4rem;
    font-size: 0.75rem;
}

.profile-link span {
    display: none;
}

/* ============================================
   CART BUTTON & DROPDOWN - MOBILE FRIENDLY
   ============================================ */

.cart-wrapper {
    position: relative;
}

.cart-btn {
    background: none;
    border: none;
    position: relative;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--dark);
    padding: 0.4rem;
    transition: all 0.2s ease;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary);
    color: white;
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cart Dropdown */
.cart-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 340px;
    max-width: calc(100vw - 20px);
    background: var(--light);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
    overflow: hidden;
    border: 1px solid var(--gray-light);
}

.cart-dropdown.show {
    display: block;
    animation: slideDown 0.25s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Cart Dropdown */
@media (max-width: 768px) {
    .cart-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 65vh;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -5px 25px rgba(0,0,0,0.15);
    }
    
    .cart-dropdown.show {
        animation: slideUp 0.3s ease;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-light);
    background: var(--light);
}

.cart-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.close-cart {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--gray);
    padding: 5px;
    transition: all 0.2s;
}

.cart-items {
    max-height: 320px;
    overflow-y: auto;
    padding: 8px;
}

.empty-cart-message {
    text-align: center;
    padding: 30px 16px;
    color: var(--gray);
}

.empty-cart-message i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.empty-cart-message p {
    font-size: 0.85rem;
}

.cart-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--gray-light);
}

.cart-item-image {
    width: 50px;
    height: 50px;
    background: #F3F4F6;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-title {
    font-weight: 500;
    font-size: 0.8rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 6px;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.quantity-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--gray-light);
    background: var(--light);
    cursor: pointer;
    font-weight: bold;
    font-size: 0.8rem;
}

.remove-item {
    background: none;
    border: none;
    color: var(--warning);
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
}

.cart-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--gray-light);
    background: var(--light);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.cart-total span:last-child {
    color: var(--primary);
    font-size: 1rem;
}

#checkoutBtn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

/* No Backdrop */
.cart-backdrop {
    display: none !important;
}

/* Floating Cart Button */
.floating-buttons {
    position: fixed;
    bottom: 80px;
    right: 16px;
    display: none;
    z-index: 998;
}

.floating-cart-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    position: relative;
}

.floating-cart-btn i {
    font-size: 1.1rem;
}

.floating-cart-btn span {
    font-size: 0.55rem;
}

.floating-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 0.6rem;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 0.3s ease-in-out;
}

/* Main Container */
.listing-main {
    max-width: 1280px;
    margin: 1rem auto;
    padding: 0 1rem;
}

/* Loading State */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 1rem;
    font-size: 0.7rem;
    color: var(--gray);
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--gray);
    text-decoration: none;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    background: var(--light);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

/* Gallery Section */
.product-gallery {
    position: static;
}

.main-image-container {
    position: relative;
    background: #F3F4F6;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.prev-image, .next-image {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
}

.prev-image {
    left: 0.5rem;
}

.next-image {
    right: 0.5rem;
}

.thumbnail-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.thumbnail.active {
    border-color: var(--primary);
}

/* Product Info */
.product-category {
    display: inline-block;
    background: #F3F4F6;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    color: var(--gray);
    margin-bottom: 0.75rem;
}

.product-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.product-price-section {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.product-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.original-price {
    font-size: 0.85rem;
    color: var(--gray);
    text-decoration: line-through;
}

.discount-badge {
    background: var(--warning);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
}

.product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--gray-light);
    border-bottom: 1px solid var(--gray-light);
    margin-bottom: 0.75rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: var(--gray);
}

/* Description */
.product-description {
    margin-bottom: 1rem;
}

.product-description h3 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.product-description p {
    color: var(--gray);
    line-height: 1.5;
    font-size: 0.85rem;
}

/* Seller Card */
.seller-card {
    background: #F9FAFB;
    border-radius: var(--radius-md);
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--gray-light);
}

.seller-card h3 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.seller-details {
    display: flex;
    gap: 0.75rem;
}

.seller-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--gray);
    overflow: hidden;
    flex-shrink: 0;
}

.seller-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.seller-info {
    flex: 1;
    min-width: 0;
}

.seller-name {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.2rem;
    font-size: 0.85rem;
}

.verified-badge {
    color: var(--success);
    font-size: 0.7rem;
}

.seller-campus, .seller-rating, .seller-joined {
    font-size: 0.65rem;
    color: var(--gray);
    margin-top: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.btn-primary, .btn-outline, .btn-message, .btn-save {
    padding: 0.7rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.8rem;
    width: 100%;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

.btn-outline {
    background: white;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-message {
    background: #25D366;
    color: white;
}

.btn-save {
    background: white;
    border: 2px solid #EF4444;
    color: #EF4444;
}

/* Safety Info */
.safety-info {
    border-top: 1px solid var(--gray-light);
    padding-top: 0.75rem;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    color: var(--gray);
    margin-bottom: 0.4rem;
}

/* Similar Products */
.similar-products {
    margin-top: 1.5rem;
}

.similar-products h2 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.similar-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.similar-card {
    background: var(--light);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.similar-card-image {
    aspect-ratio: 1;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.similar-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.similar-card-info {
    padding: 0.5rem;
}

.similar-card-title {
    font-weight: 600;
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.similar-card-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.8rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 80px;
    left: 16px;
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--dark);
    color: white;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    width: 100%;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--warning); }
.toast.info { background: var(--primary); }

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   DESKTOP STYLES
   ============================================ */

@media (min-width: 769px) {
    .nav-container {
        padding: 1rem 2rem;
    }
    
    .logo-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .logo-text {
        display: flex;
        margin-left: 0.5rem;
    }
    
    .logo-main {
        font-size: 1.1rem;
    }
    
    .logo-tagline {
        font-size: 0.7rem;
    }
    
    .sell-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .sell-btn span {
        display: inline;
    }
    
    .profile-link span {
        display: inline;
    }
    
    .profile-link {
        font-size: 0.875rem;
    }
    
    .listing-main {
        margin: 2rem auto;
        padding: 0 2rem;
    }
    
    .product-grid {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
        padding: 2rem;
    }
    
    .product-gallery {
        position: sticky;
        top: 100px;
    }
    
    .product-title {
        font-size: 1.75rem;
    }
    
    .product-price {
        font-size: 2rem;
    }
    
    .action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .btn-primary, .btn-outline, .btn-message, .btn-save {
        width: auto;
        flex: 1;
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
    }
    
    .similar-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .similar-card-title {
        font-size: 0.875rem;
    }
    
    .toast-container {
        bottom: 20px;
        right: 20px;
        left: auto;
        width: auto;
        min-width: 300px;
    }
    
    .floating-buttons {
        display: none !important;
    }
}

/* Extra Small Devices (iPhone SE, small phones) */
@media (max-width: 380px) {
    .nav-container {
        padding: 0.6rem 0.8rem;
    }
    
    .listing-main {
        padding: 0 0.8rem;
        margin: 0.8rem auto;
    }
    
    .product-grid {
        padding: 0.8rem;
    }
    
    .product-title {
        font-size: 1.1rem;
    }
    
    .product-price {
        font-size: 1.3rem;
    }
    
    .thumbnail {
        width: 50px;
        height: 50px;
    }
    
    .similar-grid {
        gap: 0.6rem;
    }
    
    .similar-card-title {
        font-size: 0.65rem;
    }
    
    .similar-card-price {
        font-size: 0.7rem;
    }
    
    .cart-dropdown {
        max-height: 60vh;
    }
    
    .cart-items {
        max-height: 280px;
    }
}

/* Landscape Mode on Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .cart-dropdown {
        max-height: 80vh;
    }
    
    .cart-items {
        max-height: 300px;
    }
    
    .product-grid {
        gap: 1rem;
    }
}