/* /home/editable-ultrasound-generator.digitalprank.com/public_html/assets/css/style.css */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f5f5f5;
    color: #1a1a1a;
}

/* Mobile-only top Next button - hidden on desktop */
.mobile-top-next-btn {
    display: none;
}

.container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

/* Progress Bar */
.progress-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px 0;
}

.progress-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.step {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.step.active {
    color: white;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-weight: bold;
}

.step.active .step-number {
    background: white;
    color: #667eea;
}

/* Step Content */
.step-content {
    display: none;
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.step-content.active {
    display: block;
}

/* Week Selector */
.week-selector-wrapper h2 {
    font-family: 'Fraunces', serif;
    font-size: 2rem;
    margin-bottom: 10px;
    color: #2d3748;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
}

.selector-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0;
}

.selector-tab {
    flex: 1;
    padding: 15px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: #666;
    font-weight: 500;
}

.selector-tab:hover {
    background: #f8f9fa;
}

.selector-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: #f0f4ff;
}

.tab-icon {
    font-size: 24px;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

.tab-panel h3 {
    margin-bottom: 20px;
    color: #2d3748;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.special-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.special-card {
    border: 3px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    background: #000;
}

.special-card:hover {
    transform: scale(1.05);
    border-color: #667eea;
}

.special-card.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.special-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.special-label {
    padding: 10px;
    background: white;
    text-align: center;
    font-weight: 500;
}

.weeks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

/* Week Cards with Images (JS generated) */
.weeks-grid-with-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.week-card {
    border: 3px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    background: #fff;
}

.week-card:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

.week-card.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.week-image-wrapper {
    background: #000;
    overflow: hidden;
}

.week-image-wrapper img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.week-card:hover .week-image-wrapper img {
    transform: scale(1.05);
}

.week-info {
    padding: 12px;
    text-align: center;
    background: #fff;
}

.week-info .week-number {
    font-size: 22px;
    font-weight: bold;
    color: #2d3748;
}

.week-info .week-label {
    font-size: 13px;
    color: #666;
}

.week-card.selected .week-info {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.week-card.selected .week-info .week-number,
.week-card.selected .week-info .week-label {
    color: white;
}

/* Upload Mode Options */
.upload-mode-selection {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.upload-mode-option {
    flex: 1;
    padding: 20px;
    border: 3px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.upload-mode-option:hover {
    border-color: #667eea;
    background: #f8fafc;
}

.upload-mode-option.selected {
    border-color: #667eea;
    background: #f0f4ff;
}

.mode-radio {
    width: 24px;
    height: 24px;
    border: 2px solid #cbd5e0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.upload-mode-option.selected .mode-radio {
    border-color: #667eea;
}

.radio-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: transparent;
}

.upload-mode-option.selected .radio-dot {
    background: #667eea;
}

.mode-content {
    flex: 1;
}

.mode-title {
    font-weight: 600;
    font-size: 16px;
    color: #2d3748;
    margin-bottom: 5px;
}

.mode-description {
    font-size: 14px;
    color: #64748b;
    line-height: 1.4;
}

.mode-price {
    margin-top: 8px;
    font-size: 14px;
}

/* Build Type Buttons */
.build-type-btn {
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s;
}

.build-type-btn:hover {
    border-color: #667eea;
}

.build-type-btn.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.week-btn {
    padding: 20px;
    border: 3px solid #e2e8f0;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.week-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.week-btn.selected {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
}

.week-number {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

.week-label {
    font-size: 14px;
    opacity: 0.9;
}

/* Upload Section */
.divider-section {
    display: flex;
    align-items: center;
    margin: 40px 0;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.divider-text {
    padding: 0 20px;
    color: #999;
    font-weight: 600;
}

.upload-area {
    border: 3px dashed #e2e8f0;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-preview img {
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
}

/* Image Selector */
.package-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.package-card {
    border: 3px solid #e2e8f0;
    border-radius: 16px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s;
}

.package-card.active {
    border-color: #667eea;
    background: #f0f4ff;
}

.package-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.package-icon {
    font-size: 32px;
}

.package-price {
    font-size: 28px;
    font-weight: bold;
    color: #667eea;
}

.selection-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 30px;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.image-card {
    position: relative;
    border: 3px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.image-card:hover {
    transform: scale(1.05);
}

.image-card.selected {
    border-color: #667eea;
}

.image-wrapper {
    position: relative;
    padding-top: 75%;
    background: #000;
}

.image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.selection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(102, 126, 234, 0.8);
    opacity: 0;
    transition: opacity 0.3s;
}

.image-card.selected .selection-overlay {
    opacity: 1;
}

.selection-number {
    font-size: 48px;
    font-weight: bold;
    color: white;
}

.filter-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-tab {
    padding: 10px 20px;
    background: #f8f9fa;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-tab.active {
    background: #667eea;
    color: white;
}

/* Overlay Editor - Side by Side */
.overlay-editor-split {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 30px;
    min-height: 600px;
}

.overlay-sidebar {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    max-height: 600px;
    overflow-y: auto;
}

.overlay-sidebar h3 {
    margin-bottom: 10px;
    color: #2d3748;
}

.overlay-sidebar p {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.overlay-preview {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
}

.overlay-preview h3 {
    margin-bottom: 20px;
    color: #2d3748;
}

.canvas-container {
    background: #000;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#overlayCanvas {
    display: block;
    cursor: move;
    max-width: 100%;
    height: auto;
}

.help-text {
    text-align: center;
    font-size: 13px;
    color: #666;
}

.overlay-list {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.overlay-list h4 {
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
}

.overlay-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: white;
    border-radius: 6px;
    margin-bottom: 5px;
}

.overlay-text {
    font-size: 14px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.remove-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: #e2e8f0;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.remove-btn:hover {
    background: #ff5252;
    color: white;
}

.no-overlays {
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 20px;
}

/* Overlay Controls */
.overlay-controls {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
}

.overlay-controls h4 {
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 600;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.control-group label {
    width: 60px;
    font-size: 13px;
    color: #666;
}

.control-group input[type="range"] {
    flex: 1;
}

.control-group span {
    width: 40px;
    text-align: right;
    font-size: 13px;
    font-weight: 500;
}

.overlay-item.selected {
    background: #e8f0ff;
    border: 1px solid #667eea;
}

.overlay-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.overlay-options {
    display: grid;
    gap: 10px;
}

.overlay-option {
    padding: 12px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.overlay-option:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.emoji-grid {
    grid-template-columns: repeat(4, 1fr);
}

.emoji-option {
    padding: 15px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 32px;
    transition: all 0.3s;
}

.emoji-option:hover {
    border-color: #667eea;
    transform: scale(1.1);
}

.preview-area {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
}

.canvas-wrapper {
    background: #000;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
}

.canvas-wrapper canvas {
    width: 100%;
    height: auto;
    display: block;
}

/* Patient Info */
.format-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.format-selector {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.format-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.format-option:hover {
    background: #e2e8f0;
    border-color: #cbd5e0;
}

.format-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.format-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: #667eea;
}

.format-option span {
    font-size: 14px;
    color: #4a5568;
    user-select: none;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
}

.form-group input {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.expanded-option {
    margin-top: 30px;
    padding: 20px;
    background: #fffbf0;
    border: 2px solid #fbbf24;
    border-radius: 12px;
}

.expand-header {
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    cursor: pointer;
}

.expanded-fields {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

/* Preview */
.preview-container {
    background: #000;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

#mainCanvas {
    width: 100%;
    height: auto;
    display: block;
}

/* Step 5 Review - Smaller preview to fit in browser fold */
#step5 .preview-container {
    max-width: 50%;
    margin-left: auto;
    margin-right: auto;
}

#step5 #mainCanvas {
    max-width: 100%;
}

/* Navigation */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e2e8f0;
}

.btn {
    padding: 14px 32px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-large {
    padding: 20px 40px;
    font-size: 18px;
}

/* Payment */
.payment-summary {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 18px;
}

.download-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}


/* Responsive */
@media (max-width: 768px) {
    .progress-steps {
        flex-wrap: wrap;
        gap: 20px;
    }

    .overlay-editor {
        grid-template-columns: 1fr;
    }

    .form-row,
    .package-selector,
    .format-options {
        grid-template-columns: 1fr;
    }
}

/* ===========================================
   MOBILE-SPECIFIC STYLES (under 768px)
   These styles ONLY affect mobile devices
   Desktop remains completely unchanged
   =========================================== */

@media (max-width: 768px) {
    /* --- Container & General Layout --- */
    .container {
        margin: 20px auto;
        padding: 0 12px;
    }

    .step-content {
        padding: 20px 15px;
        border-radius: 12px;
        overflow-x: hidden !important;
        max-width: 100vw;
    }

    /* --- Progress Bar / Step Navigator --- */
    .progress-bar {
        padding: 15px 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .progress-steps {
        gap: 8px;
        justify-content: flex-start;
        min-width: max-content;
        padding: 0 5px;
    }

    .step {
        flex-direction: column;
        text-align: center;
        font-size: 11px;
        min-width: 50px;
    }

    .step span {
        display: none; /* Hide text labels on mobile */
    }

    .step-number {
        width: 36px;
        height: 36px;
        font-size: 14px;
        margin-right: 0;
        margin-bottom: 4px;
    }

    /* Show abbreviated labels below step numbers */
    .step::after {
        content: attr(data-step);
        font-size: 10px;
        opacity: 0.8;
    }

    /* --- Week Selector Tabs (Step 1) --- */
    .selector-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 5px;
        padding-bottom: 10px;
        margin-bottom: 20px;
    }

    .selector-tab {
        min-width: 80px;
        padding: 10px 12px;
        flex-shrink: 0;
    }

    .tab-icon {
        font-size: 20px;
    }

    .tab-text {
        font-size: 11px;
    }

    /* --- Week Cards Grid --- */
    .weeks-grid-with-images {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .week-card {
        border-radius: 8px;
    }

    .week-card .week-number {
        font-size: 18px;
    }

    .week-card .week-label {
        font-size: 11px;
    }

    .week-image-wrapper img {
        height: 80px;
        object-fit: cover;
    }

    /* --- Special Grid --- */
    .special-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .special-card img {
        height: 100px;
    }

    .special-label {
        font-size: 12px;
        padding: 8px;
    }

    /* --- Upload Section --- */
    .upload-area {
        padding: 25px 15px;
    }

    .upload-area p {
        font-size: 14px;
    }

    .upload-preview img {
        max-width: 100%;
        max-height: 200px;
    }

    /* --- Package Selector (Step 2) --- */
    .package-selector {
        gap: 15px;
    }

    .package-card {
        padding: 20px 15px;
        border-radius: 12px;
    }

    .package-header {
        margin-bottom: 15px;
    }

    .package-icon {
        font-size: 24px;
    }

    .package-price {
        font-size: 22px;
    }

    .package-card h3 {
        font-size: 16px;
    }

    .package-card p {
        font-size: 13px;
    }

    /* --- Image Grid --- */
    .image-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .image-card {
        border-radius: 8px;
        border-width: 2px;
    }

    .selection-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 12px;
    }

    .filter-tabs {
        flex-wrap: wrap;
        gap: 8px;
    }

    .filter-tab {
        padding: 8px 14px;
        font-size: 13px;
    }

    /* --- Overlay Editor (Step 4) --- */
    .overlay-editor-split {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .overlay-sidebar {
        max-height: none;
        padding: 15px;
    }

    .overlay-sidebar h3 {
        font-size: 18px;
    }

    .overlay-preview {
        padding: 15px;
    }

    .overlay-tabs {
        flex-wrap: wrap;
        gap: 8px;
    }

    .tab-btn {
        padding: 10px 14px;
        font-size: 13px;
    }

    .emoji-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .emoji-option {
        padding: 10px;
        font-size: 24px;
    }

    .overlay-option {
        padding: 10px;
        font-size: 14px;
    }

    .help-text {
        font-size: 12px;
    }

    /* --- Patient Info (Step 3) --- */
    .patient-info-split {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    .patient-form-section {
        padding: 20px 15px;
    }

    .patient-preview-section {
        padding: 15px;
    }

    .form-group label {
        font-size: 14px;
    }

    /* Prevent iOS zoom on input focus */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px !important;
    }

    .format-selector {
        flex-wrap: wrap;
        gap: 8px;
    }

    .format-option {
        padding: 8px 10px;
        font-size: 13px;
    }

    .format-option span {
        font-size: 12px;
    }

    .expanded-option {
        padding: 15px;
        margin-top: 20px;
    }

    .expand-header {
        margin-bottom: 15px;
    }

    .checkbox-label {
        font-size: 14px;
    }

    .expand-desc {
        font-size: 12px;
    }

    /* --- Preview Containers --- */
    .preview-container {
        padding: 10px;
        border-radius: 8px;
        margin-bottom: 20px;
    }

    #step5 .preview-container {
        max-width: 100%;
    }

    /* --- Navigation Buttons --- */
    .nav-buttons {
        flex-direction: column;
        gap: 12px;
        margin-top: 20px;
        padding-top: 20px;
    }

    .nav-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    .btn {
        padding: 14px 20px;
        font-size: 15px;
        min-height: 48px; /* Touch-friendly */
    }

    .btn-large {
        padding: 16px 24px;
        font-size: 16px;
    }

    /* --- Payment Section (Step 6) --- */
    .payment-summary {
        padding: 20px 15px;
        border-radius: 10px;
        margin-bottom: 20px;
    }

    .summary-line {
        font-size: 15px;
        padding: 8px 0;
        flex-wrap: wrap;
        gap: 8px;
    }

    .summary-line button {
        font-size: 11px !important;
        padding: 4px 8px !important;
    }

    .download-buttons {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* --- Headings --- */
    h2 {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }

    h3 {
        font-size: 1.2rem;
    }

    .subtitle {
        font-size: 14px;
        margin-bottom: 20px;
    }

    /* --- Triple Mode Thumbnails --- */
    .thumbnail-selector,
    .overlay-thumbnail-selector {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px;
    }

    .thumbnail-item,
    .overlay-thumbnail-item {
        flex: 1 1 calc(33% - 10px);
        min-width: 80px;
    }

    .thumbnail-item canvas,
    .overlay-thumbnail-item canvas {
        width: 100% !important;
        height: auto !important;
    }

    .thumbnail-label,
    .overlay-thumbnail-label {
        font-size: 10px;
        padding: 4px;
    }
}

/* ============================================
   SMALL MOBILE STYLES (375px and below)
   Extra adjustments for iPhone SE, older phones
   ============================================ */

@media (max-width: 375px) {
    .container {
        padding: 0 10px;
    }

    .step-content {
        padding: 15px 12px;
        overflow-x: hidden !important;
    }

    .weeks-grid-with-images {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .week-card .week-number {
        font-size: 16px;
    }

    .image-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .special-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .selector-tab {
        min-width: 70px;
        padding: 8px 10px;
    }

    .tab-icon {
        font-size: 18px;
    }

    .tab-text {
        font-size: 10px;
    }

    .package-price {
        font-size: 20px;
    }

    .emoji-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .emoji-option {
        padding: 8px;
        font-size: 20px;
    }

    h2 {
        font-size: 1.3rem;
    }

    h3 {
        font-size: 1.1rem;
    }
}

/* ============================================
   MOBILE FIXES FOR INLINE-STYLED ELEMENTS
   These override inline styles only on mobile
   ============================================ */

@media (max-width: 768px) {
    /* --- Etsy Banner --- */
    #etsy-banner > div {
        padding: 0 15px !important;
    }

    #etsy-banner p {
        font-size: 14px !important;
        line-height: 1.4 !important;
    }

    #etsy-banner input[type="text"] {
        max-width: 100% !important;
        width: 100% !important;
        margin-bottom: 8px;
        font-size: 16px !important; /* Prevent iOS zoom */
    }

    #etsy-banner button {
        flex: 1 1 auto !important;
        min-width: 120px !important;
    }

    #etsy-entry-mode > div {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    /* --- Payment Page Product Grids --- */
    /* Mug & T-Shirt row */
    #step6 > div > div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    .mug-section,
    .tshirt-section,
    .ornament-section,
    .canvas-section {
        padding: 15px !important;
    }

    .mug-section h3,
    .tshirt-section h3,
    .ornament-section h3,
    .canvas-section h3 {
        font-size: 16px !important;
    }

    .mug-section p,
    .tshirt-section p,
    .ornament-section p,
    .canvas-section p {
        font-size: 13px !important;
    }

    /* Product mockup images */
    #mugMockup img,
    #tshirtMockup img {
        max-width: 140px !important;
    }

    /* Product selects and options */
    #canvasSize,
    #mugSize,
    #tshirtSize,
    #ornamentShape {
        font-size: 16px !important; /* Prevent iOS zoom */
        padding: 10px !important;
    }

    /* --- Success Section --- */
    #successSection > div {
        padding: 20px 15px !important;
    }

    #successSection h1 {
        font-size: 24px !important;
    }

    #successSection p {
        font-size: 15px !important;
    }

    /* Success checkmark icon */
    #successSection > div > div:first-child > div:first-child {
        width: 80px !important;
        height: 80px !important;
    }

    /* --- Upload Mode Options --- */
    .upload-mode-selection {
        flex-direction: column !important;
    }

    .upload-mode-option {
        padding: 15px !important;
    }

    .mode-title {
        font-size: 15px !important;
    }

    .mode-description {
        font-size: 13px !important;
    }

    /* --- Build Your Own Controls --- */
    #buildYourOwnOptions {
        padding: 15px !important;
    }

    #buildYourOwnOptions > div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    .build-type-btn {
        padding: 10px 16px !important;
        font-size: 14px !important;
    }

    /* --- Card Payment Element --- */
    #card-element {
        padding: 12px !important;
    }

    /* --- DOB Input Row --- */
    #motherDOBYear {
        width: 70px !important;
        font-size: 16px !important;
    }

    /* --- Triple Overlay Editor --- */
    .overlay-editor-triple {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .overlay-preview-triple {
        padding: 15px !important;
    }

    .overlay-main-preview canvas {
        width: 100% !important;
        height: auto !important;
    }

    /* --- Etsy Credit Display --- */
    #etsyCreditPayment > div {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    /* --- Main Canvas Responsive --- */
    #mainCanvas,
    #overlayCanvas,
    #overlayMainCanvas,
    #patientPreviewCanvas,
    #buildPreviewCanvas {
        width: 100% !important;
        height: auto !important;
    }

    /* ============================================
       NOTE: Mobile header/hamburger styles are now
       handled ONLY by header.php (CDN) - do NOT
       duplicate here to avoid conflicts
       ============================================ */

    /* Compact hero section on mobile */
    .hero-section {
        padding: 40px 0 !important;
    }

    .hero-container {
        padding: 0 15px !important;
    }

    .hero-content h1 {
        font-size: 1.8rem !important;
        margin-bottom: 12px !important;
    }

    .hero-content .subtitle {
        font-size: 1rem !important;
        margin-bottom: 20px !important;
    }

    .hero-features {
        margin-bottom: 25px !important;
    }

    .hero-features li {
        font-size: 0.9rem !important;
        padding: 5px 0 !important;
    }

    .cta-button {
        padding: 12px 24px !important;
        font-size: 1rem !important;
    }

    /* Hide hero examples on mobile to save space */
    .hero-examples {
        display: none !important;
    }

    /* ============================================
       ISSUE 1: Top "Next" button for image selection (mobile only)
       ============================================ */
    .mobile-top-next-btn {
        display: block !important;
        width: 100%;
        margin-bottom: 15px;
        padding: 12px 24px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        text-align: center;
    }
    .mobile-top-next-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

    /* ============================================
       ISSUE 2: Patient Information form responsive fixes
       ============================================ */
    .patient-form-section {
        width: 100% !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    .patient-form-section .basic-fields,
    .patient-form-section .form-group {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .patient-form-section input,
    .patient-form-section select {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Fix DOB row - stack vertically on narrow screens */
    .patient-form-section .form-group > div[style*="display: flex"] {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    /* Year input should take less space */
    #motherDOBYear {
        width: 80px !important;
        min-width: 80px !important;
        flex-shrink: 0 !important;
    }

    /* Date picker should fill remaining space */
    #motherDOB {
        flex: 1 1 120px !important;
        min-width: 120px !important;
    }

    /* Clear button styling */
    .patient-form-section .btn-small {
        flex-shrink: 0 !important;
        padding: 8px 12px !important;
        font-size: 13px !important;
    }

    /* Patient info split layout - full width on mobile */
    .patient-info-split {
        flex-direction: column !important;
        gap: 15px !important;
    }

    .patient-info-split > div {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Preview canvas container */
    .preview-container,
    .patient-preview-container {
        width: 100% !important;
        padding: 10px !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    /* Advanced fields section */
    .advanced-fields-section {
        width: 100% !important;
        padding: 15px !important;
        box-sizing: border-box !important;
    }

    .advanced-fields-section .form-group {
        width: 100% !important;
    }

    /* ============================================
       ISSUE 1 FIX: Advanced Technical Parameters box overflow
       Fix the yellow/cream "Customize all technical fields" box
       ============================================ */
    .expanded-option {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 12px !important;
        margin-top: 15px !important;
        overflow: hidden !important;
    }

    .expand-header {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .checkbox-label {
        flex-wrap: wrap !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .checkbox-label input[type="checkbox"] {
        flex-shrink: 0 !important;
        width: 20px !important;
        height: 20px !important;
        margin: 0 !important;
    }

    .checkbox-label span {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        font-size: 14px !important;
        line-height: 1.3 !important;
    }

    .expand-desc {
        width: 100% !important;
        margin: 8px 0 0 0 !important;
        padding-left: 28px !important;
        box-sizing: border-box !important;
        font-size: 12px !important;
        line-height: 1.4 !important;
        word-wrap: break-word !important;
    }

    /* Expanded fields inside the box */
    .expanded-fields {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 15px 10px !important;
    }

    .expanded-fields .form-row {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .expanded-fields .form-group {
        width: 100% !important;
    }

    .expanded-fields h4 {
        font-size: 13px !important;
        margin-bottom: 12px !important;
    }

    /* ============================================
       ISSUE 2 FIX: Touch dragging for fun elements
       Improve touch behavior on overlay canvas
       ============================================ */
    #overlayCanvas,
    #overlayMainCanvas {
        touch-action: none !important; /* Disable browser touch gestures on canvas */
        cursor: grab;
        -webkit-user-select: none;
        user-select: none;
    }

    #overlayCanvas:active,
    #overlayMainCanvas:active {
        cursor: grabbing;
    }

    /* Canvas container touch improvements */
    .canvas-container,
    .overlay-main-preview {
        touch-action: pan-y pinch-zoom; /* Allow vertical scrolling outside canvas */
        -webkit-overflow-scrolling: touch;
    }

    /* Overlay preview section touch optimization */
    .overlay-preview,
    .overlay-preview-triple {
        overflow: visible;
    }

    /* Help text for mobile */
    .help-text {
        padding: 8px 12px !important;
        background: #f0f4ff;
        border-radius: 6px;
        font-size: 11px !important;
    }
}