:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --card-bg: rgba(255, 255, 255, 0.7);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --glass-border: rgba(255, 255, 255, 0.4);
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

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

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

.app-container {
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
}

header {
    text-align: center;
    margin-bottom: 1rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.accent {
    color: var(--primary);
    background: linear-gradient(to right, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    min-height: 0; /* Important for flex child scrolling */
}

.viewer-section {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

model-viewer {
    width: 100%;
    height: 100%;
    --poster-color: transparent;
}

#ar-button {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

#ar-button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
}

#ar-button active {
    transform: translateY(0);
}

.controls-panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: var(--shadow);
    overflow-y: auto;
}

.panel-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

.model-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.model-card {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid transparent;
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.model-card:hover {
    background: white;
    border-color: var(--primary);
    transform: translateX(5px);
}

.model-card.active {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.model-thumb {
    width: 60px;
    height: 60px;
    background: #eee;
    border-radius: 12px;
    object-fit: cover;
}

.model-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.model-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

footer {
    text-align: center;
    padding: 1rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* AR Prompt Animation */
#ar-prompt {
    position: absolute;
    left: 50%;
    bottom: 100px;
    transform: translateX(-50%);
    display: none;
}

model-viewer[ar-status="session-started"] #ar-prompt {
    display: block;
}

#ar-prompt img {
    animation: circle 4s linear infinite;
}

@keyframes circle {
    from { transform: translateX(-50%) rotate(0deg) translateX(50px) rotate(0deg); }
    to { transform: translateX(-50%) rotate(360deg) translateX(50px) rotate(-360deg); }
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .app-container {
        height: auto;
        padding: 1rem;
    }
    main {
        grid-template-columns: 1fr;
    }
    .viewer-section {
        height: 400px;
    }
    .controls-panel {
        max-height: 400px;
    }
}
