/* style.css */

/* 
  NEW: CSS Custom Properties (Variables)
  This makes the theme consistent and easy to change.
*/
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color-start: #667eea;
    --primary-color-start-translucent: rgba(102, 126, 234, 0.5);

    --panel-bg: rgba(255, 255, 255, 0.05);
    --input-bg: rgba(255, 255, 255, 0.08);
    --input-bg-focus: rgba(255, 255, 255, 0.12);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-color: #fff;
    --text-color-muted: rgba(255, 255, 255, 0.6);
    
    --button-secondary-bg: rgba(255, 255, 255, 0.1);
    --button-secondary-hover-bg: rgba(255, 255, 255, 0.15);
    
    --border-radius-large: 10px;
    --border-radius-medium: 8px;
    
    --backdrop-blur: 20px;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}


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

body {
    font-family: var(--font-family);
    background: #000;
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
    display: flex;
}

.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.canvas-hidden { visibility: hidden; }

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: twinkle 4s infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

#canvas {
    flex: 1 1 auto;   /* allow shrink */
    min-width: 0;     /* <- critical for flex children */
    width: 100%;      /* own all the remaining row */
    height: 100%;
    background: transparent;
}

.control-panel {
    flex: 0 0 320px;
    height: 100vh;
    overflow-y: auto;
    position: relative;
    z-index: 10;
    background: var(--panel-bg);
    backdrop-filter: blur(var(--backdrop-blur));
    border-right: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.control-content {
    flex: 1;
    padding: 40px;
}

/* 
  NEW: Custom scrollbar styling
*/
.control-panel::-webkit-scrollbar {
    width: 8px;
}
.control-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
.control-panel::-webkit-scrollbar-thumb {
    background: var(--button-secondary-bg);
    border-radius: 4px;
}
.control-panel::-webkit-scrollbar-thumb:hover {
    background: var(--button-secondary-hover-bg);
}


.control-panel.expanded {
    flex-basis: 400px;
}

.title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
    font-weight: 300;
    letter-spacing: 2px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.control-group {
    margin-bottom: 20px;
    opacity: 0;
    animation: fadeInUp 0.6s forwards;
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-color-muted);
}

input[type="text"],
input[type="date"] {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    color: var(--text-color);
    font-size: 16px;
    transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="date"]:focus {
    outline: none;
    background: var(--input-bg-focus);
    border-color: var(--primary-color-start-translucent);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.button {
    flex: 1;
    padding: 12px 24px;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--border-radius-large);
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.button:active {
    transform: translateY(0);
}

.button.secondary {
    background: var(--button-secondary-bg);
    backdrop-filter: blur(10px);
}

.button.secondary:hover {
    background: var(--button-secondary-hover-bg);
}

.nerd-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: var(--button-secondary-bg);
    border-radius: 13px;
    margin-right: 12px;
    transition: all 0.3s ease;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--text-color);
    top: 2px;
    left: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nerd-toggle.active .toggle-switch {
    background: var(--primary-gradient);
}

.nerd-toggle.active .toggle-switch::after {
    transform: translateX(24px);
}

.nerd-label {
    font-size: 14px;
    color: var(--text-color-muted);
    transition: color 0.3s ease;
}

.nerd-toggle.active .nerd-label {
    color: var(--primary-color-start);
}

.advanced-controls {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 20px;
}

.advanced-controls.show {
    max-height: 800px; /* Adjusted to ensure all controls are visible */
    opacity: 1;
}

.slider-group {
    margin: 20px 0;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.slider {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-gradient);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px var(--primary-color-start-translucent);
}

.slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary-gradient);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

select {
    width: 100%;
    padding: 10px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-medium);
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
}

select option {
    background: #1a1a1a;
}

.notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(102, 126, 234, 0.9);
    backdrop-filter: blur(10px);
    padding: 16px 32px;
    border-radius: 50px;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 100;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color-start);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.prelude-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.prelude-overlay.show {
    opacity: 1;
    pointer-events: all;
}

#preludeMessage {
    font-size: 16px;
    letter-spacing: 1px;
    color: var(--text-color-muted);
    margin-bottom: 20px;
    min-height: 20px;
    transition: opacity 0.3s ease;
}

.prelude-bar {
    width: 80%;
    max-width: 400px;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

#preludeProgress {
    width: 0%;
    height: 100%;
    background: var(--primary-gradient);
}

.editable-value {
    cursor: text;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    min-width: 60px;
    display: inline-block;
    text-align: right;
}

.editable-value:hover {
    background: var(--button-secondary-bg);
}

.editable-value:focus {
    outline: none;
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid var(--primary-color-start-translucent);
    padding: 1px 5px;
}

.custom-export-controls {
    margin-top: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius-medium);
    border: 1px solid var(--border-color);
}

.export-info {
    margin-top: 10px;
    padding: 10px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 6px;
    text-align: center;
}

.export-info small {
    color: var(--text-color-muted);
    font-size: 12px;
}

input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
}

/* Scroll indicator - elegant fade gradient */
.scroll-indicator {
    display: none;
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--panel-bg));
    z-index: 21;
    pointer-events: none;
    margin-top: auto;
    flex-shrink: 0;
}

.scroll-indicator::after {
    content: "\2304";
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--primary-color-start);
    font-size: 24px;
    opacity: 0.7;
    animation: pulse 2s infinite;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    pointer-events: auto;
}

.scroll-indicator::after:hover {
    opacity: 1;
    background: rgba(102, 126, 234, 0.1);
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.3; }
}

/* Show scroll indicator on desktop too */
.control-panel .scroll-indicator {
    display: block;
}

@media (max-width: 800px) {
    .slider-group {
        margin: 15px 0;
    }

    .control-group {
        margin-bottom: 15px;
    }

    body {
        flex-direction: column;
        height: auto;
        overflow-y: auto;
    }

    .control-panel {
        flex-basis: auto;
        width: 100%;
        height: auto;
        min-height: 300px;  /* Add this - ensures minimum space */
        max-height: 60vh; /* Default height */
        border-radius: 0 0 20px 20px;
        border-right: none;
        position: relative;
    }
    
    .control-content {
        padding: 20px;
    }
    
    /* Ensure consistent width for form inputs on mobile */
    input[type="text"],
    input[type="date"] {
        width: 100%;
        box-sizing: border-box;
        -webkit-appearance: none;
        appearance: none;
    }
    
    .scroll-indicator {
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 40px;
    }
    
    /* Reduced height when Print button is hidden to give more space to canvas */
    .control-panel:not(.animation-completed) {
        max-height: 50vh; 
        min-height: 350px; 
    }
    
    .control-panel.expanded {
        flex-basis: auto;
    }
    .control-panel.scrolled-to-bottom .scroll-indicator {
        display: none;
    }
    #canvas {
        min-height: 40vh; /* Default canvas height */
        transition: min-height 0.4s ease;
    }

    /* Give more space to canvas when Print button is hidden */
    body:has(.control-panel:not(.animation-completed)) #canvas {
        min-height: 55vh;
    }
    
    /* Give more space to canvas when Print button is hidden */
    body:has(.control-panel:not(.animation-completed)) #canvas {
        min-height: 55vh;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    /* Hide Print button until animation completes on mobile */
    #printProductsBtn {
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        transition: all 0.4s ease;
        margin-bottom: 0;
        height: 0;
        overflow: hidden;
    }
    
    .control-panel.animation-completed #printProductsBtn {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        height: auto;
        margin-bottom: 15px;
    }
}

/* ─── Footer link ─────────────────────────────────────────────────── */
.site-footer {
  position: fixed;
  bottom: 8px;
  right: 12px;
  font-size: 12px;
  z-index: 30;
}
.about-link {
  color: var(--text-color-muted);
  text-decoration: none;
}
.about-link:hover { text-decoration: underline; }

/* ─── Modal overlay ───────────────────────────────────────────────── */
.about-modal {
  visibility: hidden;
  opacity: 0;
  transition: opacity .3s ease;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.about-modal.show {
  visibility: visible;
  opacity: 1;
}

/* ─── Modal card ──────────────────────────────────────────────────── */
.about-content {
  max-width: 480px;
  background: var(--panel-bg);
  backdrop-filter: blur(var(--backdrop-blur));
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-large);
  padding: 24px 32px;
  color: var(--text-color);
  text-align: left;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.about-content h2 { margin-top: 0; font-size: 20px; }
.about-content .disclaimer {
  font-size: 12px;
  color: var(--text-color-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  margin-top: 16px;
}

/* Close button */
.about-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-color-muted);
  cursor: pointer;
  z-index: 10;
}
.about-close:hover { color: var(--text-color); }

/* Mobile optimization for about modal */
@media (max-width: 800px) {
  .about-modal {
    align-items: flex-start;
    padding: 20px;
  }
  
  .about-content {
    max-width: 100%;
    width: 100%;
    max-height: calc(100vh - 40px);
    margin-top: 0;
    border-radius: var(--border-radius-medium);
    padding: 20px;
    padding-top: 50px; /* Space for close button */
  }
  
  .about-content h2 {
    font-size: 18px;
    margin-bottom: 16px;
  }
  
  .about-close {
    top: 15px;
    right: 15px;
    font-size: 28px;
    padding: 5px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.dob-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    padding: 6px 16px;
    transition: all 0.3s ease;
}

.dob-inputs:focus-within {
    background: var(--input-bg-focus);
    border-color: var(--primary-color-start-translucent);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}



.dob-inputs input {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 16px;
    text-align: center;
    width: auto;
    padding: 2px 2px;
    outline: none;
}

.dob-inputs input::placeholder {
    color: var(--text-color-muted);
    opacity: 0.7; 
}

#dobMonth, #dobDay {
    width: 32px; 
}

#dobYear {
    width: 48px;
}

.dob-separator {
    color: var(--text-color-muted);
    font-size: 18px;
    line-height: 1;
    user-select: none;
}

@media (max-width: 800px) {
    .share-button {
        height: 42px;
    }
    .share-button.show {
        min-width: 100px;
        padding: 0 14px;
    }
    .share-button .share-label {
        font-size: 13px;
        letter-spacing: 0.2px;
    }

    .dob-inputs {
        padding: 6px 10px;
        gap: 5px;
    }
    .dob-inputs.with-share #dobMonth,
    .dob-inputs.with-share #dobDay {
        width: 30px;              /* a touch tighter on small screens */
    }
    .dob-inputs.with-share #dobYear {
        width: 46px;
    }
}

/* Mobile optimizations */
@media (max-width: 800px) {
    .dob-inputs {
        padding: 8px 16px;
        font-size: 18px;
    }
    
    .dob-inputs input {
        font-size: 18px;
        padding: 2px 2px;
    }
    
    #dobMonth, #dobDay {
        width: 36px;
    }
    
    #dobYear {
        width: 56px;
    }
}

/* ─── Full-width button utility ─────────────────────────────── */
.button.full-width {
    width: 100%;
}

/* ─── Print Products Modal Styles ─────────────────────────────── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin: 20px 0;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 5px;
}

/* Product preview with elegant badge overlay */
.product-preview {
    position: relative;
    display: inline-block;
    border-radius: var(--border-radius-medium);
    overflow: hidden;
    background: var(--input-bg);
}

.product-badge {
  position: absolute;
  top: 12px;
  right: 12px;   
  left: auto; 
  background: var(--primary-gradient);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

/* Keep everything inside the modal from overflowing horizontally */
.about-content {
  overflow-x: hidden;
}

/* Make the preview area and its media fully fluid */
.preview-container {
  width: 100%;
  align-items: stretch; /* so the preview fills available width */
}

.product-preview {
  width: 100%;
  max-width: 100%;
  padding: 16px;          /* a bit tighter on small screens */
  overflow: hidden;       /* no horizontal scrollbars */
}

.product-preview img,
.product-preview canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;           /* keep aspect ratio */
  object-fit: contain;
}

/* Mobile tweaks */
@media (max-width: 800px) {
  .product-preview { padding: 12px; }
}

/* Checkout options section */
.checkout-options {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius-medium);
    border: 1px solid var(--border-color);
}

/* Elegant toggle switch */
.new-tab-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-checkbox {
    display: none;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-checkbox:checked + .toggle-label .toggle-switch {
    background: var(--primary-gradient);
    border-color: var(--primary-color-start);
}

.toggle-checkbox:checked + .toggle-label .toggle-switch::after {
    transform: translateX(20px);
}

.toggle-text {
    color: var(--text-color);
    font-size: 14px;
}

.product-card {
    background: var(--input-bg);
    border: 2px solid transparent;
    border-radius: var(--border-radius-medium);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.product-card:hover {
    background: var(--input-bg-focus);
    border-color: var(--primary-color-start);
    transform: translateY(-2px);
}

.product-card.selected {
    background: var(--primary-color-start-translucent);
    border-color: var(--primary-color-start);
}

.product-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.product-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-color);
}

.product-price {
    font-size: 0.85em;
    color: var(--text-color-muted);
}

.print-step {
    animation: fadeIn 0.3s ease;
    max-height: 70vh;
    overflow-y: auto;
}

.preview-container {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    align-items: flex-start;
}

.product-preview {
    flex-shrink: 0;
    background: var(--input-bg);
    border-radius: var(--border-radius-medium);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-info {
    flex: 1;
}

.preview-info p {
    margin-bottom: 15px;
}

.size-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.size-selector label {
    font-weight: 600;
}

.size-selector select {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-medium);
    color: var(--text-color);
    padding: 8px 12px;
    font-size: 14px;
}

.step-buttons {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

#previewCanvas {
    border-radius: var(--border-radius-medium);
    background: #fff;
}

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

/* Custom scrollbar for modal */
.product-grid::-webkit-scrollbar,
.print-step::-webkit-scrollbar {
    width: 6px;
}

.product-grid::-webkit-scrollbar-track,
.print-step::-webkit-scrollbar-track {
    background: var(--input-bg);
    border-radius: 3px;
}

.product-grid::-webkit-scrollbar-thumb,
.print-step::-webkit-scrollbar-thumb {
    background: var(--primary-color-start);
    border-radius: 3px;
}

.product-grid::-webkit-scrollbar-thumb:hover,
.print-step::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color-start-translucent);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .preview-container {
        flex-direction: column;
    }
    
    .step-buttons {
        flex-direction: column;
    }
}

/* ─── Share Button Styles ───────────────────────────────────────── */
.input-with-share {
    display: flex;
    align-items: stretch;
}

.share-button {
    flex-shrink: 0;
    height: 44px;                 /* taller target for better tap area */
    width: 0;                     /* hidden until .show */
    opacity: 0;
    padding: 0;                   /* expands when .show */
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--border-radius-large);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;      /* icon+label centered */
    gap: 10px;                    /* space between icon and text */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    white-space: nowrap;          /* keep "Share" on one line */
}

.share-button.show {
    width: auto;                  /* natural width with label */
    min-width: 108px;             /* ensure readable */
    padding: 0 16px;              /* comfy left/right padding */
    margin-left: 10px;
    opacity: 1;
}

.share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.share-button svg {
    width: 20px;
    height: 20px;
}

.share-button .share-label {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.dob-inputs {
    display: flex;
    align-items: center;
    justify-content: center;      /* keep text centered as a group */
    gap: 6px;                     /* slightly tighter to make room */
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    padding: 6px 12px;            /* a bit slimmer */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    flex: 1;
    min-width: 0;
}

.dob-inputs.with-share {
    flex: 1;                      /* allow shrink to accommodate button */
    width: auto;
}

.dob-inputs.invalid {
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
}

/* ─── Share Modal Styles ───────────────────────────────────────── */
.share-modal {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.share-modal.show {
    visibility: visible;
    opacity: 1;
}

.share-content {
    max-width: 500px;
    width: 90%;
    background: var(--panel-bg);
    backdrop-filter: blur(var(--backdrop-blur));
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    padding: 32px;
    color: var(--text-color);
    text-align: center;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.share-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-color-muted);
    cursor: pointer;
    z-index: 10;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.share-close:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.1);
}

.share-preview {
    margin: 20px 0;
}

#sharePreviewCanvas {
    border-radius: var(--border-radius-medium);
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.share-options h3 {
    font-size: 16px;
    font-weight: 500;
    margin: 20px 0 15px;
    color: var(--text-color-muted);
}

.social-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.social-btn {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.social-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.social-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.social-btn.twitter {
    background: #000000;
}

.social-btn.facebook {
    background: #1877f2;
}

.social-btn.whatsapp {
    background: #25d366;
}

.social-btn.reddit {
    background: #ff4500;
}

.social-btn.download {
    background: var(--primary-gradient);
}

/* Loading overlay enhancement for video progress */
.loading-overlay .video-progress-text {
    margin-top: 20px;
    color: #fff;
    font-size: 14px;
    text-align: center;
}

.native-share-btn {
    display: none; /* Hidden by default */
    width: 100%;
    margin-top: 15px;
    padding: 12px;
    font-size: 16px;
    background-color: #5a67d8; /* A different color to stand out */
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.native-share-btn:hover {
    background-color: #4c58b8;
}

.native-share-btn.show {
    display: flex; /* Show when supported */
}

.share-link {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.link-input-group {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.share-url-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-medium);
    color: var(--text-color);
    font-size: 14px;
    font-family: monospace;
}

.copy-link-btn {
    padding: 12px 20px;
    background: var(--button-secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-medium);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.copy-link-btn:hover {
    background: var(--button-secondary-hover-bg);
}

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

.share-note {
    font-size: 12px;
    color: var(--text-color-muted);
    margin-top: 10px;
}

/* Checkbox styling for export option */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
}

/* Mobile responsiveness for share feature */
@media (max-width: 800px) {
    .share-content {
        padding: 24px 20px;
    }
    
    .social-buttons {
        gap: 10px;
    }
    
    .social-btn {
        width: 48px;
        height: 48px;
    }
    
    .link-input-group {
        flex-direction: column;
    }
    
    .copy-link-btn {
        justify-content: center;
    }
}

/* Desktop-only wrapper starts hidden by default; we reveal it on desktop */
.desktop-share-wrapper { display: none; margin-top: 10px; }

/* Desktop presentation */
@media (min-width: 801px) {
  .share-button { display: none !important; }     /* hide inline (mobile) button */
  .desktop-share-wrapper { display: block; }
  .share-button-desktop {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: all 0.3s ease;
  }
  .share-button-desktop.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
}

/* Mobile / tablet: keep the inline share button next to DOB, hide the desktop one */
@media (max-width: 800px) {
  .desktop-share-wrapper { display: none; }
}

/* Advanced options (collapsed by default) */
.advanced-options {
  margin-top: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-medium);
  background: rgba(255, 255, 255, 0.03);
}

.advanced-summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  color: var(--text-color);
  font-size: 14px;
  position: relative;
}
.advanced-summary::-webkit-details-marker { display: none; }

.advanced-summary::after {
  content: "▸";
  position: absolute;
  right: 12px;
  transition: transform 0.2s ease;
  opacity: 0.7;
}
.advanced-options[open] .advanced-summary::after {
  transform: rotate(90deg);
}

.country-selector {
  padding: 12px 14px 16px 14px;
  border-top: 1px solid var(--border-color);
}
.country-selector label {
  margin-bottom: 8px;
}
.country-selector select {
  width: 100%;
}
.small-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-color-muted);
}
.download-choice-popover {
    position: fixed; /* Use fixed positioning to appear above everything */
    visibility: hidden;
    opacity: 0;
    transform: scale(0.95) translateY(10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: #2a2a30; /* A darker, distinct background */
    border-radius: var(--border-radius-medium);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1001; /* Must be higher than the share modal's z-index */
}

.download-choice-popover.show {
    visibility: visible;
    opacity: 1;
    transform: scale(1) translateY(0);
}

.choice-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 12px 18px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    width: 100%;
}

.choice-btn:hover {
    background: var(--button-secondary-hover-bg);
}

.choice-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
    opacity: 0.8;
}