
        :root {
            --primary-color: #c99c9d;
            --secondary-color: #333;
            --background-color: #c99c9d;
            --panel-bg-color: #ffffff;
            --text-color: #333;
            --border-color: #dfe6e9;
            --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }
        
        * {
            box-sizing: border-box;
        }
        
        .loading-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(255, 255, 255, 0.8);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 9999;
            backdrop-filter: blur(5px);
        }

        .loading-overlay p {
            font-size: 1.2rem;
            font-weight: bold;
            color: var(--primary-color);
            margin-top: 1rem;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            margin: 0;
            background-color: var(--background-color);
            color: var(--text-color);
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }
        
        .birthday-card-app { 
            display: flex; 
            flex-direction: column; 
            height: 100vh; 
        }
        
        .app-header {
            background: var(--primary-color); 
            color: white; 
            padding: 1rem;
            display: flex; 
            align-items: center; 
            justify-content: center; 
            gap: 1rem;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
            z-index: 10;
            flex-wrap: wrap;
        }
        
        .app-header img { 
            height: 40px; 
            width: auto; 
        }
        
        .app-header .title-image { 
            height: 40px; 
            width: auto; 
            max-width: 250px; 
        }
        
        .progress-bar {
            display: flex; 
            justify-content: space-between; 
            padding: 0.5rem 0.5rem;
            background: white; 
            box-shadow: 0 2px 5px rgba(0,0,0,0.05);
            overflow-x: auto;
        }
        
        .progress-step {
            flex: 1; 
            text-align: center; 
            padding: 0.5rem 0.25rem; 
            position: relative;
            font-size: 12px; 
            color: #999;
            white-space: nowrap;
            min-width: 60px;
        }
        
        .progress-step.active { 
            color: var(--primary-color); 
            font-weight: bold; 
        }
        
        .progress-step.completed { 
            color: #27ae60; 
        }
        
        .progress-step::after {
            content: ''; 
            position: absolute; 
            top: 50%; 
            right: -50%; 
            width: 100%;
            height: 2px; 
            background: #ddd; 
            z-index: -1;
        }
        
        .progress-step:last-child::after { 
            display: none; 
        }
        
        .progress-step.completed::after { 
            background: #27ae60; 
        }
        
        .main-content { 
            display: flex; 
            flex: 1; 
            overflow: hidden; 
            flex-direction: column;
        }
        
        .preview-panel {
            display: flex; 
            justify-content: center; 
            align-items: center;
            padding: 1rem; 
            background-color: #e9e9e9; 
            position: relative;
            min-height: 300px;
            max-height: 50vh;
        }
        
        .preview-toggle-mobile {
            display: none;
            position: absolute;
            top: 10px;
            right: 10px;
            background: var(--primary-color);
            color: white;
            border: none;
            padding: 0.5rem 1rem;
            border-radius: 5px;
            cursor: pointer;
            font-weight: bold;
            z-index: 5;
        }
        
        .card-preview-svg {
            width: auto;
            height: 90%;
            aspect-ratio: 595 / 842;
            max-width: 90%;
            max-height: 400px;
            border-radius: 15px;
           
            
        }
        
        .stage-container {
            flex: 1;
            background-color: var(--panel-bg-color); 
            padding: 1rem;
            overflow-y: auto; 
            box-shadow: -5px 0 15px rgba(0, 0, 0, 0.05);
        }
        
        .stage { 
            display: none; 
        }
        
        .stage.active { 
            display: block; 
        }
        
        .stage h2 {
            margin-top: 0; 
            color: var(--primary-color); 
            border-bottom: 2px solid var(--secondary-color);
            padding-bottom: 0.5rem;
            font-size: 1.5rem;
        }
        
        .form-group { 
            margin-bottom: 1.5rem; 
        }
        
        .form-group label { 
            display: block; 
            font-weight: 600; 
            margin-bottom: 0.5rem; 
        }
        
        .form-group input[type="text"], 
        .form-group input[type="number"],
        .form-group input[type="email"],
        .form-group textarea {
            width: 100%; 
            padding: 0.8rem; 
            border: 1px solid var(--border-color);
            border-radius: 5px; 
            box-sizing: border-box; 
            font-size: 16px;
        }
        
        .form-group textarea { 
            min-height: 120px; 
            resize: vertical; 
        }
        
        .form-group input:focus, .form-group textarea:focus { 
            outline: none; 
            border-color: var(--primary-color); 
        }
        
        .image-selector-with-see-all { 
            display: flex; 
            align-items: center; 
            margin-bottom: 1rem; 
            gap: 10px;
            flex-wrap: wrap;
        }
        
        .image-selector-container {
            display: flex; 
            overflow-x: auto; 
            gap: 10px; 
            padding: 10px; 
            flex-grow: 1;
            border-radius: 8px; 
            background: #f1f1f1; 
            scrollbar-width: thin;
            min-width: 0;
        }
        
        .image-selector-item {
            flex-shrink: 0; 
            width: 100px; 
            height: 100px; 
            border: 2px solid transparent;
            border-radius: 8px; 
            padding: 5px; 
            cursor: pointer; 
            transition: all 0.2s;
            background-color: white; 
            display: flex; 
            align-items: center; 
            justify-content: center;
        }
        
        .image-selector-item:hover { 
            border-color: var(--secondary-color); 
        }
        
        .image-selector-item.selected {
            border-color: var(--primary-color); 
            transform: scale(1.05);
            box-shadow: 0 0 10px rgba(108, 92, 231, 0.5);
        }
        
        .image-selector-item img { 
            width: 100%; 
            height: 100%; 
            object-fit: contain; 
            border-radius: 4px; 
        }
        
        .see-all-button {
            padding: 0.5rem 1rem; 
            background-color: var(--secondary-color);
            color: white; 
            border: none; 
            border-radius: 5px; 
            cursor: pointer;
            font-weight: bold; 
            transition: background-color 0.2s; 
            white-space: nowrap;
            min-height: 44px;
        }
        
        .see-all-button:hover { 
            background-color: var(--primary-color); 
        }
        
        .hair-color-picker { 
            display: flex; 
            flex-wrap: wrap; 
            gap: 8px; 
        }
        
        .color-swatch {
            width: 44px; 
            height: 44px; 
            border-radius: 50%; 
            border: 2px solid var(--border-color);
            cursor: pointer; 
            transition: transform 0.2s, box-shadow 0.2s;
        }
        
        .color-swatch:hover { 
            transform: scale(1.1); 
        }
        
        .color-swatch.selected {
            border-color: var(--primary-color); 
            box-shadow: 0 0 5px var(--primary-color);
            transform: scale(1.15);
        }
        
        .product-option {
            border: 2px solid var(--border-color); 
            border-radius: 8px; 
            padding: 1rem;
            margin-bottom: 1rem; 
            cursor: pointer; 
            transition: all 0.2s;
        }
        
        .product-option:hover { 
            border-color: var(--secondary-color); 
        }
        
        .product-option.selected {
            border-color: var(--primary-color); 
            background-color: #f0ebff;
        }
        
        .product-option h4 { 
            margin: 0 0 0.5rem 0; 
            color: var(--primary-color); 
        }
        
        .product-option .price { 
            font-size: 1.5rem; 
            font-weight: bold; 
            color: var(--primary-color); 
        }
        
        .checkbox-option {
            display: flex; 
            align-items: center; 
            padding: 0.8rem; 
            border: 1px solid var(--border-color);
            border-radius: 5px; 
            margin-bottom: 1rem; 
            cursor: pointer;
            min-height: 44px;
        }
        
        .checkbox-option input { 
            margin-right: 0.8rem; 
            width: 20px; 
            height: 20px; 
            cursor: pointer; 
        }
        
        .checkbox-option:hover { 
            background-color: #f8f9fa; 
        }
        
        .total-price {
            background: var(--primary-color); 
            color: white; 
            padding: 1rem; 
            border-radius: 8px;
            text-align: center; 
            margin: 1rem 0; 
            font-size: 1.5rem; 
            font-weight: bold;
        }
        
        #payment-element {
            margin: 2rem 0;
        }
        
        .stage-navigation {
            display: flex; 
            justify-content: space-between; 
            margin-top: 2rem; 
            padding-top: 1rem;
            border-top: 1px solid var(--border-color);
            gap: 1rem;
            flex-wrap: wrap;
        }
        
        .btn {
            padding: 0.8rem 2rem; 
            border: none; 
            border-radius: 5px; 
            font-size: 16px;
            font-weight: bold; 
            cursor: pointer; 
            transition: all 0.2s;
            min-height: 44px;
            flex: 1;
            min-width: 120px;
        }
        
        .btn-primary {
            background: var(--primary-color); 
            color: white;
        }
        
        .btn-primary:hover { 
            background: #5848c2; 
        }
        
        .btn-secondary {
            background: var(--border-color); 
            color: var(--text-color);
        }
        
        .btn-secondary:hover { 
            background: #cbd5e0; 
        }
        
        .btn:disabled {
            opacity: 0.5; 
            cursor: not-allowed;
        }
        
        .lightbox-overlay {
            position: fixed; 
            top: 0; 
            left: 0; 
            width: 100%; 
            height: 100%;
            background: rgba(0, 0, 0, 0.7); 
            display: flex; 
            justify-content: center;
            align-items: center; 
            z-index: 1000;
            padding: 1rem;
        }
        
        .lightbox-content {
            background: white; 
            padding: 1rem; 
            border-radius: 10px;
            width: 95%; 
            max-width: 1200px; 
            max-height: 90vh; 
            overflow-y: auto; 
            position: relative;
        }
        
        .lightbox-close {
            position: absolute; 
            top: 10px; 
            right: 15px; 
            font-size: 2rem;
            background: none; 
            border: none; 
            cursor: pointer; 
            color: #888;
            z-index: 10;
            width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .lightbox-close:hover { 
            color: #333; 
        }
        
        .lightbox-content h2 {
            margin-top: 0;
            padding-right: 50px;
            font-size: 1.5rem;
        }
        
        .lightbox-grid {
            display: grid; 
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 20px; 
            margin-top: 1rem;
            justify-items: center;
        }
        
        .lightbox-grid-item {
            width: 250px;
            height: 250px;
            border: 2px solid transparent; 
            border-radius: 8px;
            padding: 5px; 
            cursor: pointer; 
            transition: all 0.3s; 
            background-color: white;
            display: flex; 
            align-items: center; 
            justify-content: center;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        
        .lightbox-grid-item:hover { 
            border-color: var(--secondary-color); 
            transform: scale(1.05);
            z-index: 10;
        }
        
        .lightbox-grid-item.selected { 
            border-color: var(--primary-color);
            box-shadow: 0 0 10px rgba(201, 156, 157, 0.5);
        }
        
        .lightbox-grid-item img {
            max-width: 100%; 
            max-height: 100%; 
            object-fit: contain; 
            border-radius: 4px;
        }
        
        .loading-screen {
            display: flex; 
            justify-content: center; 
            align-items: center;
            height: 100%; 
            font-size: 2em; 
            color: var(--primary-color);
        }
        
        .loading-spinner {
            border: 4px solid #f3f3f3; 
            border-top: 4px solid var(--primary-color);
            border-radius: 50%; 
            width: 40px; 
            height: 40px; 
            animation: spin 1s linear infinite;
            display: inline-block;
        }
        
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        .payment-error {
            color: #dc3545;
            background: #f8d7da;
            border: 1px solid #f5c6cb;
            padding: 1rem;
            border-radius: 5px;
            margin: 1rem 0;
        }
        
        /* MOBILE RESPONSIVE STYLES */
        
        /* Tablet (768px and below) */
        @media (max-width: 768px) {
            .app-header {
                padding: 0.75rem;
            }
            
            .app-header img {
                height: 35px;
            }
            
            .app-header .title-image {
                height: 35px;
                max-width: 200px;
            }
            
            .progress-step {
                font-size: 11px;
                padding: 0.4rem 0.2rem;
            }
            
            .main-content {
                flex-direction: column;
            }
            
            .preview-panel {
                max-height: 40vh;
                min-height: 250px;
            }
            
            .card-preview-svg {
                max-height: 300px;
            }
            
            .stage h2 {
                font-size: 1.3rem;
            }
            
            .lightbox-grid {
                grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
                gap: 15px;
            }
            
            .lightbox-grid-item {
                width: 200px;
                height: 200px;
            }
            
            .lightbox-content {
                padding: 1.5rem 1rem;
            }
            
            .lightbox-content h2 {
                font-size: 1.3rem;
            }
        }
        
        /* Mobile (576px and below) */
        @media (max-width: 576px) {
            .app-header {
                padding: 0.5rem;
                gap: 0.5rem;
            }
            
            .app-header img {
                height: 30px;
            }
            
            .app-header .title-image {
                height: 30px;
                max-width: 150px;
            }
            
            .progress-bar {
                padding: 0.4rem 0.25rem;
            }
            
            .progress-step {
                font-size: 10px;
                padding: 0.3rem 0.1rem;
                min-width: 50px;
            }
            
            .preview-panel {
                padding: 0.5rem;
                max-height: 35vh;
                min-height: 200px;
            }
            
            .preview-toggle-mobile {
                display: block;
            }
            
            .preview-panel.collapsed {
                max-height: 60px;
                min-height: 60px;
            }
            
            .preview-panel.collapsed .card-preview-svg {
                display: none;
            }
            
            .card-preview-svg {
                max-height: 250px;
                max-width: 95%;
            }
            
            .stage-container {
                padding: 0.75rem;
            }
            
            .stage h2 {
                font-size: 1.2rem;
                padding-bottom: 0.4rem;
            }
            
            .form-group {
                margin-bottom: 1rem;
            }
            
            .form-group input,
            .form-group textarea {
                padding: 0.7rem;
                font-size: 16px;
            }
            
            .image-selector-with-see-all {
                flex-direction: column;
                align-items: stretch;
            }
            
            .image-selector-container {
                width: 100%;
                padding: 8px;
            }
            
            .image-selector-item {
                width: 80px;
                height: 80px;
            }
            
            .see-all-button {
                width: 100%;
                margin-top: 0.5rem;
            }
            
            .hair-color-picker {
                gap: 10px;
                justify-content: center;
            }
            
            .color-swatch {
                width: 50px;
                height: 50px;
            }
            
            .product-option {
                padding: 0.75rem;
            }
            
            .product-option h4 {
                font-size: 1rem;
            }
            
            .product-option .price {
                font-size: 1.3rem;
            }
            
            .stage-navigation {
                flex-direction: column;
                gap: 0.75rem;
            }
            
            .btn {
                width: 100%;
                padding: 0.9rem;
                font-size: 15px;
            }
            
            .lightbox-overlay {
                padding: 0.5rem;
            }
            
            .lightbox-content {
                width: 100%;
                max-height: 95vh;
                padding: 1rem 0.75rem;
                border-radius: 8px;
            }
            
            .lightbox-content h2 {
                font-size: 1.1rem;
                padding-right: 45px;
            }
            
            .lightbox-close {
                top: 8px;
                right: 8px;
                font-size: 1.5rem;
                width: 40px;
                height: 40px;
            }
            
            .lightbox-grid {
                grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
                gap: 10px;
            }
            
            .lightbox-grid-item {
                width: 140px;
                height: 140px;
            }
            
            .total-price {
                font-size: 1.3rem;
                padding: 0.75rem;
            }
            
            .checkbox-option {
                padding: 0.7rem;
            }
        }
        
        /* Small mobile (400px and below) */
        @media (max-width: 400px) {
            .app-header .title-image {
                display: none;
            }
            
            .progress-step {
                font-size: 9px;
                min-width: 45px;
            }
            
            .stage h2 {
                font-size: 1.1rem;
            }
            
            .image-selector-item {
                width: 70px;
                height: 70px;
            }
            
            .lightbox-grid {
                grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
            }
            
            .lightbox-grid-item {
                width: 120px;
                height: 120px;
            }
            
            .color-swatch {
                width: 45px;
                height: 45px;
            }
        }
        
        /* Landscape mobile orientation */
        @media (max-width: 900px) and (orientation: landscape) {
            .preview-panel {
                max-height: 50vh;
            }
            
            .card-preview-svg {
                max-height: 45vh;
            }
        }
        
        /* Desktop (769px and above) - restore side-by-side layout */
        @media (min-width: 769px) {
            .app-header {
                padding: 1rem 2rem;
            }
            
            .app-header img {
                height: 50px;
            }
            
            .app-header .title-image {
                height: 50px;
                max-width: 400px;
            }
            
            .progress-bar {
                padding: 1rem 2rem;
            }
            
            .progress-step {
                font-size: 14px;
                padding: 0.5rem;
            }
            
            .main-content {
                flex-direction: row;
            }
            
            .preview-panel {
                flex: 3;
                padding: 2rem;
                max-height: none;
            }
            
            .card-preview-svg {
                height: 95%;
                max-width: 600px;
                max-height: 800px;
            }
            
            .stage-container {
                flex: 2;
                padding: 2rem;
            }
        }

  .version-tabs {
            display: flex;
            flex-wrap: wrap;
            border-bottom: 2px solid #eee;
            margin-bottom: 1rem;
            padding: 0.5rem 0.5rem 0 0.5rem; /* CHANGED: Removed bottom padding */
            background: #fdfdfd;
            border-radius: 8px 8px 0 0;
        }
        .version-tab {
            padding: 0.75rem 1rem;
            border: 1px solid #ddd;
            background: #f4f4f4;
            cursor: pointer;
            margin-right: 5px;
            margin-bottom: 5px;
            border-radius: 6px 6px 0px 0px;
            font-weight: 500;
            color: #555;
            position: relative;
        }
        .version-tab.active {
            background: #fff;
            border-color: #007bff;
            color: #007bff;
			border-radius:none!important;
            /* CHANGED: Match container border and pull tab down */
            border-bottom: 2px solid #fff; 
            margin-bottom: -2px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }
        .add-version-btn {
            padding: 0.75rem 1rem;
            border: 1px dashed #007bff;
            background: #f0f7ff;
            color: #007bff;
            cursor: pointer;
            border-radius: 6px;
            margin-bottom: 5px;
            font-weight: 500;
        }
        .add-version-btn:hover {
            background: #e6f2ff;
        }
        .remove-version {
            position: absolute;
            top: -5px;
            right: -5px;
            background: #dc3545;
            color: white;
            border-radius: 50%;
            width: 18px;
            height: 18px;
            line-height: 18px;
            text-align: center;
            font-size: 14px;
            font-weight: bold;
            cursor: pointer;
            opacity: 0.7;
        }
        .remove-version:hover {
            opacity: 1;
        }