/* =========================================
   VARIABLES & RESET
   ========================================= */
:root {
    /* Colors */
    --color-bg: #000;
    --color-text: #FFF;
    --color-text-muted: #999;
    --color-text-dark: #000;
    --color-accent: rgb(200, 200, 200);
    --color-border: rgba(255, 255, 255, 0.2);
    --color-border-light: #e0e0e0;
    --color-glass-bg: rgba(255, 255, 255, 0.1);

    /* Spacing & Layout */
    --header-height: 60px;
    --navbar-height: 10svh;
    --board-height-collapsed: 20svh;
    --hotbox-height-collapsed: 0svh;
    --board-height-expanded: calc(100svh - var(--header-height));

    /* Transitions */
    --transition-fast: 0.3s;
    --transition-slow: 1s;
}

/* Base Reset */
* {
    box-sizing: border-box;
}

html {
    background-color: var(--color-bg);
}

html,
body {
    scroll-behavior: smooth;
    color: var(--color-text);
    overflow: hidden;
    height: 100%;
    min-height: 100vh;
    width: 100%;
    margin: 0 auto;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

section {
    overflow: hidden;
}

h1 {
    color: rgb(200, 200, 200);
    display: block;
    font-size: x-large;
}

a {
    text-decoration: none;
    color: rgb(200, 200, 200);
}

input:focus {
    outline: none;
}

/* =========================================
   FONTS
   ========================================= */
@font-face {
    font-family: 'Comfortaa';
    src: url('/fonts/Comfortaa-Regular.woff2') format('woff2'),
        url('/fonts/Comfortaa-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

.comfortaa {
    font-family: "Comfortaa", serif;
    font-weight: 400;
}

.underline {
    text-decoration: underline;
}

.bold {
    font-weight: bold;
    color: #FFF;
}

/* =========================================
   COMPONENTS: BUTTONS
   ========================================= */
button {
    backdrop-filter: blur(10px);
    font-family: inherit;
    font-weight: 200;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-glass-bg);
    border: 0.5px solid var(--color-border);

    color: rgb(200, 200, 200);

    border-radius: 100px;
    font-size: 16px;
    text-decoration: none;
    padding: 10px 20px;
    height: 40px;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
    line-height: 1;
}

.stealth-btn {
    backdrop-filter: none;
    border: 0;
    background-color: transparent;
    font-size: medium;
    border-radius: 0;
}

.round-btn {
    width: 50px;
    height: 50px;
}


/* =========================================
   LAYOUT: HEADER
   ========================================= */
header {
    position: fixed;
    width: 100%;
    z-index: 999;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#logo {
    padding: 1%;
    margin-left: 10px;
    margin-right: 10px;
}

/* =========================================
   LAYOUT: MAIN SECTIONS
   ========================================= */
.screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.main {
    background: var(--color-accent);
    color: var(--color-text-dark);
}

#background-video {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    object-fit: cover;
    object-position: center;
    filter: brightness(0.2);
}

/* =========================================
   COMPONENT: BOARD / SIGNATURE
   ========================================= */
#signature {
    flex-direction: column;
    position: relative;
    scroll-margin-top: var(--header-height);
    width: 100%;
    height: var(--board-height-collapsed);
    transition: height var(--transition-slow);
    display: flex;
    justify-content: center;
    align-items: center;
    /* background:
        linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 1)),
        url('images/colleciton.webp') center/cover repeat-x;*/
    margin-top: var(--header-height);
}

#signature button {
    color: rgb(200, 200, 200);
}

#collections {
    /* Hidden initially */
    opacity: 0;
    transition: opacity var(--transition-slow);
    width: 100%;
    padding: 0 2em 0 2em;
    overflow: hidden;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    list-style-type: none;
    gap: 2em;
}

/* Onboarding Complete State */
#signature.onboarding-complete #collections {
    display: flex;
    opacity: 1;
}

#signature.onboarding-complete #hot-box,
#signature.onboarding-complete #onboarding {
    opacity: 0;
}

#collections li {
    scroll-snap-align: center;
    flex: 0 0 auto;
    width: 30vw;
    border: 1px solid red;
    aspect-ratio: 1/1;
    display: flex;
    align-content: center;
    flex-direction: column;
    gap: 1em;
}

/* Unlock Button */
#unlock-signature {
    margin: auto;
}

#hot-box {
    height: var(--hotbox-height-collapsed);
    margin-bottom: var(--header-height);
    /* Ensure transitions work */
    opacity: 1;
    transition: opacity var(--transition-slow);
}

/* =========================================
   COMPONENT: COLLECTION (HUMIDOR/WATCHLIST)
   ========================================= */
#collection {
    display: flex;
    flex-direction: row;
    width: 80vw;
    margin: 0 auto;
    gap: 1em;
    padding: 0;
}

#humidor,
#watchlist {
    flex: 1;
}


#onboarding {
    width: 100%;
    padding: 0;
    overflow: hidden;
    display: flex;
    overflow-x: hidden;
    /* Disable manual scrolling */
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    margin: 0 auto;
    list-style-type: none;
}

#onboarding li {
    scroll-snap-align: center;
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    align-content: center;
    flex-direction: column;
    gap: 1em;
}

.onboarding-controls {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: auto;
}

.onboarding-controls button {
    padding: 0.5em;
}

#onboarding-next-btn {
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast), visibility 0s var(--transition-fast);
}

#onboarding-next-btn.visible {
    opacity: 1;
    visibility: visible;
    transition: opacity var(--transition-fast), visibility 0s;
}


#onboarding {
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-slow), visibility 0s var(--transition-slow);
}

#signature.expand-board #onboarding {
    opacity: 1;
    visibility: visible;
    transition: opacity var(--transition-slow), visibility 0s var(--transition-slow);
}

/* ... existing code ... */

#signature.expand-board {
    visibility: visible;
    opacity: 1;
    height: var(--board-height-expanded);
    transition: height var(--transition-slow), opacity var(--transition-slow), visibility 0s;
}


#hot-box {
    opacity: 1;
    visibility: visible;
    text-align: center;
    transition: opacity var(--transition-slow), visibility 0s;
    border-radius: 2em 2em 0em 0em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.expand-board #hot-box {
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-slow), visibility 0s var(--transition-slow);
}





/* =========================================
   COMPONENT: NAVBAR & OPTIONS
   ========================================= */
.navbar {
    margin-top: 0.5em;
    display: flex;
    height: var(--navbar-height);
    margin-bottom: var(--board-height-collapsed);
    gap: 2em;
}

.navbar button {
    padding: 0.6em;
    width: 50px;
    height: 50px;
    border-radius: 100%;
    position: relative;
}

.navbar button.selected {
    background: var(--color-accent);
    color: var(--color-text-dark);
}

/* Options Scroll Container */
.options-container {
    border-top: 0.5px solid #666;
    border-radius: 2rem;
    display: flex;
    margin: 0;
    white-space: nowrap;
    height: calc(100svh - var(--board-height-collapsed) - var(--hotbox-height-collapsed) - var(--navbar-height) - var(--header-height));
    width: 100vw;
    scrollbar-width: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    z-index: 1;
    position: relative;
}

.options-container::-webkit-scrollbar {
    display: none;
}

/* Option Cards */
.options {
    border-top: 0.5px solid #666;
    width: 100vw;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    scroll-snap-align: center;
    border-radius: 2em;
    position: relative;
    text-align: center;
    cursor: pointer;
    overflow: hidden;
    padding: 5vw;
}

.options button {
    position: absolute;
    top: 0.5em;
    right: 0.5em;
    display: block;
    margin: 0;
    z-index: 2;
    width: 45px;
    height: 45px;
    padding: 0;
    border-radius: 50%;
}

.options button::before {
    content: "Start Here";
    position: absolute;
    top: 15px;
    right: 120%;
    text-shadow: 0 0 30px black;
}

.options h1 {
    position: relative;
    margin: 0;
    width: 100%;
    z-index: 1;
    padding-bottom: 20px;
    font-size: x-large;
    text-align: left;
}

.options p {
    position: relative;
    margin: 0;
    width: 100%;
    z-index: 1;
    padding-bottom: 20px;
    line-height: 2em;
    font-size: small;
    text-align: left;
    white-space: normal;
}

/* Option Backgrounds */
#identify {
    background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 1)), url('images/large-humidor.webp') center/cover no-repeat;
}

#to-identify::after {
    content: "Discover";
    position: absolute;
    top: 96%;
    font-size: x-small;
}

#to-identify.selected::after,
#to-pair.selected::after,
#to-age.selected::after,
#to-concierge.selected::after {
    display: none;
}

#pair {
    background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 1)), url('images/pairing.webp') center/cover no-repeat;
}

#to-pair::after {
    content: "Pair";
    position: absolute;
    top: 96%;
    font-size: x-small;
}

#age {
    background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 1)), url('images/hygrometer.webp') center/cover no-repeat;
}

#to-age::after {
    content: "Age";
    position: absolute;
    top: 96%;
    font-size: x-small;
}

#concierge {
    background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 1)), url('images/concierge.webp') center/cover no-repeat;
}

#to-concierge::after {
    content: "Concierge";
    position: absolute;
    top: 96%;
    font-size: x-small;
}

/* =========================================
   COMPONENT: GRID / THUMBNAILS
   ========================================= */
.grid-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    width: 90vw;
    height: 70svh;
    margin: 0 auto;
    list-style-type: none;
}

.grid-container li {
    height: 80vh;
    scroll-snap-align: center;
    flex: 0 0 auto;
    width: 50vw;
    max-width: 130px;
    display: flex;
}

.grid-container li img {
    height: 100%;
    margin: auto;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* =========================================
   COMPONENT: CAMERA MODAL
   ========================================= */
.camera-modal {
    top: 0px;
    position: fixed;
    display: flex;
    visibility: hidden;
    opacity: 0;
    transition: opacity var(--transition-slow) ease;
    background-color: var(--color-bg);
    inset: 0;
    padding: 0 5.5% 0 5.5%;
    height: calc(100% - var(--header-height));
    z-index: 1000;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.camera-modal.active {
    transition: opacity var(--transition-slow) ease;
    visibility: visible;
    opacity: 1;
}

#cameraStream {
    position: relative;
    width: 90%;
    max-width: 500px;
    border-radius: 2em;
    background: var(--color-bg);
    margin: 0 auto 0 auto;

}

.camera-controls {
    display: flex;
    gap: 1em;
    bottom: 5svh;
    position: absolute;
}

.camera-controls button {
    padding: 0.5em;
}

.camera-capture-btn,
.camera-close-btn {
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background var(--transition-fast);
}

.camera-capture-btn {
    background: #667eea;
}

.camera-capture-btn:hover {
    background: #5568d3;
}

.camera-close-btn {
    background: var(--color-text-muted);
}

.camera-close-btn:hover {
    background: #777;
}

.camera-viewfinder {
    display: flex;
    height: 70svh;
    align-items: flex-start;
}

/* =========================================
   COMPONENT: THUMBNAILS (UPLOAD/CAMERA)
   ========================================= */
.thumbnails-section {
    width: 90vw;
    position: absolute;
    display: flex;
    align-self: flex-end;
}

.thumbnails {
    display: grid;
    gap: 1px;
    grid-template-columns: repeat(auto-fit, minmax(80px, 120px));
    justify-content: center;
    justify-items: center;
    width: 100%;
}

.thumbnail-wrapper {
    box-shadow: 0 0 10px #000;
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.5em;
    overflow: hidden;
    border: 0.5px solid var(--color-border-light);
    transition: transform 1.2s;
    width: 20vw;
    margin-top: 7px;
}

.thumbnail-wrapper:hover {
    transform: scale(1.05);
}

.thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-btn {
    position: absolute;
    top: 0px;
    border: none;
    width: 100%;
    height: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

.remove-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.empty-state {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 14px;
    height: 83px;
}

/* =========================================
   UTILITIES
   ========================================= */
.hidden {
    visibility: hidden;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Specific IDs */
#home {
    justify-content: flex-start;
    opacity: 1;
    transition: opacity var(--transition-slow);
}

#back {
    margin-left: auto;
    padding: 0em 1em 0em 1em;
}

.input-wrapper {
    display: flex;
    background: var(--color-glass-bg);
    border: 0.2px solid rgba(255, 255, 255, 0.15);
    border-radius: 100px;
    width: 92%;
    min-width: auto;
    padding: 12px;
    gap: 10px;
    margin: auto;
    flex-direction: column;
    align-items: stretch;
    border-color: transparent;
}

input[type="text"] {
    background: var(--color-glass-bg);
    color: #fff;
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3em;
    font-size: 16px;
    margin: 0;
    transition: border-color var(--transition-fast);
    padding: 1em;
}

#fileInput {
    display: none;
}

.hint {
    font-size: 13px;
    color: var(--color-text-muted);
    text-align: center;
}

.display-flip-container {
    display: flex;
    flex-direction: column-reverse;
}

/* =========================================
   DYNAMIC RESULTS STYLES
   ========================================= */
.status-item {
    width: 100%;
    max-width: none;
    justify-content: center;
    align-items: center;
}

.status-text {
    font-size: 1.5em;
    text-align: center;
}

.result-item-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    text-align: center;
}

.brand-name {
    font-weight: bold;
    font-size: 1.2em;
}

.cigar-name {
    margin-top: 5px;
}

.error-text {
    color: red;
    text-align: center;
    width: 100%;
}