/* Root variables for a bold, modern design */
:root {
    --primary-color: #ff2e63; /* Vibrant Pink */
    --secondary-color: #252f3f; /* Deep Blue */
    --accent-color: #00d4b4; /* Bright Teal */
    --light-bg: #fefeff; /* Clean White */
    --dark-bg: #1c2526; /* Dark Slate */
    --text-light: #e6ecef; /* Light Gray Text */
    --text-dark: #1a202c; /* Dark Text */
    --border-color-light: #e2e8f0; /* Light Border */
    --border-color-dark: #4a5568; /* Dark Border */
    --footer-bg: #171923; /* Darker Footer */
    --footer-text: #a0aec0; /* Light Gray-Blue Text */
    --button-primary-bg: var(--primary-color);
    --button-primary-hover: #d81b60; /* Darker Pink */
    --button-secondary-bg: var(--secondary-color);
    --button-secondary-hover: #1a202c; /* Darker Blue */
    --page-width: 220mm;
    --page-height: 332mm;
    --photo-width: 35mm;
    --photo-height: 47mm;
    --gap-size: 2mm;
    --padding-size: 10mm;
    --base-font-size: 16px;
    --base-line-height: 1.6;
    --border-radius-sm: 0.25rem;
    --border-radius-md: 0.5rem;
    --box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Basic reset and font */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Manrope', 'Noto Sans Devanagari', sans-serif;
    font-size: var(--base-font-size);
    line-height: var(--base-line-height);
    background-color: var(--light-bg);
    color: var(--text-dark);
    transition: background-color 0.3s ease, color 0.3s ease;
    position: relative;
    overflow-x: hidden;
}

body.dark-mode {
    background-color: var(--dark-bg);
    color: var(--text-light);
}

/* Main container */
.main-container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 15px;
    min-height: calc(100vh - 200px);
}

/* Header styling */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color-light);
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: var(--box-shadow-sm);
    transition: background-color 0.3s ease, border-bottom-color 0.3s ease;
}

body.dark-mode header {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    border-bottom-color: var(--border-color-dark);
}

.logo {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    z-index: 102;
}
.logo a {
    text-decoration: none;
    color: inherit;
}
body.dark-mode .logo {
    color: var(--accent-color);
}

/* Mobile Menu Button */
.mobile-menu-button {
    display: none;
    font-size: 1.75rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dark);
    z-index: 102;
    margin-left: 1rem;
}
body.dark-mode .mobile-menu-button {
    color: var(--text-light);
}

/* Navigation Links */
nav#mainNav {
    display: flex;
    transition: transform 0.3s ease-in-out;
}
nav#mainNav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}
nav#mainNav ul li a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: color 0.2s ease;
}
nav#mainNav ul li a:hover {
    color: var(--primary-color);
}
body.dark-mode nav#mainNav ul li a {
    color: var(--text-light);
}
body.dark-mode nav#mainNav ul li a:hover {
    color: var(--accent-color);
}

/* Header Right Side Elements */
.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 102;
}

/* Language Dropdown */
.language-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color-light);
    border-radius: var(--border-radius-sm);
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    color: var(--text-dark);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
body.dark-mode .language-select {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    border-color: var(--border-color-dark);
    color: var(--text-light);
}

/* Theme Toggle Button */
.theme-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-dark);
    padding: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}
body.dark-mode .theme-toggle {
    color: var(--text-light);
}
.theme-toggle:hover {
    transform: scale(1.2);
}

/* Main Title Styling */
.main-title {
    text-align: center;
    font-size: 2.25rem;
    font-weight: 600;
    margin: 2.5rem 0 2rem 0;
    color: var(--text-dark);
}
body.dark-mode .main-title {
    color: var(--text-light);
}
.main-title span {
    color: var(--primary-color);
}

/* Step container - general styling */
.step-container {
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    border-radius: var(--border-radius-md);
    box-shadow: var(--box-shadow-md);
    margin-top: 2rem;
    margin-bottom: 2rem;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    border: 1px solid var(--border-color-light);
    overflow: hidden;
}

body.dark-mode .step-container {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.25);
    border-color: var(--border-color-dark);
}

/* Step 1 Specific Layout */
#uploadStep .step-content-wrapper {
    display: flex;
    gap: 2rem;
    padding: 2rem;
    border: none;
    margin-bottom: 2rem;
}
body.dark-mode crusade #uploadStep .step-content-wrapper {
    /* No specific dark mode change here as parent handles bg */
}

/* Upload area styling */
.upload-container {
    flex: 1;
    padding: 2.5rem;
    text-align: center;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all 0.3s;
    background: linear-gradient(135deg, #edf2f7, #ffffff);
    border: 2px dashed var(--border-color-light);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 320px;
}

body.dark-mode .upload-container {
    border-color: var(--border-color-dark);
    background: linear-gradient(135deg, #2d3748, #1a202c);
}

.upload-container:hover {
    border-color: var(--primary-color);
    background: #e2e8f0;
}
body.dark-mode .upload-container:hover {
    border-color: var(--accent-color);
    background: #4a5568;
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.upload-text {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
}

.upload-separator {
    display: block;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: #718096;
}
body.dark-mode .upload-separator {
    color: #a0aec0;
}

/* Preview area styling */
.image-preview-container {
    flex: 1;
    border: 1px solid var(--border-color-light);
    border-radius: var(--border-radius-md);
    padding: 0.75rem;
    background: linear-gradient(135deg, #e2e8f0, #edf2f7);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 320px;
    overflow: hidden;
}
body.dark-mode .image-preview-container {
    border-color: var(--border-color-dark);
    background: linear-gradient(135deg, #1a202c, #2d3748);
}

#uploadImagePreview {
    display: block;
    max-width: 100%;
    max-height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: var(--border-radius-sm);
}
#uploadImagePreview.loaded {
    opacity: 1;
}

/* Background Removal Effect */
.image-preview-container.processing::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 46, 99, 0.3), transparent);
    animation: ripple 2s infinite;
}
.image-preview-container.processing img {
    animation: glow 1.5s infinite;
}

/* Size and DPI options */
.size-options-wrapper {
    display: flex;
    justify-content: center;
    padding: 0 2rem 2rem 2rem;
}
.size-options {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.select-box {
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color-light);
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    min-width: 220px;
    color: var(--text-dark);
    font-size: 0.95rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
body.dark-mode .select-box {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    border-color: var(--border-color-dark);
    color: var(--text-light);
}
.size-options label {
    font-weight: 500;
    color: #4a5568;
}
body.dark-mode .size-options label {
    color: #a0aec0;
}

/* Rotation Slider */
.rotation-slider-wrapper {
    padding: 0 2rem 1.5rem 2rem;
    text-align: center;
}
.rotation-slider-wrapper label {
    font-weight: 500;
    margin-right: 0.5rem;
}
#rotationSlider {
    width: 60%;
    margin: 0 0.75rem;
    vertical-align: middle;
}
#rotationValue {
    display: inline-block;
    min-width: 40px;
    text-align: right;
    font-weight: 500;
}

/* General button styling */
.btn {
    padding: 0.65rem 1.25rem;
    border-radius: var(--border-radius-sm);
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease-in-out;
    margin: 0.3rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--button-primary-bg);
    color: white;
    box-shadow: var(--box-shadow-sm);
}
.btn-primary:hover:not(:disabled) {
    background: var(--button-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.1);
}

.btn-secondary {
    background: var(--button-secondary-bg);
    color: white;
    box-shadow: var(--box-shadow-sm);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--button-secondary-hover);
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.1);
}

/* Fast Mode Button specific style adjustment */
#fastModeBtn {
    background-color: var(--accent-color);
}
#fastModeBtn:hover:not(:disabled) {
    background-color: #00b894;
}

/* --- Styles for other steps --- */
.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1.5rem 2rem 0 2rem;
}

.step-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.step-number {
    background: var(--primary-color);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    font-weight: bold;
}

.image-editor-container {
    margin-top: 0;
    padding: 0 2rem 2rem 2rem;
}
.editor-wrapper {
    display: flex;
    gap: 2rem;
    flex-direction: row;
    flex-wrap: wrap;
}

.image-preview-container-steps {
    flex: 1;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    border: 1px solid var(--border-color-light);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    background: linear-gradient(135deg, #edf2f7, #ffffff);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
body.dark-mode .image-preview-container-steps {
    border-color: var(--border-color-dark);
    background: linear-gradient(135deg, #2d3748, #1a202c);
}

/* Order of elements in flex */
#editStep .image-preview-container-steps { order: 2; }
#clothesStep .image-preview-container-steps { order: 2; }
#borderStep .image-preview-container-steps { order: 2; }
#backgroundStep .modified-photo.image-preview-container-steps { order: 2; }

.editor-tools {
    flex: 1;
    min-width: 280px;
    display: flex;
    flex-direction: column;
}
#editStep .editor-tools { order: 1; }
#clothesStep .editor-tools { order: 1; }
#borderStep .editor-tools { order: 1; }
#backgroundStep .nameplate-section.editor-tools { order: 1; }

#imagePreview, #processedImage, #noBgImg, #clothesCanvas, #borderPreviewImage {
    max-width: 100%;
    max-height: 380px;
    display: block;
    object-fit: contain;
    border-radius: var(--border-radius-sm);
    transition: filter 0.3s ease;
    margin-bottom: 0.75rem;
    border: 1px solid transparent;
}
#noBgImg, #borderPreviewImage {
    border: 1px solid var(--border-color-light);
}
body.dark-mode #noBgImg, body.dark-mode #borderPreviewImage {
    border-color: var(--border-color-dark);
}

.tool-group {
    margin-bottom: 1.25rem;
    border: 1px solid var(--border-color-light);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    box-shadow: var(--box-shadow-sm);
    transition: border-color 0.3s ease, background-color 0.3s ease;
}
body.dark-mode .tool-group {
    border-color: var(--border-color-dark);
    background: linear-gradient(135deg, #2d3748, #1a202c);
}
.tool-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.25rem;
    cursor: pointer;
    background: linear-gradient(135deg, #edf2f7, #e2e8f0);
    border-bottom: 1px solid var(--border-color-light);
    transition: background-color 0.3s ease, border-bottom-color 0.3s ease;
}
body.dark-mode .tool-group-header {
    background: linear-gradient(135deg, #4a5568, #2d3748);
    border-bottom-color: var(--border-color-dark);
}
.tool-group-header:hover {
    background: #e2e8f0;
}
body.dark-mode .tool-group-header:hover {
    background: #718096;
}
.tool-group-header.active {
    border-bottom-color: transparent;
}
.tool-title {
    font-weight: 600;
    font-size: 1.05em;
    color: inherit;
}
.tool-group-toggle-icon {
    transition: transform 0.3s ease;
    width: 20px;
    height: 20px;
    fill: currentColor;
}
.tool-group-header.active .tool-group-toggle-icon {
    transform: rotate(180deg);
}
.tool-group-content {
    padding: 0 1.25rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
}
.tool-group-content.active {
    max-height: 1200px;
    min-height: auto;
    padding: 1.25rem;
    transition: max-height 0.5s ease-in, padding 0.5s ease-in;
}

.slider-container {
    margin-bottom: 1.25rem;
}
.slider-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
}
.slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #cbd5e0;
    border-radius: var(--border-radius-sm);
    outline: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
body.dark-mode .slider {
    background: #4a5568;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}
.slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}
.btn-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.photo-comparison {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}
.original-photo, .modified-photo {
    flex: 1;
    border: 1px solid var(--border-color-light);
    padding: 0.75rem;
    border-radius: var(--border-radius-md);
    text-align: center;
    min-width: 220px;
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    box-shadow: var(--box-shadow-sm);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
body.dark-mode .original-photo, body.dark-mode .modified-photo {
    border-color: var(--border-color-dark);
    background: linear-gradient(135deg, #2d3748, #1a202c);
}
.original-photo img, .modified-photo img {
    max-width: 100%;
    height: auto;
    max-height: 280px;
    display: block;
    margin: 0.75rem auto 0;
    object-fit: contain;
    border-radius: var(--border-radius-sm);
}
.photo-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

/* Nameplate Section */
.nameplate-section {
    flex: 1;
    min-width: 260px;
}
.name-input, #fontSelect {
    width: 100%;
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color-light);
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    color: var(--text-dark);
    font-size: 0.95rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
body.dark-mode .name-input, body.dark-mode #fontSelect {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    border-color: var(--border-color-dark);
    color: var(--text-light);
}
#nameplateSizeSlider {
    width: calc(100% - 50px);
    margin-top: 0.3rem;
    margin-bottom: 0.3rem;
    display: inline-block;
}
#nameplateSizeValue {
    display: inline-block;
    margin-left: 0.75rem;
    font-size: 0.9rem;
    width: 40px;
}
.flex.items-center {
    display: flex;
    align-items: center;
}

/* Clothes Section */
.gender-options {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.gender-btn {
    padding: 0.6rem 1.25rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color-light);
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    color: var(--text-dark);
    font-weight: 500;
}
body.dark-mode .gender-btn {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    border-color: var(--border-color-dark);
    color: var(--text-light);
}
.gender-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(255, 46, 99, 0.3);
}
body.dark-mode .gender-btn.active {
    color: white;
}
.clothing-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.75rem;
    max-height: 180px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border-color-light);
    border-radius: var(--border-radius-md);
    margin-top: 1rem;
    background: linear-gradient(135deg, #edf2f7, #ffffff);
}
body.dark-mode .clothing-options {
    border-color: var(--border-color-dark);
    background: linear-gradient(135deg, #2d3748, #1a202c);
}
.clothing-option {
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    padding: 0.3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    background: linear-gradient(135deg, #ffffff, #edf2f7);
}
body.dark-mode .clothing-option {
    background: linear-gradient(135deg, #4a5568, #2d3748);
}
.clothing-option:hover {
    border-color: var(--accent-color);
    transform: scale(1.05);
    box-shadow: var(--box-shadow-sm);
}
.clothing-option img {
    width: 100%;
    height: 70px;
    object-fit: contain;
    margin-bottom: 0.25rem;
    border-radius: var(--border-radius-sm);
}
.apply-clothing-btn {
    padding: 3px 6px !important;
    font-size: 11px !important;
    margin-top: 3px !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}
#clothesCanvas {
    cursor: move;
    border: 2px dashed var(--accent-color);
    border-radius: var(--border-radius-md);
}

/* Layout Section (Step 6) */
.layout-section {
    padding: 1.5rem 2rem 2rem 2rem;
}
.paper-size-options, .photo-count-options {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}
.paper-size-options .option-title, .photo-count-options .option-title {
    margin-right: 0.75rem;
    font-weight: 600;
    font-size: 1.05rem;
}
.paper-size-options .btn, .photo-count-options .btn {
    background: linear-gradient(135deg, #e2e8f0, #edf2f7);
    color: #4a5568;
    border: 1px solid var(--border-color-light);
    font-weight: 500;
}
body.dark-mode .paper-size-options .btn, body.dark-mode .photo-count-options .btn {
    background: linear-gradient(135deg, #4a5568, #2d3748);
    color: var(--text-light);
    border-color: var(--border-color-dark);
}
.paper-size-options .btn.active, .photo-count-options .btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(255, 46, 99, 0.25);
}
body.dark-mode .paper-size-options .btn.active, body.dark-mode .photo-count-options .btn.active {
    color: white;
}

.photo-grid-container {
    overflow: auto;
    margin-top: 2rem;
    border: 1px solid var(--border-color-light);
    padding: 1rem;
    border-radius: var(--border-radius-md);
    background: linear-gradient(135deg, #e2e8f0, #edf2f7);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
body.dark-mode .photo-grid-container {
    border-color: var(--border-color-dark);
    background: linear-gradient(135deg, #1a202c, #2d3748);
}
.photo-grid {
    display: grid;
    margin-bottom: 0;
    justify-content: center;
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    padding: var(--padding-size);
    box-sizing: border-box;
    border: 1px solid #a0aec0;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
}
body.dark-mode .photo-grid {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    border-color: #4a5568;
}

/* Grid photo styling */
.grid-photo {
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border: 1px solid #718096;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}
.container-4x6-portrait {
    width: 101.6mm; height: 152.4mm;
    grid-template-columns: repeat(3, 30mm); grid-template-rows: repeat(3, 40mm);
    gap: calc((101.6mm - 3 * 30mm) / 2);
    padding: calc((152.4mm - 3 * 40mm - 2 * ((101.6mm - 3 * 30mm) / 2)) / 2) calc((101.6mm - 3 * 30mm) / 2);
}
.photo-4x6-portrait { width: 30mm; height: 40mm; }

.container-4x6-landscape {
    width: 152.4mm; height: 101.6mm;
    grid-template-columns: repeat(4, var(--photo-width)); grid-template-rows: repeat(2, var(--photo-height));
    gap: var(--gap-size);
    padding: calc((101.6mm - 2 * var(--photo-height) - var(--gap-size)) / 2) calc((152.4mm - 4 * var(--photo-width) - 3 * var(--gap-size)) / 2);
}
.photo-4x6-landscape { width: var(--photo-width); height: var(--photo-height); }

.container-a4 {
    width: var(--page-width);
    grid-template-columns: repeat(6, var(--photo-width));
    gap: var(--gap-size); padding: var(--padding-size);
}
.photo-a4 {
    width: var(--photo-width); height: var(--photo-height);
    border: 1px solid #a0aec0;
}
.photo-index {
    position: absolute; top: 3px; left: 3px;
    background: rgba(0,0,0,0.6);
    color: white; padding: 2px 6px; font-size: 9px;
    border-radius: var(--border-radius-sm);
}

/* Step Button Group */
.step-btn-group {
    display: flex;
    justify-content: space-between;
    padding: 0 2rem 2rem 2rem;
    margin-top: 1.5rem;
}
#layoutStep .step-btn-group {
    justify-content: flex-start;
}
.step-btn-group .btn-primary,
.step-btn-group .btn-secondary {
    min-width: 120px;
}

/* Download/Print Button Container */
.btn-container {
    margin: 1.5rem auto;
    text-align: center;
    max-width: 650px;
    padding: 1rem;
    background: linear-gradient(135deg, #edf2f7, #ffffff);
    box-shadow: var(--box-shadow-md);
    border-radius: var(--border-radius-md);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
body.dark-mode .btn-container {
    background: linear-gradient(135deg, #2d3748, #1a202c);
}

/* Footer */
footer.site-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 2.5rem 1.5rem 1.5rem 1.5rem;
    margin-top: 3rem;
}
.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    max-width: 1140px;
    margin: 0 auto 2rem auto;
}
.footer-column h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.footer-column p,
.footer-column ul {
    font-size: 0.9rem;
    line-height: 1.7;
}
.footer-column ul {
    list-style: none;
    padding: 0;
}
.footer-column ul li {
    margin-bottom: 0.6rem;
}
.footer-column ul li a {
    color: var(--footer-text);
    text-decoration: none;
    transition: color 0.2s ease;
}
.footer-column ul li a:hover {
    color: var(--accent-color);
}
.footer-copyright {
    text-align: center;
    font-size: 0.85rem;
    border-top: 1px solid #2d3748;
    padding-top: 1.5rem;
    max-width: 1140px;
    margin: 0 auto;
}

/* Utility Classes */
.hidden { display: none !important; }
.error {
    color: #e53e3e;
    margin-top: 0.75rem;
    text-align: center;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem;
    background: linear-gradient(135deg, #fed7d7, #fef1f1);
    border: 1px solid #feb2b2;
    border-radius: var(--border-radius-sm);
}
body.dark-mode .error {
    color: #feb2b2;
    background: linear-gradient(135deg, #742a2a, #822727);
    border-color: #feb2b2;
}

#bgCanvas { display: none; }

/* Overlay for mobile menu */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1020;
    transition: opacity 0.3s ease-in-out;
}
.overlay.active {
    display: block;
    opacity: 1;
}

/* Tailwind CSS classes used in HTML */
.flex { display: flex; }
.gap-2 { gap: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.flex-1 { flex: 1 1 0%; }
.bg-blue-500 { background-color: var(--primary-color); }
.hover\:bg-blue-700:hover { background-color: var(--button-primary-hover); }
.text-white { color: white; }
.font-bold { font-weight: bold; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.rounded { border-radius: var(--border-radius-sm); }
.bg-gray-500 { background-color: var(--secondary-color); }
.hover\:bg-gray-700:hover { background-color: var(--button-secondary-hover); }
.mt-2 { margin-top: 0.5rem; }
.text-center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }
.animate-spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.h-8 { height: 2rem; }
.w-8 { width: 2rem; }
.h-5 { height: 1.25rem; }
.w-5 { width: 1.25rem; }
.text-blue-500 { color: var(--primary-color); }
.opacity-25 { opacity: 0.25; }
.opacity-75 { opacity: 0.75; }
.inline { display: inline; }
.mr-2 { margin-right: 0.5rem; }
.block { display: block; }
.mb-1 { margin-bottom: 0.25rem; }
.items-center { align-items: center; }
.flex-grow { flex-grow: 1; }
.text-sm { font-size: 0.875rem; }

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
@keyframes ripple {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
@keyframes glow {
    0% { filter: brightness(100%) drop-shadow(0 0 0 transparent); transform: scale(1); }
    50% { filter: brightness(110%) drop-shadow(0 0 10px rgba(255, 46, 99, 0.5)); transform: scale(1.03); }
    100% { filter: brightness(100%) drop-shadow(0 0 0 transparent); transform: scale(1); }
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    header { flex-wrap: nowrap; }
    .mobile-menu-button { display: block; }
    nav#mainNav {
        position: fixed;
        top: 0;
        right: -280px;
        width: 260px;
        height: 100vh;
        background: linear-gradient(135deg, #ffffff, #edf2f7);
        border-left: 1px solid var(--border-color-light);
        padding-top: 70px;
        flex-direction: column;
        z-index: 1025;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        transition: right 0.35s ease-in-out;
    }
    body.dark-mode nav#mainNav {
        background: linear-gradient(135deg, #2d3748, #1a202c);
        border-left: 1px solid var(--border-color-dark);
    }
    nav#mainNav.nav-active {
        right: 0;
    }
    nav#mainNav ul {
        flex-direction: column;
        gap: 0;
        width: 100%;
    }
    nav#mainNav ul li a {
        display: block;
        padding: 1rem 1.5rem;
        border-bottom: 1px solid var(--border-color-light);
        text-align: left;
        font-size: 1rem;
    }
    body.dark-mode nav#mainNav ul li a {
        border-bottom: 1px solid var(--border-color-dark);
    }
    nav#mainNav ul li:last-child a {
        border-bottom: none;
    }

    .main-title { font-size: 1.85rem; }
    #uploadStep .step-content-wrapper { flex-direction: column; }
    .image-preview-container { min-height: 280px; }
    .editor-wrapper { flex-direction: column; gap: 1.5rem; }
    .editor-wrapper > .editor-tools { order: 1; }
    .editor-wrapper > .image-preview-container-steps { order: 2; min-width: 100%; }

    .photo-comparison { flex-direction: column; align-items: center; }
    .original-photo, .modified-photo { width: 100%; max-width: 320px; }
}

@media (max-width: 768px) {
    .main-container { padding: 0 1rem; }
    header { padding: 0.75rem 1rem; }
    .logo { font-size: 1.5rem; }
    .header-right { gap: 0.75rem; }
    .main-title { font-size: 1.6rem; margin: 2rem 0 1.5rem 0; }

    #uploadStep .step-content-wrapper,
    .image-editor-container,
    .layout-section,
    .step-btn-group,
    .step-header,
    .size-options-wrapper { padding-left: 1.25rem; padding-right: 1.25rem; }

    #uploadStep .step-content-wrapper { padding-top: 1.5rem; padding-bottom: 1.5rem; }
    .image-editor-container { padding-top: 1.5rem; padding-bottom: 1.5rem; }
    .layout-section { padding-top: 1.5rem; padding-bottom: 1.5rem; }
    .step-btn-group { padding-bottom: 1.5rem; }

    .size-options-wrapper { padding-bottom: 1.5rem; }
    .size-options { flex-direction: column; align-items: stretch; gap: 1rem; }
    .select-box { min-width: unset; width: 100%; }

    .clothing-options { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    #imagePreview, #processedImage, #clothesCanvas, #uploadImagePreview, #noBgImg, #borderPreviewImage { max-height: 320px; }
    .footer-content { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; }

    .container-4x6-portrait, .container-4x6-landscape, .container-a4 {
        width: 98%;
        height: auto; padding: 3mm; margin: 8px auto;
    }
    .container-4x6-portrait { grid-template-columns: repeat(3, 1fr); gap: 1mm; }
    .photo-4x6-portrait { width: 100%; aspect-ratio: 30 / 40; height: auto; }
    .container-4x6-landscape { grid-template-columns: repeat(4, 1fr); gap: 1mm; }
    .photo-4x6-landscape { width: 100%; aspect-ratio: var(--photo-width) / var(--photo-height); height: auto; }
    .container-a4 { grid-template-columns: repeat(3, 1fr); gap: 1mm; }
    .photo-a4 { width: 100%; aspect-ratio: var(--photo-width) / var(--photo-height); height: auto; }
    .btn-container { padding: 0.75rem; }
}

@media (max-width: 480px) {
    .main-container { padding: 0 0.75rem; }
    header { padding: 0.75rem; }
    .header-right { flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
    .main-title { font-size: 1.35rem; }

    #uploadStep .step-content-wrapper,
    .image-editor-container,
    .layout-section,
    .step-btn-group,
    .step-header,
    .size-options-wrapper { padding-left: 1rem; padding-right: 1rem; }

    .upload-container, .image-preview-container { padding: 1.5rem; min-height: 220px; }
    .image-preview-container { min-height: 260px; }
    .btn { padding: 0.5rem 1rem; font-size: 0.875rem; }
    .clothing-options { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; max-height: 250px; }
    .clothing-option img { height: 70px; }
    #imagePreview, #processedImage, #clothesCanvas, #uploadImagePreview, #noBgImg, #borderPreviewImage { max-height: 260px; }
    .footer-content { grid-template-columns: 1fr; text-align: center; }
    .footer-column h4 { margin-top: 1rem; }
    .footer-column:first-child h4 { margin-top: 0; }
    .footer-copyright { font-size: 0.8rem; }

    .container-a4, .container-4x6-portrait, .container-4x6-landscape {
        grid-template-columns: repeat(2, 1fr);
    }
    .btn-container { flex-direction: column; }
}

/* Print styles */
@media print {
    @page { size: auto; margin: 0; }
    body { background-color: white !important; color: black !important; }
    body * { visibility: hidden; box-shadow: none !important; border: none !important; }
    .photo-grid-container, .photo-grid-container * { visibility: visible; border: none !important; }
    .photo-grid { position: absolute; top: 0; left: 0; margin: 0; background: none !important; visibility: visible; padding: 0 !important; border: none !important; display: grid !important; }
    .container-4x6-portrait { width: 101.6mm !important; height: 152.4mm !important; padding: calc((152.4mm - 3 * 40mm - 2 * ((101.6mm - 3 * 30mm) / 2)) / 2) calc((101.6mm - 3 * 30mm) / 2) !important; gap: calc((101.6mm - 3 * 30mm) / 2) !important; grid-template-columns: repeat(3, 30mm) !important; grid-template-rows: repeat(3, 40mm) !important; }
    .container-4x6-landscape { width: 152.4mm !important; height: 101.6mm !important; padding: calc((101.6mm - 2 * var(--photo-height) - var(--gap-size)) / 2) calc((152.4mm - 4 * var(--photo-width) - 3 * var(--gap-size)) / 2) !important; gap: var(--gap-size) !important; grid-template-columns: repeat(4, var(--photo-width)) !important; grid-template-rows: repeat(2, var(--photo-height)) !important; }
    .container-a4 { width: var(--page-width) !important; height: var(--page-height) !important; padding: var(--padding-size) !important; gap: var(--gap-size) !important; grid-template-columns: repeat(6, var(--photo-width)) !important; grid-auto-rows: var(--photo-height) !important; }
    .grid-photo { visibility: visible !important; border: 1px solid black !important; background-color: white !important; box-sizing: border-box !important; overflow: hidden !important; background-size: cover !important; background-repeat: no-repeat !important; background-position: center !important; }
    .photo-4x6-portrait, .photo-4x6-landscape, .photo-a4 { visibility: visible !important; }
    .container-4x6-portrait .photo-4x6-portrait { width: 30mm !important; height: 40mm !important; }
    .container-4x6-landscape .photo-4x6-landscape { width: var(--photo-width) !important; height: var(--photo-height) !important; }
    .container-a4 .photo-a4 { width: var(--photo-width) !important; height: var(--photo-height) !important; }
    .photo-index { display: none !important; }
    header, .step-container, .btn-container, .paper-size-options, .photo-count-options, .download-section, .step-btn-group, footer, .main-title, .size-options-wrapper, .mobile-menu-button, .overlay, .rotation-slider-wrapper { display: none !important; visibility: hidden !important; }
}

/* Hindi font override */
.hindi { font-family: 'Noto Sans Devanagari', 'Manrope', sans-serif; }

/* Google Fonts Import */
/* @import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;700&family=Noto+Sans+Devanagari:wght@300;400;500;600&display=swap'); *//* Root variables for a bold, modern design */
:root {
    --primary-color: #ff2e63; /* Vibrant Pink */
    --secondary-color: #252f3f; /* Deep Blue */
    --accent-color: #00d4b4; /* Bright Teal */
    --light-bg: #fefeff; /* Clean White */
    --dark-bg: #1c2526; /* Dark Slate */
    --text-light: #e6ecef; /* Light Gray Text */
    --text-dark: #1a202c; /* Dark Text */
    --border-color-light: #e2e8f0; /* Light Border */
    --border-color-dark: #4a5568; /* Dark Border */
    --footer-bg: #171923; /* Darker Footer */
    --footer-text: #a0aec0; /* Light Gray-Blue Text */
    --button-primary-bg: var(--primary-color);
    --button-primary-hover: #d81b60; /* Darker Pink */
    --button-secondary-bg: var(--secondary-color);
    --button-secondary-hover: #1a202c; /* Darker Blue */
    --page-width: 220mm;
    --page-height: 332mm;
    --photo-width: 35mm;
    --photo-height: 47mm;
    --gap-size: 2mm;
    --padding-size: 10mm;
    --base-font-size: 16px;
    --base-line-height: 1.6;
    --border-radius-sm: 0.25rem;
    --border-radius-md: 0.5rem;
    --box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Basic reset and font */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Manrope', 'Noto Sans Devanagari', sans-serif;
    font-size: var(--base-font-size);
    line-height: var(--base-line-height);
    background-color: var(--light-bg);
    color: var(--text-dark);
    transition: background-color 0.3s ease, color 0.3s ease;
    position: relative;
    overflow-x: hidden;
}

body.dark-mode {
    background-color: var(--dark-bg);
    color: var(--text-light);
}

/* Main container */
.main-container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 15px;
    min-height: calc(100vh - 200px);
}

/* Header styling */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color-light);
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: var(--box-shadow-sm);
    transition: background-color 0.3s ease, border-bottom-color 0.3s ease;
}

body.dark-mode header {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    border-bottom-color: var(--border-color-dark);
}

.logo {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    z-index: 102;
}
.logo a {
    text-decoration: none;
    color: inherit;
}
body.dark-mode .logo {
    color: var(--accent-color);
}

/* Mobile Menu Button */
.mobile-menu-button {
    display: none;
    font-size: 1.75rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-dark);
    z-index: 102;
    margin-left: 1rem;
}
body.dark-mode .mobile-menu-button {
    color: var(--text-light);
}

/* Navigation Links */
nav#mainNav {
    display: flex;
    transition: transform 0.3s ease-in-out;
}
nav#mainNav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}
nav#mainNav ul li a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: color 0.2s ease;
}
nav#mainNav ul li a:hover {
    color: var(--primary-color);
}
body.dark-mode nav#mainNav ul li a {
    color: var(--text-light);
}
body.dark-mode nav#mainNav ul li a:hover {
    color: var(--accent-color);
}

/* Header Right Side Elements */
.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 102;
}

/* Language Dropdown */
.language-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color-light);
    border-radius: var(--border-radius-sm);
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    color: var(--text-dark);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
body.dark-mode .language-select {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    border-color: var(--border-color-dark);
    color: var(--text-light);
}

/* Theme Toggle Button */
.theme-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-dark);
    padding: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}
body.dark-mode .theme-toggle {
    color: var(--text-light);
}
.theme-toggle:hover {
    transform: scale(1.2);
}

/* Main Title Styling */
.main-title {
    text-align: center;
    font-size: 2.25rem;
    font-weight: 600;
    margin: 2.5rem 0 2rem 0;
    color: var(--text-dark);
}
body.dark-mode .main-title {
    color: var(--text-light);
}
.main-title span {
    color: var(--primary-color);
}

/* Step container - general styling */
.step-container {
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    border-radius: var(--border-radius-md);
    box-shadow: var(--box-shadow-md);
    margin-top: 2rem;
    margin-bottom: 2rem;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    border: 1px solid var(--border-color-light);
    overflow: hidden;
}

body.dark-mode .step-container {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.25);
    border-color: var(--border-color-dark);
}

/* Step 1 Specific Layout */
#uploadStep .step-content-wrapper {
    display: flex;
    gap: 2rem;
    padding: 2rem;
    border: none;
    margin-bottom: 2rem;
}
body.dark-mode crusade #uploadStep .step-content-wrapper {
    /* No specific dark mode change here as parent handles bg */
}

/* Upload area styling */
.upload-container {
    flex: 1;
    padding: 2.5rem;
    text-align: center;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all 0.3s;
    background: linear-gradient(135deg, #edf2f7, #ffffff);
    border: 2px dashed var(--border-color-light);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 320px;
}

body.dark-mode .upload-container {
    border-color: var(--border-color-dark);
    background: linear-gradient(135deg, #2d3748, #1a202c);
}

.upload-container:hover {
    border-color: var(--primary-color);
    background: #e2e8f0;
}
body.dark-mode .upload-container:hover {
    border-color: var(--accent-color);
    background: #4a5568;
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.upload-text {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
}

.upload-separator {
    display: block;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: #718096;
}
body.dark-mode .upload-separator {
    color: #a0aec0;
}

/* Preview area styling */
.image-preview-container {
    flex: 1;
    border: 1px solid var(--border-color-light);
    border-radius: var(--border-radius-md);
    padding: 0.75rem;
    background: linear-gradient(135deg, #e2e8f0, #edf2f7);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 320px;
    overflow: hidden;
}
body.dark-mode .image-preview-container {
    border-color: var(--border-color-dark);
    background: linear-gradient(135deg, #1a202c, #2d3748);
}

#uploadImagePreview {
    display: block;
    max-width: 100%;
    max-height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: var(--border-radius-sm);
}
#uploadImagePreview.loaded {
    opacity: 1;
}

/* Background Removal Effect */
.image-preview-container.processing::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 46, 99, 0.3), transparent);
    animation: ripple 2s infinite;
}
.image-preview-container.processing img {
    animation: glow 1.5s infinite;
}

/* Size and DPI options */
.size-options-wrapper {
    display: flex;
    justify-content: center;
    padding: 0 2rem 2rem 2rem;
}
.size-options {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.select-box {
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color-light);
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    min-width: 220px;
    color: var(--text-dark);
    font-size: 0.95rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
body.dark-mode .select-box {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    border-color: var(--border-color-dark);
    color: var(--text-light);
}
.size-options label {
    font-weight: 500;
    color: #4a5568;
}
body.dark-mode .size-options label {
    color: #a0aec0;
}

/* Rotation Slider */
.rotation-slider-wrapper {
    padding: 0 2rem 1.5rem 2rem;
    text-align: center;
}
.rotation-slider-wrapper label {
    font-weight: 500;
    margin-right: 0.5rem;
}
#rotationSlider {
    width: 60%;
    margin: 0 0.75rem;
    vertical-align: middle;
}
#rotationValue {
    display: inline-block;
    min-width: 40px;
    text-align: right;
    font-weight: 500;
}

/* General button styling */
.btn {
    padding: 0.65rem 1.25rem;
    border-radius: var(--border-radius-sm);
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease-in-out;
    margin: 0.3rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--button-primary-bg);
    color: white;
    box-shadow: var(--box-shadow-sm);
}
.btn-primary:hover:not(:disabled) {
    background: var(--button-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.1);
}

.btn-secondary {
    background: var(--button-secondary-bg);
    color: white;
    box-shadow: var(--box-shadow-sm);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--button-secondary-hover);
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.1);
}

/* Fast Mode Button specific style adjustment */
#fastModeBtn {
    background-color: var(--accent-color);
}
#fastModeBtn:hover:not(:disabled) {
    background-color: #00b894;
}

/* --- Styles for other steps --- */
.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1.5rem 2rem 0 2rem;
}

.step-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.step-number {
    background: var(--primary-color);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    font-weight: bold;
}

.image-editor-container {
    margin-top: 0;
    padding: 0 2rem 2rem 2rem;
}
.editor-wrapper {
    display: flex;
    gap: 2rem;
    flex-direction: row;
    flex-wrap: wrap;
}

.image-preview-container-steps {
    flex: 1;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    border: 1px solid var(--border-color-light);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    background: linear-gradient(135deg, #edf2f7, #ffffff);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
body.dark-mode .image-preview-container-steps {
    border-color: var(--border-color-dark);
    background: linear-gradient(135deg, #2d3748, #1a202c);
}

/* Order of elements in flex */
#editStep .image-preview-container-steps { order: 2; }
#clothesStep .image-preview-container-steps { order: 2; }
#borderStep .image-preview-container-steps { order: 2; }
#backgroundStep .modified-photo.image-preview-container-steps { order: 2; }

.editor-tools {
    flex: 1;
    min-width: 280px;
    display: flex;
    flex-direction: column;
}
#editStep .editor-tools { order: 1; }
#clothesStep .editor-tools { order: 1; }
#borderStep .editor-tools { order: 1; }
#backgroundStep .nameplate-section.editor-tools { order: 1; }

#imagePreview, #processedImage, #noBgImg, #clothesCanvas, #borderPreviewImage {
    max-width: 100%;
    max-height: 380px;
    display: block;
    object-fit: contain;
    border-radius: var(--border-radius-sm);
    transition: filter 0.3s ease;
    margin-bottom: 0.75rem;
    border: 1px solid transparent;
}
#noBgImg, #borderPreviewImage {
    border: 1px solid var(--border-color-light);
}
body.dark-mode #noBgImg, body.dark-mode #borderPreviewImage {
    border-color: var(--border-color-dark);
}

.tool-group {
    margin-bottom: 1.25rem;
    border: 1px solid var(--border-color-light);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    box-shadow: var(--box-shadow-sm);
    transition: border-color 0.3s ease, background-color 0.3s ease;
}
body.dark-mode .tool-group {
    border-color: var(--border-color-dark);
    background: linear-gradient(135deg, #2d3748, #1a202c);
}
.tool-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.25rem;
    cursor: pointer;
    background: linear-gradient(135deg, #edf2f7, #e2e8f0);
    border-bottom: 1px solid var(--border-color-light);
    transition: background-color 0.3s ease, border-bottom-color 0.3s ease;
}
body.dark-mode .tool-group-header {
    background: linear-gradient(135deg, #4a5568, #2d3748);
    border-bottom-color: var(--border-color-dark);
}
.tool-group-header:hover {
    background: #e2e8f0;
}
body.dark-mode .tool-group-header:hover {
    background: #718096;
}
.tool-group-header.active {
    border-bottom-color: transparent;
}
.tool-title {
    font-weight: 600;
    font-size: 1.05em;
    color: inherit;
}
.tool-group-toggle-icon {
    transition: transform 0.3s ease;
    width: 20px;
    height: 20px;
    fill: currentColor;
}
.tool-group-header.active .tool-group-toggle-icon {
    transform: rotate(180deg);
}
.tool-group-content {
    padding: 0 1.25rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
}
.tool-group-content.active {
    max-height: 1200px;
    min-height: auto;
    padding: 1.25rem;
    transition: max-height 0.5s ease-in, padding 0.5s ease-in;
}

.slider-container {
    margin-bottom: 1.25rem;
}
.slider-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
}
.slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #cbd5e0;
    border-radius: var(--border-radius-sm);
    outline: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
body.dark-mode .slider {
    background: #4a5568;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}
.slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}
.btn-group {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.photo-comparison {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}
.original-photo, .modified-photo {
    flex: 1;
    border: 1px solid var(--border-color-light);
    padding: 0.75rem;
    border-radius: var(--border-radius-md);
    text-align: center;
    min-width: 220px;
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    box-shadow: var(--box-shadow-sm);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
body.dark-mode .original-photo, body.dark-mode .modified-photo {
    border-color: var(--border-color-dark);
    background: linear-gradient(135deg, #2d3748, #1a202c);
}
.original-photo img, .modified-photo img {
    max-width: 100%;
    height: auto;
    max-height: 280px;
    display: block;
    margin: 0.75rem auto 0;
    object-fit: contain;
    border-radius: var(--border-radius-sm);
}
.photo-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

/* Nameplate Section */
.nameplate-section {
    flex: 1;
    min-width: 260px;
}
.name-input, #fontSelect {
    width: 100%;
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color-light);
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    color: var(--text-dark);
    font-size: 0.95rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
body.dark-mode .name-input, body.dark-mode #fontSelect {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    border-color: var(--border-color-dark);
    color: var(--text-light);
}
#nameplateSizeSlider {
    width: calc(100% - 50px);
    margin-top: 0.3rem;
    margin-bottom: 0.3rem;
    display: inline-block;
}
#nameplateSizeValue {
    display: inline-block;
    margin-left: 0.75rem;
    font-size: 0.9rem;
    width: 40px;
}
.flex.items-center {
    display: flex;
    align-items: center;
}

/* Clothes Section */
.gender-options {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.gender-btn {
    padding: 0.6rem 1.25rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color-light);
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    color: var(--text-dark);
    font-weight: 500;
}
body.dark-mode .gender-btn {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    border-color: var(--border-color-dark);
    color: var(--text-light);
}
.gender-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(255, 46, 99, 0.3);
}
body.dark-mode .gender-btn.active {
    color: white;
}
.clothing-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.75rem;
    max-height: 180px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border-color-light);
    border-radius: var(--border-radius-md);
    margin-top: 1rem;
    background: linear-gradient(135deg, #edf2f7, #ffffff);
}
body.dark-mode .clothing-options {
    border-color: var(--border-color-dark);
    background: linear-gradient(135deg, #2d3748, #1a202c);
}
.clothing-option {
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    padding: 0.3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    background: linear-gradient(135deg, #ffffff, #edf2f7);
}
body.dark-mode .clothing-option {
    background: linear-gradient(135deg, #4a5568, #2d3748);
}
.clothing-option:hover {
    border-color: var(--accent-color);
    transform: scale(1.05);
    box-shadow: var(--box-shadow-sm);
}
.clothing-option img {
    width: 100%;
    height: 70px;
    object-fit: contain;
    margin-bottom: 0.25rem;
    border-radius: var(--border-radius-sm);
}
.apply-clothing-btn {
    padding: 3px 6px !important;
    font-size: 11px !important;
    margin-top: 3px !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}
#clothesCanvas {
    cursor: move;
    border: 2px dashed var(--accent-color);
    border-radius: var(--border-radius-md);
}

/* Layout Section (Step 6) */
.layout-section {
    padding: 1.5rem 2rem 2rem 2rem;
}
.paper-size-options, .photo-count-options {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}
.paper-size-options .option-title, .photo-count-options .option-title {
    margin-right: 0.75rem;
    font-weight: 600;
    font-size: 1.05rem;
}
.paper-size-options .btn, .photo-count-options .btn {
    background: linear-gradient(135deg, #e2e8f0, #edf2f7);
    color: #4a5568;
    border: 1px solid var(--border-color-light);
    font-weight: 500;
}
body.dark-mode .paper-size-options .btn, body.dark-mode .photo-count-options .btn {
    background: linear-gradient(135deg, #4a5568, #2d3748);
    color: var(--text-light);
    border-color: var(--border-color-dark);
}
.paper-size-options .btn.active, .photo-count-options .btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(255, 46, 99, 0.25);
}
body.dark-mode .paper-size-options .btn.active, body.dark-mode .photo-count-options .btn.active {
    color: white;
}

.photo-grid-container {
    overflow: auto;
    margin-top: 2rem;
    border: 1px solid var(--border-color-light);
    padding: 1rem;
    border-radius: var(--border-radius-md);
    background: linear-gradient(135deg, #e2e8f0, #edf2f7);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
body.dark-mode .photo-grid-container {
    border-color: var(--border-color-dark);
    background: linear-gradient(135deg, #1a202c, #2d3748);
}
.photo-grid {
    display: grid;
    margin-bottom: 0;
    justify-content: center;
    background: linear-gradient(135deg, #ffffff, #edf2f7);
    padding: var(--padding-size);
    box-sizing: border-box;
    border: 1px solid #a0aec0;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
}
body.dark-mode .photo-grid {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    border-color: #4a5568;
}

/* Grid photo styling */
.grid-photo {
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border: 1px solid #718096;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}
.container-4x6-portrait {
    width: 101.6mm; height: 152.4mm;
    grid-template-columns: repeat(3, 30mm); grid-template-rows: repeat(3, 40mm);
    gap: calc((101.6mm - 3 * 30mm) / 2);
    padding: calc((152.4mm - 3 * 40mm - 2 * ((101.6mm - 3 * 30mm) / 2)) / 2) calc((101.6mm - 3 * 30mm) / 2);
}
.photo-4x6-portrait { width: 30mm; height: 40mm; }

.container-4x6-landscape {
    width: 152.4mm; height: 101.6mm;
    grid-template-columns: repeat(4, var(--photo-width)); grid-template-rows: repeat(2, var(--photo-height));
    gap: var(--gap-size);
    padding: calc((101.6mm - 2 * var(--photo-height) - var(--gap-size)) / 2) calc((152.4mm - 4 * var(--photo-width) - 3 * var(--gap-size)) / 2);
}
.photo-4x6-landscape { width: var(--photo-width); height: var(--photo-height); }

.container-a4 {
    width: var(--page-width);
    grid-template-columns: repeat(6, var(--photo-width));
    gap: var(--gap-size); padding: var(--padding-size);
}
.photo-a4 {
    width: var(--photo-width); height: var(--photo-height);
    border: 1px solid #a0aec0;
}
.photo-index {
    position: absolute; top: 3px; left: 3px;
    background: rgba(0,0,0,0.6);
    color: white; padding: 2px 6px; font-size: 9px;
    border-radius: var(--border-radius-sm);
}

/* Step Button Group */
.step-btn-group {
    display: flex;
    justify-content: space-between;
    padding: 0 2rem 2rem 2rem;
    margin-top: 1.5rem;
}
#layoutStep .step-btn-group {
    justify-content: flex-start;
}
.step-btn-group .btn-primary,
.step-btn-group .btn-secondary {
    min-width: 120px;
}

/* Download/Print Button Container */
.btn-container {
    margin: 1.5rem auto;
    text-align: center;
    max-width: 650px;
    padding: 1rem;
    background: linear-gradient(135deg, #edf2f7, #ffffff);
    box-shadow: var(--box-shadow-md);
    border-radius: var(--border-radius-md);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
body.dark-mode .btn-container {
    background: linear-gradient(135deg, #2d3748, #1a202c);
}

/* Footer */
footer.site-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 2.5rem 1.5rem 1.5rem 1.5rem;
    margin-top: 3rem;
}
.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    max-width: 1140px;
    margin: 0 auto 2rem auto;
}
.footer-column h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.footer-column p,
.footer-column ul {
    font-size: 0.9rem;
    line-height: 1.7;
}
.footer-column ul {
    list-style: none;
    padding: 0;
}
.footer-column ul li {
    margin-bottom: 0.6rem;
}
.footer-column ul li a {
    color: var(--footer-text);
    text-decoration: none;
    transition: color 0.2s ease;
}
.footer-column ul li a:hover {
    color: var(--accent-color);
}
.footer-copyright {
    text-align: center;
    font-size: 0.85rem;
    border-top: 1px solid #2d3748;
    padding-top: 1.5rem;
    max-width: 1140px;
    margin: 0 auto;
}

/* Utility Classes */
.hidden { display: none !important; }
.error {
    color: #e53e3e;
    margin-top: 0.75rem;
    text-align: center;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem;
    background: linear-gradient(135deg, #fed7d7, #fef1f1);
    border: 1px solid #feb2b2;
    border-radius: var(--border-radius-sm);
}
body.dark-mode .error {
    color: #feb2b2;
    background: linear-gradient(135deg, #742a2a, #822727);
    border-color: #feb2b2;
}

#bgCanvas { display: none; }

/* Overlay for mobile menu */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1020;
    transition: opacity 0.3s ease-in-out;
}
.overlay.active {
    display: block;
    opacity: 1;
}

/* Tailwind CSS classes used in HTML */
.flex { display: flex; }
.gap-2 { gap: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.flex-1 { flex: 1 1 0%; }
.bg-blue-500 { background-color: var(--primary-color); }
.hover\:bg-blue-700:hover { background-color: var(--button-primary-hover); }
.text-white { color: white; }
.font-bold { font-weight: bold; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.rounded { border-radius: var(--border-radius-sm); }
.bg-gray-500 { background-color: var(--secondary-color); }
.hover\:bg-gray-700:hover { background-color: var(--button-secondary-hover); }
.mt-2 { margin-top: 0.5rem; }
.text-center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }
.animate-spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.h-8 { height: 2rem; }
.w-8 { width: 2rem; }
.h-5 { height: 1.25rem; }
.w-5 { width: 1.25rem; }
.text-blue-500 { color: var(--primary-color); }
.opacity-25 { opacity: 0.25; }
.opacity-75 { opacity: 0.75; }
.inline { display: inline; }
.mr-2 { margin-right: 0.5rem; }
.block { display: block; }
.mb-1 { margin-bottom: 0.25rem; }
.items-center { align-items: center; }
.flex-grow { flex-grow: 1; }
.text-sm { font-size: 0.875rem; }

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
@keyframes ripple {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
@keyframes glow {
    0% { filter: brightness(100%) drop-shadow(0 0 0 transparent); transform: scale(1); }
    50% { filter: brightness(110%) drop-shadow(0 0 10px rgba(255, 46, 99, 0.5)); transform: scale(1.03); }
    100% { filter: brightness(100%) drop-shadow(0 0 0 transparent); transform: scale(1); }
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    header { flex-wrap: nowrap; }
    .mobile-menu-button { display: block; }
    nav#mainNav {
        position: fixed;
        top: 0;
        right: -280px;
        width: 260px;
        height: 100vh;
        background: linear-gradient(135deg, #ffffff, #edf2f7);
        border-left: 1px solid var(--border-color-light);
        padding-top: 70px;
        flex-direction: column;
        z-index: 1025;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        transition: right 0.35s ease-in-out;
    }
    body.dark-mode nav#mainNav {
        background: linear-gradient(135deg, #2d3748, #1a202c);
        border-left: 1px solid var(--border-color-dark);
    }
    nav#mainNav.nav-active {
        right: 0;
    }
    nav#mainNav ul {
        flex-direction: column;
        gap: 0;
        width: 100%;
    }
    nav#mainNav ul li a {
        display: block;
        padding: 1rem 1.5rem;
        border-bottom: 1px solid var(--border-color-light);
        text-align: left;
        font-size: 1rem;
    }
    body.dark-mode nav#mainNav ul li a {
        border-bottom: 1px solid var(--border-color-dark);
    }
    nav#mainNav ul li:last-child a {
        border-bottom: none;
    }

    .main-title { font-size: 1.85rem; }
    #uploadStep .step-content-wrapper { flex-direction: column; }
    .image-preview-container { min-height: 280px; }
    .editor-wrapper { flex-direction: column; gap: 1.5rem; }
    .editor-wrapper > .editor-tools { order: 1; }
    .editor-wrapper > .image-preview-container-steps { order: 2; min-width: 100%; }

    .photo-comparison { flex-direction: column; align-items: center; }
    .original-photo, .modified-photo { width: 100%; max-width: 320px; }
}

@media (max-width: 768px) {
    .main-container { padding: 0 1rem; }
    header { padding: 0.75rem 1rem; }
    .logo { font-size: 1.5rem; }
    .header-right { gap: 0.75rem; }
    .main-title { font-size: 1.6rem; margin: 2rem 0 1.5rem 0; }

    #uploadStep .step-content-wrapper,
    .image-editor-container,
    .layout-section,
    .step-btn-group,
    .step-header,
    .size-options-wrapper { padding-left: 1.25rem; padding-right: 1.25rem; }

    #uploadStep .step-content-wrapper { padding-top: 1.5rem; padding-bottom: 1.5rem; }
    .image-editor-container { padding-top: 1.5rem; padding-bottom: 1.5rem; }
    .layout-section { padding-top: 1.5rem; padding-bottom: 1.5rem; }
    .step-btn-group { padding-bottom: 1.5rem; }

    .size-options-wrapper { padding-bottom: 1.5rem; }
    .size-options { flex-direction: column; align-items: stretch; gap: 1rem; }
    .select-box { min-width: unset; width: 100%; }

    .clothing-options { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    #imagePreview, #processedImage, #clothesCanvas, #uploadImagePreview, #noBgImg, #borderPreviewImage { max-height: 320px; }
    .footer-content { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; }

    .container-4x6-portrait, .container-4x6-landscape, .container-a4 {
        width: 98%;
        height: auto; padding: 3mm; margin: 8px auto;
    }
    .container-4x6-portrait { grid-template-columns: repeat(3, 1fr); gap: 1mm; }
    .photo-4x6-portrait { width: 100%; aspect-ratio: 30 / 40; height: auto; }
    .container-4x6-landscape { grid-template-columns: repeat(4, 1fr); gap: 1mm; }
    .photo-4x6-landscape { width: 100%; aspect-ratio: var(--photo-width) / var(--photo-height); height: auto; }
    .container-a4 { grid-template-columns: repeat(3, 1fr); gap: 1mm; }
    .photo-a4 { width: 100%; aspect-ratio: var(--photo-width) / var(--photo-height); height: auto; }
    .btn-container { padding: 0.75rem; }
}

@media (max-width: 480px) {
    .main-container { padding: 0 0.75rem; }
    header { padding: 0.75rem; }
    .header-right { flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
    .main-title { font-size: 1.35rem; }

    #uploadStep .step-content-wrapper,
    .image-editor-container,
    .layout-section,
    .step-btn-group,
    .step-header,
    .size-options-wrapper { padding-left: 1rem; padding-right: 1rem; }

    .upload-container, .image-preview-container { padding: 1.5rem; min-height: 220px; }
    .image-preview-container { min-height: 260px; }
    .btn { padding: 0.5rem 1rem; font-size: 0.875rem; }
    .clothing-options { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; max-height: 250px; }
    .clothing-option img { height: 70px; }
    #imagePreview, #processedImage, #clothesCanvas, #uploadImagePreview, #noBgImg, #borderPreviewImage { max-height: 260px; }
    .footer-content { grid-template-columns: 1fr; text-align: center; }
    .footer-column h4 { margin-top: 1rem; }
    .footer-column:first-child h4 { margin-top: 0; }
    .footer-copyright { font-size: 0.8rem; }

    .container-a4, .container-4x6-portrait, .container-4x6-landscape {
        grid-template-columns: repeat(2, 1fr);
    }
    .btn-container { flex-direction: column; }
}

/* Print styles */
@media print {
    @page { size: auto; margin: 0; }
    body { background-color: white !important; color: black !important; }
    body * { visibility: hidden; box-shadow: none !important; border: none !important; }
    .photo-grid-container, .photo-grid-container * { visibility: visible; border: none !important; }
    .photo-grid { position: absolute; top: 0; left: 0; margin: 0; background: none !important; visibility: visible; padding: 0 !important; border: none !important; display: grid !important; }
    .container-4x6-portrait { width: 101.6mm !important; height: 152.4mm !important; padding: calc((152.4mm - 3 * 40mm - 2 * ((101.6mm - 3 * 30mm) / 2)) / 2) calc((101.6mm - 3 * 30mm) / 2) !important; gap: calc((101.6mm - 3 * 30mm) / 2) !important; grid-template-columns: repeat(3, 30mm) !important; grid-template-rows: repeat(3, 40mm) !important; }
    .container-4x6-landscape { width: 152.4mm !important; height: 101.6mm !important; padding: calc((101.6mm - 2 * var(--photo-height) - var(--gap-size)) / 2) calc((152.4mm - 4 * var(--photo-width) - 3 * var(--gap-size)) / 2) !important; gap: var(--gap-size) !important; grid-template-columns: repeat(4, var(--photo-width)) !important; grid-template-rows: repeat(2, var(--photo-height)) !important; }
    .container-a4 { width: var(--page-width) !important; height: var(--page-height) !important; padding: var(--padding-size) !important; gap: var(--gap-size) !important; grid-template-columns: repeat(6, var(--photo-width)) !important; grid-auto-rows: var(--photo-height) !important; }
    .grid-photo { visibility: visible !important; border: 1px solid black !important; background-color: white !important; box-sizing: border-box !important; overflow: hidden !important; background-size: cover !important; background-repeat: no-repeat !important; background-position: center !important; }
    .photo-4x6-portrait, .photo-4x6-landscape, .photo-a4 { visibility: visible !important; }
    .container-4x6-portrait .photo-4x6-portrait { width: 30mm !important; height: 40mm !important; }
    .container-4x6-landscape .photo-4x6-landscape { width: var(--photo-width) !important; height: var(--photo-height) !important; }
    .container-a4 .photo-a4 { width: var(--photo-width) !important; height: var(--photo-height) !important; }
    .photo-index { display: none !important; }
    header, .step-container, .btn-container, .paper-size-options, .photo-count-options, .download-section, .step-btn-group, footer, .main-title, .size-options-wrapper, .mobile-menu-button, .overlay, .rotation-slider-wrapper { display: none !important; visibility: hidden !important; }
}

/* Hindi font override */
.hindi { font-family: 'Noto Sans Devanagari', 'Manrope', sans-serif; }

/* Google Fonts Import */
/* @import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;700&family=Noto+Sans+Devanagari:wght@300;400;500;600&display=swap'); */