:root {
    --bg-color: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #6366f1;
    --accent-hover: #4f46e5;
    --accent-gradient: linear-gradient(135deg, #6366f1, #a855f7);
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --error-color: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
}

/* Background Animations */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(120px);
    border-radius: 50%;
    opacity: 0.4;
    animation: float 20s infinite alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    max-width: 600px;
    max-height: 600px;
    background: #6366f1;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    max-width: 700px;
    max-height: 700px;
    background: #a855f7;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(100px, 50px) rotate(45deg); }
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 4rem 1.5rem;
    z-index: 1;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

header h1 span {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

header p {
    color: var(--text-secondary);
    font-size: 1.15rem;
}

/* Search Box */
.search-box {
    display: flex;
    gap: 1rem;
    background: var(--card-bg);
    padding: 0.75rem;
    border-radius: 99px;
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: fadeInUp 0.8s ease-out 0.2s both;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.search-box:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.3);
    border-color: rgba(99, 102, 241, 0.5);
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: inherit;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-box button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 0 2.5rem;
    border-radius: 99px;
    font-size: 1.05rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.search-box button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.6);
}

.search-box button:active {
    transform: translateY(0) scale(0.98);
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.icon-btn svg {
    width: 16px;
    height: 16px;
}

.icon-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent-color);
    transform: scale(1.05);
}

.recording {
    color: var(--error-color) !important;
    animation: pulseRecording 1.5s infinite;
}

@keyframes pulseRecording {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.camera-container {
    margin-top: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    animation: fadeIn 0.3s ease;
}

#cameraStream {
    width: 100%;
    max-width: 500px;
    border-radius: 12px;
    background: #000;
}

.camera-controls {
    display: flex;
    gap: 1rem;
    width: 100%;
    justify-content: center;
}

.capture-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 99px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.capture-btn:hover {
    transform: scale(1.05);
}

.close-camera-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 99px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.close-camera-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error-color);
}

.image-preview-wrapper {
    position: relative;
    display: inline-block;
    margin-top: 1rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    border: 1px solid var(--card-border);
    animation: fadeIn 0.3s ease;
}

.image-preview-wrapper img {
    max-width: 150px;
    max-height: 150px;
    display: block;
    object-fit: cover;
}

.remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

.remove-btn:hover {
    background: var(--error-color);
}

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

/* Loading */
#loadingIndicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 4rem;
    animation: fadeIn 0.3s ease;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
}

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

#loadingIndicator p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    animation: pulseText 1.5s infinite alternate;
}

@keyframes pulseText {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

/* Result & Error Cards */
#resultContainer, #errorContainer {
    margin-top: 3rem;
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.result-card, .error-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 28px;
    padding: 3rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.result-card h2 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.result-card p.description {
    color: var(--text-secondary);
    font-size: 1.15rem;
    line-height: 1.7;
    margin-bottom: 2.5rem;
}

.links-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.links-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
}

.buy-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary);
    text-decoration: none;
    padding: 1.2rem;
    border-radius: 16px;
    font-weight: 600;
    font-size: 1.05rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.buy-link:hover {
    background: var(--accent-gradient);
    border-color: transparent;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}

.error-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
    color: var(--error-color);
    padding: 4rem 2rem;
}

.error-card p {
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Scrolling Sidebars */
.scrolling-sidebar {
    position: fixed;
    top: 0;
    width: 12vw;
    max-width: 150px;
    height: 100vh;
    z-index: 0;
    overflow: hidden;
    opacity: 0.6;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
    mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
}

.scrolling-sidebar.left {
    left: 2%;
}

.scrolling-sidebar.right {
    right: 2%;
}

.marquee-vertical {
    display: flex;
    flex-direction: column;
    animation: scrollVertical 25s linear infinite;
}

.marquee-vertical.reverse {
    animation-direction: reverse;
}

.marquee-inner {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 1.5rem;
}

.marquee-inner img {
    width: 100%;
    border-radius: 16px;
    object-fit: cover;
    aspect-ratio: 1/1;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.05);
}

@keyframes scrollVertical {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

/* Responsive */
@media (max-width: 900px) {
    .scrolling-sidebar {
        display: none;
    }
}

@media (max-width: 640px) {
    .container { padding: 2rem 1rem; }
    header h1 { font-size: 2.5rem; }
    header p { font-size: 1rem; }
    
    .search-box {
        flex-direction: column;
        border-radius: 20px;
        padding: 1rem;
    }
    
    .search-box input {
        padding: 0.5rem;
        text-align: center;
    }
    
    .search-box button {
        padding: 1.2rem;
        justify-content: center;
        border-radius: 12px;
    }
    
    .result-card { padding: 2rem 1.5rem; }
    .result-card h2 { font-size: 1.8rem; }
}
