:root {
    --primary: #c93a4a;
    /* Reddish tone from reference */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
    --text-dark: #333;
    --text-light: #666;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: #f0f2f5;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.app-container {
    width: 100%;
    /* Mobile/Extension width */
    height: 100vh;
    /* Full height or constrained */
    /* max-height: 900px; Remove max height so it fills iframe */
    background: #fff;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Logo */
.logo {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
}

.logo-img {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Main Display */
.main-display {
    flex: 1;
    background: #eef0f4;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#userImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: opacity 0.3s;
}

.hidden {
    display: none !important;
}

/* Upload Buttons */
.upload-center {
    text-align: center;
}

.btn-upload-lg {
    padding: 15px 30px;
    background: var(--text-dark);
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.btn-upload-lg:hover {
    transform: scale(1.05);
}

.top-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    /* Adjusted left slightly to make room for sidebar */
    right: 70px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.btn-top {
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    backdrop-filter: blur(5px);
}

.search-box {
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    backdrop-filter: blur(5px);
    cursor: pointer;
}

/* Sidebar */
.sidebar-actions {
    position: absolute;
    top: 70px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
}

.btn-icon {
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    backdrop-filter: blur(5px);
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--primary);
}

/* Catalogue */
.catalogue-container {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 15px 0 20px 0;
    position: absolute;
    bottom: 0;
    width: 100%;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
}

.catalogue-container.collapsed {
    transform: translateY(100%);
}

.categories {
    display: flex;
    gap: 20px;
    padding: 0 20px 15px 20px;
    overflow-x: auto;
    font-weight: 500;
    color: var(--text-light);
    border-bottom: 1px solid #eee;
}

.categories span {
    cursor: pointer;
    padding-bottom: 5px;
    position: relative;
    white-space: nowrap;
    /* Prevent wrapping */
}

.categories span.active {
    color: var(--text-dark);
}

.categories span.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
}

.items-scroll {
    display: flex;
    gap: 15px;
    padding: 15px 20px 0 20px;
    overflow-x: auto;
    scroll-behavior: smooth;
}

.item-card {
    min-width: 100px;
    cursor: pointer;
    text-align: center;
}

.item-img-box {
    width: 100px;
    height: 120px;
    background: #f8f8f8;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.item-card.selected .item-img-box {
    border-color: var(--primary);
}

.item-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-name {
    font-size: 12px;
    color: var(--text-light);
}

.btn-view {
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    padding: 2px 0;
    width: 100%;
    display: block;
    margin-top: -20px;
    position: relative;
    z-index: 1;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Nav Arrows */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 5;
    color: var(--text-dark);
}

.nav-prev {
    left: 10px;
}

.nav-next {
    right: 10px;
}

/* Loading */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 30;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Mobile Tweaks for inside iframe */
@media (max-width: 480px) {
    .btn-upload-lg {
        padding: 10px 20px;
        font-size: 14px;
    }

    .logo-img {
        width: 40px;
        height: 40px;
    }

    .top-controls {
        right: 60px;
        gap: 5px;
    }

    .btn-top {
        padding: 6px 12px;
        font-size: 12px;
    }

    .catalogue-container {
        padding-bottom: 10px;
    }

    .item-img-box {
        width: 80px;
        height: 100px;
    }

    .item-card {
        min-width: 80px;
    }
}