/* --- RESET & VARS --- */
:root {
    --primary: #111111;       /* Deep Black */
    --accent: #2563eb;        /* Tech Blue */
    --bg: #ffffff;
    --bg-alt: #f8f9fa;
    --border: #e5e7eb;
    --text: #1f2937;
    --text-light: #6b7280;
    --nav-height: 70px;
    --viewer-height: 60vh;
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background-color: var(--bg);
    padding-top: var(--nav-height);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- NAVIGATION --- */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    align-items: center;
    backdrop-filter: blur(8px);
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand { font-weight: 700; font-size: 1.25rem; letter-spacing: -0.03em; }
.dot { color: var(--accent); }

.nav-menu { list-style: none; display: flex; gap: 32px; cursor: pointer; }
.nav-menu li { font-size: 0.95rem; font-weight: 500; color: var(--text-light); transition: color 0.2s; }
.nav-menu li:hover, .nav-menu li.active { color: var(--primary); }
#cart-badge { background: var(--accent); color: white; padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; vertical-align: middle; }

/* --- LAYOUT UTILS --- */
.page { display: none; animation: fadeIn 0.4s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.container { max-width: 1200px; margin: 0 auto; padding: 40px 24px; }
.narrow { max-width: 600px; }
.full-height { min-height: calc(100vh - var(--nav-height)); display: flex; flex-direction: column; }

/* --- BUTTONS --- */
.btn { padding: 12px 24px; border-radius: 6px; border: none; font-weight: 500; cursor: pointer; font-size: 0.95rem; transition: all 0.2s; }
.primary { background: var(--primary); color: white; }
.primary:hover { background: #333; }
.primary:disabled { background: #ccc; cursor: not-allowed; }
.secondary { background: white; border: 1px solid var(--border); color: var(--text); }
.secondary:hover { border-color: var(--primary); }
.full-width { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; background: var(--bg-alt); border: 1px solid var(--border); cursor: pointer; }

/* --- HOME PAGE --- */
.hero { display: flex; align-items: center; justify-content: space-between; padding: 80px 24px; max-width: 1200px; margin: 0 auto; }
.hero-text h1 { font-size: 3.5rem; letter-spacing: -0.04em; line-height: 1.1; margin-bottom: 24px; }
.hero-text p { font-size: 1.1rem; color: var(--text-light); margin-bottom: 32px; max-width: 450px; }
.abstract-circle { width: 300px; height: 300px; background: linear-gradient(135deg, var(--bg-alt), #e2e8f0); border-radius: 50%; }

.section-header { display: flex; align-items: center; gap: 20px; margin-bottom: 40px; }
.line { flex: 1; height: 1px; background: var(--border); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; }
.product-card { border: 1px solid var(--border); padding: 20px; border-radius: 8px; transition: transform 0.2s; }
.product-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-image { height: 180px; background: var(--bg-alt); margin-bottom: 16px; border-radius: 4px; }
.card-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* --- UPLOAD PAGE (THE FIX) --- */
.upload-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; height: 100%; }

/* VITAL: Provide explicit height or flex-grow for the viewer container */
.viewer-area { 
    position: relative; 
    background: var(--bg-alt); 
    border-radius: 8px; 
    overflow: hidden; 
    
    /* VITAL: Force a minimum height so it can never be 0 */
    width: 100%;
    min-height: 500px; 
    height: 100%; 

    border: 1px solid var(--border);
}

#3d-viewer { 
    position: absolute; /* Stick to corners of parent */
    top: 0;
    left: 0;
    width: 100%; 
    height: 100%; 
    display: block;
    z-index: 1;
}

/* Ensure overlay stays on top of the absolute canvas */
.upload-overlay {
    position: absolute;
    bottom: 24px;
    left: 24px;
    z-index: 10; /* Higher than canvas */
    background: rgba(255,255,255,0.9);
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 12px;
}
.file-name { font-size: 0.85rem; color: var(--text-light); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.config-sidebar { display: flex; flex-direction: column; gap: 24px; padding-top: 10px; }
.config-group label { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; color: var(--text-light); margin-bottom: 8px; }
.clean-select { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; font-size: 0.95rem; }
.info-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.big-price { font-size: 2.5rem; font-weight: 700; letter-spacing: -0.02em; }

/* --- CHECKOUT PAGE --- */
.cart-container { margin-bottom: 40px; border-top: 1px solid var(--border); }
.cart-item { display: flex; justify-content: space-between; padding: 20px 0; border-bottom: 1px solid var(--border); }
.summary-box { background: var(--bg-alt); padding: 32px; border-radius: 8px; }
.row { display: flex; justify-content: space-between; margin-bottom: 12px; color: var(--text-light); }
.row.total { color: var(--text); font-weight: 700; font-size: 1.2rem; margin-top: 20px; }
.payment-provider { text-align: center; margin: 24px 0; font-size: 0.85rem; color: var(--text-light); }
.empty-state { padding: 40px 0; text-align: center; color: var(--text-light); }

/* RESPONSIVE */
@media (max-width: 900px) {
    .upload-grid { grid-template-columns: 1fr; }
    .viewer-area { min-height: 350px; }
    .hero { flex-direction: column; text-align: center; }
    .hero-visual { display: none; }
}
