/* ==========================================
   VECTR // Paralette Customizer
   Linux/Neofetch Inspired - Centered Layout
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    /* Monochrome palette */
    --bg-primary: #0d0d0d;
    --bg-secondary: #161616;
    --bg-tertiary: #1e1e1e;
    
    /* Text */
    --text-primary: #e0e0e0;
    --text-secondary: #808080;
    --text-muted: #505050;
    
    /* Accent - terminal green */
    --accent: #ffbb00;
    --accent-dim: #ffbb00;
    
    /* Borders */
    --border: #2a2a2a;
    --border-light: #3a3a3a;
    
    /* Typography */
    --font-mono: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    
    /* Sizing */
    --header-height: 80px;
    --footer-height: 40px;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

html {
    font-size: 14px;
}

body {
    font-family: var(--font-mono);
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
    cursor: crosshair;
}

/* Ensure monospace on all elements */
button, input, select, textarea {
    font-family: var(--font-mono);
}

/* Custom cursor styles */
a, button, .preset-dot, .finish-opt, .control-btn, .cart-btn, .nav-link {
    cursor: pointer;
}

a:hover, button:hover, .preset-dot:hover, .control-btn:hover, .cart-btn:hover {
    cursor: pointer;
}

/* ==========================================
   Landing Page
   ========================================== */
.landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.landing.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Hide fixed cart button until landing is dismissed */
.landing:not(.hidden) ~ .app-content .cart-btn {
    display: none;
}

.landing-logo {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 1.2rem;
    line-height: 1.1;
    color: var(--accent);
    white-space: pre;
    letter-spacing: 0;
    text-align: left;
    margin-bottom: 12px;
}

.landing-tagline {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 40px;
}

.landing-prompt {
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease, text-shadow 0.2s ease;
    margin-bottom: 60px;
    animation: promptFadeIn 1s ease-out 0.5s both;
}

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

.landing-prompt:hover {
    color: var(--accent);
    transform: scale(1.05);
    text-shadow: 0 0 10px var(--accent-dim);
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.scroll-arrow {
    font-size: 1.2rem;
    color: var(--text-muted);
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    50% {
        transform: translateY(8px);
        opacity: 1;
    }
}

/* App Content Container */
.app-content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.logo-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ascii-logo {
    font-size: 0.5rem;
    line-height: 1.1;
    color: var(--accent);
    white-space: pre;
    letter-spacing: 0;
}

.tagline {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-link {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.nav-link:hover {
    color: var(--text-primary);
    border-color: var(--border);
}

.nav-link.active {
    color: var(--accent);
    border-color: var(--accent);
}

/* Clock */
.clock {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 16px;
    letter-spacing: 0.05em;
}

/* Main Content - Centered Layout */
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 24px 24px;
    min-height: 0;
}

/* Side Controls */
.controls-left,
.controls-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 140px;
    flex-shrink: 0;
}

.controls-right {
    align-items: flex-end;
    text-align: right;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 12px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0;
    position: relative;
    animation: controlFadeIn 0.4s ease-out both;
}

/* Staggered animation for control groups */
.controls-left .control-group:nth-child(1) { animation-delay: 0.1s; }
.controls-left .control-group:nth-child(2) { animation-delay: 0.2s; }
.controls-left .control-group:nth-child(3) { animation-delay: 0.3s; }
.controls-right .control-group:nth-child(1) { animation-delay: 0.15s; }
.controls-right .control-group:nth-child(2) { animation-delay: 0.25s; }

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

.control-label {
    position: absolute;
    top: -9px;
    left: 10px;
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-primary);
    padding: 0 6px;
}

/* Color Picker */
.color-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.color-picker:hover {
    border-color: var(--border-light);
}

.color-swatch {
    width: 20px;
    height: 20px;
    border: 1px solid var(--border-light);
    transition: background-color 0.3s ease;
}

.color-hex {
    font-size: 0.75rem;
    color: var(--text-primary);
}

.color-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Color Presets - Dot Grid */
.color-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.preset-dot {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 0;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
}

.preset-dot:hover {
    border-color: var(--text-secondary);
    transform: scale(1.1);
}

.preset-dot:active {
    transform: scale(0.95);
}

.preset-dot.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
    animation: dotPulse 0.3s ease-out;
}

@keyframes dotPulse {
    0% {
        box-shadow: 0 0 0 0 var(--accent);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(95, 175, 95, 0.3);
    }
    100% {
        box-shadow: 0 0 0 2px var(--accent);
    }
}

/* Preset Select Dropdown */
.preset-select {
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
    width: 100%;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23808080' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.preset-select:hover {
    border-color: var(--border-light);
}

.preset-select:focus {
    outline: none;
    border-color: var(--accent);
}

.preset-select option {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Finish Toggle */
.finish-toggle {
    display: flex;
    gap: 6px;
}

.controls-right .finish-toggle {
    justify-content: flex-end;
}

.finish-opt {
    width: 36px;
    height: 36px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 0;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
}

.finish-opt:hover {
    color: var(--text-primary);
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.finish-opt:active {
    transform: translateY(0) scale(0.95);
}

.finish-opt.active {
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(95, 175, 95, 0.2);
}

/* Price */
.price-group {
    margin-top: 4px;
    border-color: var(--accent-dim);
}

.price-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Cart Button */
.cart-btn {
    margin-top: 12px;
    padding: 12px 18px;
    background: transparent;
    border: 2px solid var(--accent);
    border-radius: 0;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.cart-btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
    box-shadow: 0 0 20px rgba(95, 175, 95, 0.3);
    transform: translateY(-2px);
}

.cart-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 0 10px rgba(95, 175, 95, 0.2);
}

/* Viewer Wrapper */
.viewer-wrapper {
    flex: 1;
    max-width: 1100px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.viewer-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

#three-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loader-ring {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loader-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Viewer Controls */
.viewer-controls {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
}

.control-btn {
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.control-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-light);
}

.control-btn.active {
    color: var(--accent);
    border-color: var(--accent);
}

/* Model Info */
.model-info {
    position: absolute;
    top: 12px;
    left: 12px;
}

.info-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-primary);
}

.info-detail {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Footer */
.footer {
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.footer-text {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-links a {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-links a:hover {
    color: var(--text-secondary);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Selection */
::selection {
    background: var(--accent);
    color: var(--bg-primary);
}

/* Responsive - Tablet */
@media (max-width: 1000px) {
    .main-content {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
        overflow-y: auto;
    }
    
    .controls-left,
    .controls-right {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        gap: 12px;
        align-items: stretch;
        text-align: left;
    }
    
    .controls-right {
        justify-content: flex-start;
    }
    
    .controls-right .finish-toggle {
        justify-content: flex-start;
    }
    
    .control-group {
        flex: 1;
        min-width: 150px;
        max-width: 200px;
    }
    
    .viewer-wrapper {
        width: 100%;
        max-width: none;
        order: -1;
    }
    
    .viewer-container {
        aspect-ratio: 16/10;
    }
    
    .cart-btn {
        margin-top: 0;
        flex-grow: 1;
        max-width: 200px;
    }
    
    .price-group {
        margin-top: 0;
    }
}

/* Responsive - Mobile */
@media (max-width: 600px) {
    .landing-logo {
        font-size: 0.7rem;
        margin-bottom: 10px;
    }
    
    .landing-tagline {
        font-size: 0.7rem;
        margin-bottom: 30px;
    }
    
    .landing-prompt {
        font-size: 0.8rem;
    }
    
    .scroll-indicator {
        bottom: 30px;
    }
    
    .header {
        padding: 0 12px;
        height: 50px;
        flex-shrink: 0;
    }
    
    .ascii-logo {
        font-size: 0.25rem;
    }
    
    .tagline {
        font-size: 0.45rem;
    }
    
    .nav-links {
        display: none;
    }
    
    .clock {
        display: none;
    }
    
    .app-content {
        padding-bottom: 0;
        min-height: 100vh;
        min-height: 100dvh;
        overflow-y: auto;
    }
    
    .main-content {
        padding: 10px;
        gap: 8px;
        min-height: 0;
        flex: 1;
        overflow: visible;
    }
    
    .viewer-wrapper {
        width: 100%;
        order: -1;
    }
    
    .viewer-container {
        aspect-ratio: 4/3;
    }
    
    .controls-left,
    .controls-right {
        gap: 8px;
        flex-wrap: wrap;
        width: 100%;
    }
    
    .control-group {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        max-width: none;
        padding: 12px 10px 10px;
    }
    
    .control-label {
        font-size: 0.65rem;
        top: -8px;
        left: 8px;
        padding: 0 4px;
    }
    
    .preset-dot {
        width: 28px;
        height: 28px;
    }
    
    .color-presets {
        gap: 6px;
    }
    
    .finish-opt {
        width: 40px;
        height: 40px;
    }
    
    /* Cart button in flow */
    .cart-btn {
        width: 100%;
        max-width: none;
        padding: 14px 20px;
        font-size: 0.9rem;
        margin-top: 4px;
    }
    
    .price-group {
        flex: 1 1 calc(50% - 4px);
    }
    
    .price-value {
        font-size: 1.1rem;
    }
    
    .viewer-controls {
        bottom: 8px;
        gap: 6px;
    }
    
    .control-btn {
        padding: 10px 14px;
        font-size: 0.7rem;
    }
    
    .footer {
        padding: 8px 12px;
        height: auto;
        flex-shrink: 0;
    }
    
    .footer-text,
    .footer-links a {
        font-size: 0.5rem;
    }
    
    /* Bottom sheet popup for mobile */
    .color-popup {
        position: fixed;
        bottom: 20px;
        left: 12px;
        right: 12px;
        top: auto;
        min-width: auto;
        width: auto;
        max-height: 50vh;
        padding: 16px;
        border-radius: 0;
        animation: bottomSheetSlideIn 0.3s ease-out;
    }
    
    .color-popup.visible {
        animation: bottomSheetSlideIn 0.3s ease-out;
    }
    
    .popup-colors {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .popup-color-btn {
        width: 100%;
        aspect-ratio: 1;
        height: auto;
        min-height: 44px;
    }
    
    /* Toast positioning for mobile */
    .toast-container {
        bottom: 20px;
        left: 16px;
        right: 16px;
        transform: none;
    }
    
    .toast {
        width: 100%;
    }
}

@keyframes bottomSheetSlideIn {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   Mobile Menu
   ========================================== */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0;
    cursor: pointer;
    padding: 8px;
    transition: border-color 0.2s ease;
}

.mobile-menu-btn:hover {
    border-color: var(--accent);
}

.mobile-menu-btn.active {
    border-color: var(--accent);
}

.mobile-menu-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.hamburger-line {
    width: 100%;
    height: 2px;
    background: var(--accent);
    transition: all 0.3s ease;
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 13, 13, 0.95);
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 24px;
    padding-bottom: 80px;
}

.mobile-menu-link {
    font-size: 1.2rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 12px 24px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.mobile-menu-link:hover,
.mobile-menu-link.active {
    color: var(--accent);
    border-color: var(--accent);
}

@media (max-width: 600px) {
    .mobile-menu-btn {
        display: flex;
    }
    
    .mobile-menu-overlay {
        display: block;
    }
}

/* ==========================================
   Color Popup (click on model)
   ========================================== */
.color-popup {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 16px;
    z-index: 1000;
    min-width: 200px;
    display: none;
    font-family: var(--font-mono);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.color-popup.visible {
    display: block;
    animation: popupFadeIn 0.15s ease;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.popup-title {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 500;
}

.popup-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 4px;
    transition: color 0.15s ease;
}

.popup-close:hover {
    color: var(--text-primary);
}

.popup-colors {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.popup-color-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border);
    border-radius: 0;
    cursor: pointer;
    transition: all 0.15s ease;
}

.popup-color-btn:hover {
    border-color: var(--text-secondary);
    transform: scale(1.1);
}

.popup-color-btn.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

/* ==========================================
   Toast Notification
   ========================================== */
.toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    pointer-events: none;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: 0;
    padding: 14px 24px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 20px rgba(95, 175, 95, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlideIn 0.3s ease-out;
    pointer-events: auto;
}

.toast.hiding {
    animation: toastSlideOut 0.3s ease-in forwards;
}

.toast-icon {
    color: var(--accent);
    font-size: 1.1rem;
}

.toast-message {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toast-title {
    font-weight: 500;
    color: var(--accent);
}

.toast-detail {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

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

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