/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #0d0d0d;
    color: #ffffff;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background-color: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    max-width: 600px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: #ffffff;
}

.logo-accent {
    color: #39FF14;
    font-weight: 500;
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
}

.header-title {
    font-size: 1rem;
    color: #999;
    font-weight: 400;
}

/* Category Navigation */
.category-nav {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 99;
    background-color: #1a1a1a;
    padding: 12px 0;
    border-bottom: 1px solid #2a2a2a;
}

.category-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 0 20px;
    max-width: 600px;
    margin: 0 auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-scroll::-webkit-scrollbar {
    display: none;
}

.category-btn {
    flex-shrink: 0;
    padding: 10px 20px;
    border: 1px solid #3a3a3a;
    border-radius: 25px;
    background-color: transparent;
    color: #b8b8b8;
    font-size: 0.9rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.category-btn:hover {
    border-color: #555;
    background-color: #252525;
}

.category-btn.active {
    background-color: #39FF14;
    color: #0d0d0d;
    border-color: #39FF14;
    font-weight: 500;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.4);
}

/* Product Container */
.product-container {
    padding-top: 130px;
    padding-bottom: 40px;
    max-width: 600px;
    margin: 0 auto;
}

.product-list {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Product Card */
.product-card {
    background-color: #1a1a1a;
    border: 1px solid #39FF14;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.3),
                inset 0 0 20px rgba(57, 255, 20, 0.05);
}

.product-card:active {
    transform: scale(0.98);
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.5),
                inset 0 0 25px rgba(57, 255, 20, 0.08);
}

.product-image-container {
    flex-shrink: 0;
    width: 110px;
    height: 110px;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    background-color: #2a2a2a;
}

.product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 6px;
    line-height: 1.3;
}

.product-description {
    font-size: 0.9rem;
    color: #888;
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: #39FF14;
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.3);
}

.product-badge {
    display: inline-block;
    width: fit-content;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    background-color: #39FF14;
    color: #0d0d0d;
    box-shadow: 0 0 12px rgba(57, 255, 20, 0.5);
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    gap: 12px;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #2a2a2a;
    border-top-color: #39FF14;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
}

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

.loading-indicator p {
    color: #666;
    font-size: 0.9rem;
}

/* End Message */
.end-message {
    text-align: center;
    padding: 30px;
    color: #555;
    font-size: 0.9rem;
}

/* Initial Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #0d0d0d;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    padding: 20px;
}

.loading-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: #ffffff;
    margin-bottom: 30px;
}

.loading-logo-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.loading-bar-container {
    width: 200px;
    height: 4px;
    background-color: #2a2a2a;
    border-radius: 2px;
    margin: 0 auto 20px;
    overflow: hidden;
}

.loading-bar {
    height: 100%;
    width: 0%;
    background-color: #39FF14;
    border-radius: 2px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
}

.loading-text {
    color: #666;
    font-size: 0.9rem;
}

/* Error Screen */
.error-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #0d0d0d;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.error-content {
    text-align: center;
    padding: 20px;
}

.error-icon {
    width: 60px;
    height: 60px;
    border: 3px solid #e74c3c;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    font-weight: bold;
    color: #e74c3c;
}

.error-content h2 {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.error-content p {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 25px;
}

.retry-btn {
    padding: 12px 30px;
    background-color: #39FF14;
    color: #0d0d0d;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.4);
}

.retry-btn:hover {
    background-color: #45ff24;
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.6);
}

/* Product Detail Modal */
.product-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #0d0d0d;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow-y: auto;
}

.product-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    display: flex;
    justify-content: flex-end;
    padding: 16px;
    background: linear-gradient(to bottom, rgba(13, 13, 13, 0.95) 0%, transparent 100%);
}

.modal-close {
    width: 44px;
    height: 44px;
    border: 1px solid #39FF14;
    border-radius: 50%;
    background-color: rgba(13, 13, 13, 0.8);
    color: #39FF14;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
}

.modal-close:active {
    transform: scale(0.95);
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.5);
}

.modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.modal-image-container {
    width: 100%;
    aspect-ratio: 1;
    max-height: 50vh;
    overflow: hidden;
    background-color: #1a1a1a;
}

.modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-info {
    flex: 1;
    padding: 24px 20px;
    background-color: #0d0d0d;
    border-top: 1px solid #39FF14;
    box-shadow: 0 -5px 20px rgba(57, 255, 20, 0.2);
}

.modal-badge {
    display: none;
    width: fit-content;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
    background-color: #39FF14;
    color: #0d0d0d;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.5);
}

.modal-badge.visible {
    display: inline-block;
}

.modal-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 16px;
    line-height: 1.3;
}

.modal-description {
    font-size: 1rem;
    color: #aaa;
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: #39FF14;
    text-shadow: 0 0 15px rgba(57, 255, 20, 0.4);
    margin-bottom: 16px;
}

.modal-category {
    font-size: 0.85rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Safe area support for modal */
@supports (padding-top: env(safe-area-inset-top)) {
    .modal-header {
        padding-top: calc(16px + env(safe-area-inset-top));
    }

    .modal-info {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Image Loading Placeholder */
.product-image.loading {
    background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Responsive Adjustments */
@media screen and (max-width: 380px) {
    .header-content {
        padding: 14px 16px;
    }

    .logo {
        font-size: 1.3rem;
    }

    .category-scroll {
        padding: 0 16px;
        gap: 8px;
    }

    .category-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .product-list {
        padding: 12px;
        gap: 12px;
    }

    .product-card {
        padding: 12px;
        gap: 12px;
    }

    .product-image-container {
        width: 90px;
        height: 90px;
    }

    .product-name {
        font-size: 1rem;
    }

    .product-description {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }

    .product-price {
        font-size: 1rem;
    }
}

@media screen and (min-width: 601px) {
    .product-card {
        padding: 20px;
    }

    .product-image-container {
        width: 130px;
        height: 130px;
    }

    .product-name {
        font-size: 1.2rem;
    }
}

/* Safe area for notched phones */
@supports (padding-top: env(safe-area-inset-top)) {
    .header {
        padding-top: env(safe-area-inset-top);
    }

    .product-container {
        padding-bottom: calc(40px + env(safe-area-inset-bottom));
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Touch feedback */
.category-btn:active,
.retry-btn:active {
    opacity: 0.8;
}

/* Prevent text selection on interactive elements */
.category-btn,
.product-card,
.retry-btn {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
