/* ================================================= */
/* PROFESSIONAL CUSTOMIZE BOX PAGE - V3             */
/* ================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@400;600;700&display=swap');

:root {
    /* Base Colors */
    --purple: #975ab7;
    --brown: #502325;
    
    /* Purple Variations */
    --purple-50: #f7f3fb;
    --purple-100: #ede4f3;
    --purple-200: #dcc9e7;
    --purple-300: #c5a4d8;
    --purple-400: #ab7bc5;
    --purple-500: #975ab7; /* Base purple */
    --purple-600: #8849a3;
    --purple-700: #733a89;
    --purple-800: #5f2f71;
    --purple-900: #4d2558;
    
    /* Brown Variations */
    --brown-50: #faf8f7;
    --brown-100: #f4efef;
    --brown-200: #e7d9d9;
    --brown-300: #d5bfc0;
    --brown-400: #bf9ca0;
    --brown-500: #502325; /* Base brown */
    --brown-600: #481f21;
    --brown-700: #3f1b1d;
    --brown-800: #361719;
    --brown-900: #2d1315;
    
    /* Semantic Colors */
    --text-primary: #ffffff;
    --text-secondary: var(--purple-200);
    --text-muted: var(--purple-300);
    --surface-primary: var(--brown-900);
    --surface-secondary: var(--brown-800);
    --surface-tertiary: var(--brown-700);
    --accent-primary: var(--purple-500);
    --accent-hover: var(--purple-400);
    --accent-active: var(--purple-600);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--brown-900) 0%, var(--brown-700) 50%, var(--purple-900) 100%);
    --gradient-card: linear-gradient(145deg, rgba(80, 35, 37, 0.4) 0%, rgba(77, 37, 88, 0.2) 100%);
    --gradient-button: linear-gradient(135deg, var(--purple-600), var(--purple-500));
    --gradient-button-hover: linear-gradient(135deg, var(--purple-500), var(--purple-400));
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(80, 35, 37, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(80, 35, 37, 0.4), 0 2px 4px -1px rgba(80, 35, 37, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(80, 35, 37, 0.4), 0 4px 6px -2px rgba(80, 35, 37, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(80, 35, 37, 0.4), 0 10px 10px -5px rgba(80, 35, 37, 0.2);
    --shadow-purple: 0 0 20px rgba(151, 90, 183, 0.3);
    --shadow-purple-lg: 0 0 30px rgba(151, 90, 183, 0.4);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================================================= */
/* CUSTOM BOX BUTTON STYLES                          */
/* ================================================= */

.btn-customize-box {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--gradient-button);
    border: 1px solid var(--accent-primary);
    color: white;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    box-shadow: var(--shadow-md);
}

.btn-customize-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-button-hover);
    transition: var(--transition-slow);
    z-index: -1;
}

.btn-customize-box:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg), var(--shadow-purple);
    color: white;
    text-decoration: none;
}

.btn-customize-box:hover::before {
    left: 0;
}

.btn-customize-box:active {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-customize-box i {
    font-size: 1.125rem;
    transition: var(--transition-fast);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.btn-customize-box:hover i {
    transform: scale(1.1) rotate(5deg);
}

/* Button Variants */
.btn-customize-box.btn-large {
    padding: 1.25rem 2rem;
    font-size: 1.125rem;
    border-radius: var(--radius-2xl);
}

.btn-customize-box.btn-large i {
    font-size: 1.25rem;
}

.btn-customize-box.btn-small {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    border-radius: var(--radius-lg);
}

.btn-customize-box.btn-small i {
    font-size: 1rem;
}

.btn-customize-box.btn-compact {
    padding: 0.625rem 1rem;
    font-size: 0.8rem;
    border-radius: var(--radius-md);
    gap: 0.5rem;
}

.btn-customize-box.btn-compact i {
    font-size: 0.9rem;
}

/* Outline Variant */
.btn-customize-box.btn-outline {
    background: transparent;
    border: 2px solid var(--accent-primary);
    color: var(--accent-primary);
}

.btn-customize-box.btn-outline::before {
    background: var(--gradient-button);
}

.btn-customize-box.btn-outline:hover {
    color: white;
    border-color: var(--accent-hover);
}

/* Full Width Variant */
.btn-customize-box.btn-full-width {
    width: 100%;
    justify-content: center;
}

/* Icon-Only Variant */
.btn-customize-box.btn-icon-only {
    padding: 1rem;
    aspect-ratio: 1;
    justify-content: center;
    border-radius: 50%;
}

.btn-customize-box.btn-icon-only span {
    display: none;
}

/* Disabled State */
.btn-customize-box:disabled,
.btn-customize-box.disabled {
    background: var(--surface-tertiary);
    border-color: var(--brown-600);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
    box-shadow: none;
}

.btn-customize-box:disabled::before,
.btn-customize-box.disabled::before {
    display: none;
}

.btn-customize-box:disabled:hover,
.btn-customize-box.disabled:hover {
    transform: none;
    box-shadow: none;
    color: var(--text-muted);
}

/* Loading State */
.btn-customize-box.loading {
    pointer-events: none;
    position: relative;
}

.btn-customize-box.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Glowing Animation */
.btn-customize-box.glowing {
    animation: buttonGlow 2s ease-in-out infinite alternate;
}

/* Group of buttons */
.btn-customize-box + .btn-customize-box {
    margin-left: 1rem;
}

.btn-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.btn-group .btn-customize-box {
    margin: 0;
}

/* ================================================= */
/* BASE STYLES                                       */
/* ================================================= */

.customize-page-body {
    background: var(--gradient-primary);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

.customize-page-body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(151, 90, 183, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(80, 35, 37, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(151, 90, 183, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* ================================================= */
/* LAYOUT CONTAINER                                  */
/* ================================================= */

.custom-box-container {
    display: grid;
    grid-template-columns: 420px 1fr;
    max-width: 1920px;
    margin: 0 auto;
    min-height: 100vh;
    gap: 0;
}

/* ================================================= */
/* LEFT CONTROLS PANEL                               */
/* ================================================= */

.controls-panel {
    background: rgba(80, 35, 37, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(151, 90, 183, 0.2);
    padding: 2rem;
    overflow-y: auto;
    position: relative;
}

.controls-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-card);
    pointer-events: none;
    border-radius: 0;
}

.controls-sticky-content {
    position: relative;
    z-index: 1;
}

.back-to-menu {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2rem;
    padding: 0.5rem 0;
    transition: var(--transition-fast);
    border-radius: var(--radius-md);
}

.back-to-menu:hover {
    color: var(--accent-hover);
    transform: translateX(-2px);
}

.back-to-menu::before {
    content: '←';
    font-size: 1rem;
}

/* Page Title */
.controls-panel h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2.5rem;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-hover));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Control Sections */
.control-section {
    margin-bottom: 2.5rem;
}

.control-section h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    padding-bottom: 0.75rem;
}

.control-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 2rem;
    height: 2px;
    background: var(--accent-primary);
    border-radius: 1px;
}

/* ================================================= */
/* SIZE SELECTOR                                     */
/* ================================================= */

.size-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.size-btn {
    background: var(--surface-tertiary);
    border: 1px solid rgba(151, 90, 183, 0.3);
    color: var(--text-secondary);
    padding: 1rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-normal);
    font-weight: 500;
    font-size: 0.875rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.size-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--purple-800), var(--purple-700));
    transition: var(--transition-slow);
    z-index: -1;
}

.size-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.size-btn:hover::before {
    left: 0;
}

.size-btn.active {
    background: var(--gradient-button);
    border-color: var(--accent-primary);
    color: white;
    font-weight: 600;
    transform: translateY(-2px);
    box-shadow: var(--shadow-purple);
}

.size-btn.active::before {
    display: none;
}

/* ================================================= */
/* BOX CONTENTS                                      */
/* ================================================= */

#progress-text {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    transition: var(--transition-fast);
}

.box-contents {
    min-height: 120px;
    margin-top: 1rem;
}

.selected-item {
    display: flex;
    align-items: center;
    background: var(--surface-secondary);
    border: 1px solid rgba(151, 90, 183, 0.2);
    padding: 1rem;
    border-radius: var(--radius-lg);
    margin-bottom: 0.75rem;
    transition: var(--transition-normal);
    animation: itemSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.selected-item:hover {
    border-color: var(--accent-primary);
    transform: translateX(2px);
    box-shadow: var(--shadow-sm);
}

.selected-item.removing {
    animation: itemSlideOut 0.3s ease-out forwards;
}

@keyframes itemSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes itemSlideOut {
    to {
        opacity: 0;
        transform: translateX(20px) scale(0.95);
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-color: transparent;
    }
}

.selected-item img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    margin-right: 0.75rem;
    object-fit: cover;
    border: 1px solid rgba(151, 90, 183, 0.3);
}

.selected-item .item-name {
    flex-grow: 1;
    font-weight: 500;
    color: var(--text-secondary);
}

.selected-item .remove-item-btn {
    background: none;
    border: none;
    color: var(--brown-400);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.selected-item .remove-item-btn:hover {
    color: var(--purple-300);
    background: rgba(151, 90, 183, 0.1);
    transform: scale(1.1);
}

/* ================================================= */
/* SUMMARY SECTION                                   */
/* ================================================= */

.summary-section {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(151, 90, 183, 0.3);
}

.price-display {
    background: var(--surface-secondary);
    border: 1px solid rgba(151, 90, 183, 0.3);
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    margin-bottom: 1.5rem;
    text-align: center;
}

.price-display span {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.price-display strong {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-hover));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: block;
    transition: var(--transition-fast);
}

.price-display strong.flash {
    animation: priceFlash 0.6s ease-out;
}

@keyframes priceFlash {
    0% {
        background: linear-gradient(135deg, var(--purple-300), var(--purple-400));
        background-clip: text;
        -webkit-background-clip: text;
        text-shadow: 0 0 20px rgba(151, 90, 183, 0.5);
    }
    100% {
        background: linear-gradient(135deg, var(--text-primary), var(--accent-hover));
        background-clip: text;
        -webkit-background-clip: text;
        text-shadow: none;
    }
}

.btn-add-box {
    width: 100%;
    background: var(--gradient-button);
    border: none;
    color: white;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.btn-add-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-button-hover);
    transition: var(--transition-slow);
    z-index: -1;
}

.btn-add-box:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-purple);
}

.btn-add-box:hover:not(:disabled)::before {
    left: 0;
}

.btn-add-box:active:not(:disabled) {
    transform: translateY(0);
}

.btn-add-box:disabled {
    background: var(--surface-tertiary);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-add-box:disabled::before {
    display: none;
}

.btn-add-box.glowing {
    animation: buttonGlow 2s ease-in-out infinite alternate;
}

@keyframes buttonGlow {
    from {
        box-shadow: var(--shadow-lg), var(--shadow-purple);
    }
    to {
        box-shadow: var(--shadow-xl), var(--shadow-purple-lg);
    }
}

/* ================================================= */
/* PRODUCT SELECTION GRID                            */
/* ================================================= */

.product-selection-grid {
    padding: 2.5rem;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
    align-content: start;
    background: rgba(80, 35, 37, 0.1);
}

/* ================================================= */
/* PRODUCT CARDS                                     */
/* ================================================= */

.product-card {
    background: var(--surface-secondary);
    border: 1px solid rgba(151, 90, 183, 0.2);
    border-radius: var(--radius-xl);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-slow);
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.product-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.product-card:hover:not(.disabled) {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-xl), var(--shadow-purple);
}

.product-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    transition: var(--transition-slow);
}

.product-card:hover:not(.disabled) img {
    transform: scale(1.05);
}

.product-info {
    padding: 1.25rem;
    text-align: center;
}

.product-info h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.product-info p {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--accent-primary);
}

/* Product Overlay */
.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(151, 90, 183, 0.9);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition-normal);
    color: white;
    font-weight: 600;
}

.product-overlay i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.product-card:hover:not(.disabled) .product-overlay {
    opacity: 1;
}

/* Selected State */
.product-card.selected {
    border-color: var(--purple-400);
    background: linear-gradient(145deg, var(--surface-secondary), var(--purple-900));
    transform: scale(1.02);
    box-shadow: var(--shadow-purple-lg);
}

.product-card.selected .product-overlay {
    opacity: 1;
    background: rgba(151, 90, 183, 0.9);
}

.product-card.selected .product-overlay i::before {
    content: "✓";
    font-style: normal;
}

/* Disabled State */
.product-card.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    filter: grayscale(0.8);
}

.product-card.disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(151, 90, 183, 0.2);
}

.product-card.disabled .product-overlay {
    display: none;
}

/* ================================================= */
/* RESPONSIVE DESIGN                                 */
/* ================================================= */

/* Large Desktop (1200px+) - Default styles above */

/* Medium Desktop/Laptop (992px - 1199px) */
@media (max-width: 1199px) {
    .custom-box-container {
        grid-template-columns: 380px 1fr;
    }
    
    .controls-panel {
        padding: 1.75rem;
    }
    
    .product-selection-grid {
        padding: 2rem;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1.25rem;
    }
}

/* Small Desktop/Large Tablet (768px - 991px) */
@media (max-width: 991px) {
    .custom-box-container {
        grid-template-columns: 350px 1fr;
    }
    
    .controls-panel {
        padding: 1.5rem;
    }
    
    .controls-panel h1 {
        font-size: 2rem;
        margin-bottom: 2rem;
    }
    
    .product-selection-grid {
        padding: 1.75rem;
        grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
        gap: 1.25rem;
    }
    
    .product-card {
        border-radius: var(--radius-lg);
    }
    
    .product-card img {
        height: 140px;
    }
}

/* Tablet Portrait (481px - 767px) */
@media (max-width: 767px) {
    .customize-page-body {
        font-size: 14px;
    }
    
    .custom-box-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        min-height: 100vh;
    }
    
    .controls-panel {
        border-right: none;
        border-bottom: 1px solid rgba(151, 90, 183, 0.3);
        padding: 1.5rem 1rem;
        max-height: none;
        overflow-y: visible;
    }
    
    .controls-sticky-content {
        position: static;
    }
    
    .controls-panel h1 {
        font-size: 1.875rem;
        margin-bottom: 1.5rem;
        text-align: center;
    }
    
    .control-section {
        margin-bottom: 2rem;
    }
    
    .control-section h2 {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .size-selector {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .size-btn {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .selected-item {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    .selected-item img {
        width: 40px;
        height: 40px;
        margin-right: 0.5rem;
    }
    
    .selected-item .item-name {
        font-size: 0.875rem;
    }
    
    .price-display {
        padding: 1.25rem;
        margin-bottom: 1.25rem;
    }
    
    .price-display strong {
        font-size: 2rem;
    }
    
    .btn-add-box {
        padding: 0.875rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .product-selection-grid {
        padding: 1.5rem 1rem;
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }
    
    .product-card img {
        height: 120px;
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .product-info h3 {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }
    
    .product-info p {
        font-size: 1rem;
    }
}

/* Large Mobile (376px - 480px) */
@media (max-width: 480px) {
    .controls-panel {
        padding: 1.25rem 0.875rem;
    }
    
    .controls-panel h1 {
        font-size: 1.625rem;
        margin-bottom: 1.25rem;
    }
    
    .control-section {
        margin-bottom: 1.5rem;
    }
    
    .control-section h2 {
        font-size: 0.85rem;
    }
    
    .size-selector {
        gap: 0.375rem;
    }
    
    .size-btn {
        padding: 0.625rem 0.375rem;
        font-size: 0.75rem;
        border-radius: var(--radius-md);
    }
    
    .box-contents {
        min-height: 100px;
    }
    
    .selected-item {
        padding: 0.625rem;
        border-radius: var(--radius-md);
    }
    
    .selected-item img {
        width: 36px;
        height: 36px;
    }
    
    .selected-item .item-name {
        font-size: 0.8rem;
    }
    
    .summary-section {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }
    
    .price-display {
        padding: 1rem;
        border-radius: var(--radius-lg);
    }
    
    .price-display span {
        font-size: 0.75rem;
    }
    
    .price-display strong {
        font-size: 1.75rem;
    }
    
    .btn-add-box {
        padding: 0.75rem 1.25rem;
        font-size: 0.85rem;
        border-radius: var(--radius-lg);
    }
    
    .product-selection-grid {
        padding: 1.25rem 0.875rem;
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.875rem;
    }
    
    .product-card {
        border-radius: var(--radius-md);
    }
    
    .product-card img {
        height: 100px;
    }
    
    .product-info {
        padding: 0.875rem;
    }
    
    .product-info h3 {
        font-size: 0.825rem;
        line-height: 1.3;
    }
    
    .product-info p {
        font-size: 0.9rem;
    }
    
    .product-overlay {
        font-size: 0.875rem;
    }
    
    .product-overlay i {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }
}

/* Small Mobile (320px - 375px) */
@media (max-width: 375px) {
    .customize-page-body {
        font-size: 13px;
    }
    
    .controls-panel {
        padding: 1rem 0.75rem;
    }
    
    .controls-panel h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .back-to-menu {
        font-size: 0.8rem;
        margin-bottom: 1.5rem;
    }
    
    .control-section {
        margin-bottom: 1.25rem;
    }
    
    .control-section h2 {
        font-size: 0.8rem;
        margin-bottom: 0.875rem;
    }
    
    .size-selector {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .size-btn {
        padding: 0.75rem;
        font-size: 0.8rem;
        text-align: center;
    }
    
    #progress-text {
        font-size: 0.8rem;
    }
    
    .selected-item {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
        flex-wrap: wrap;
    }
    
    .selected-item img {
        width: 32px;
        height: 32px;
        margin-right: 0.5rem;
    }
    
    .selected-item .item-name {
        font-size: 0.75rem;
        flex-basis: calc(100% - 60px);
    }
    
    .selected-item .remove-item-btn {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.875rem;
    }
    
    .summary-section {
        margin-top: 1.5rem;
        padding-top: 1.25rem;
    }
    
    .price-display {
        padding: 0.875rem;
    }
    
    .price-display span {
        font-size: 0.7rem;
    }
    
    .price-display strong {
        font-size: 1.5rem;
    }
    
    .btn-add-box {
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }
    
    .product-selection-grid {
        padding: 1rem 0.75rem;
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 0.75rem;
    }
    
    .product-card img {
        height: 90px;
    }
    
    .product-info {
        padding: 0.75rem;
    }
    
    .product-info h3 {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
    }
    
    .product-info p {
        font-size: 0.825rem;
    }
    
    .product-overlay {
        font-size: 0.8rem;
    }
    
    .product-overlay i {
        font-size: 1.25rem;
    }
}

/* Extra Small Mobile (< 320px) */
@media (max-width: 319px) {
    .controls-panel h1 {
        font-size: 1.375rem;
    }
    
    .size-btn {
        padding: 0.625rem;
        font-size: 0.75rem;
    }
    
    .product-selection-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.625rem;
        padding: 0.875rem 0.625rem;
    }
    
    .product-card img {
        height: 80px;
    }
    
    .product-info {
        padding: 0.625rem;
    }
    
    .product-info h3 {
        font-size: 0.7rem;
    }
    
    .product-info p {
        font-size: 0.75rem;
    }
}

/* Landscape Mobile Orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .customize-page-body {
        min-height: auto;
    }
    
    .custom-box-container {
        min-height: 100vh;
        grid-template-columns: 300px 1fr;
    }
    
    .controls-panel {
        border-right: 1px solid rgba(151, 90, 183, 0.3);
        border-bottom: none;
        padding: 1rem;
    }
    
    .controls-panel h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .control-section {
        margin-bottom: 1.25rem;
    }
    
    .size-selector {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.375rem;
    }
    
    .size-btn {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }
    
    .selected-item {
        padding: 0.5rem;
    }
    
    .summary-section {
        margin-top: 1.25rem;
        padding-top: 1rem;
    }
    
    .price-display {
        padding: 0.875rem;
    }
    
    .price-display strong {
        font-size: 1.75rem;
    }
    
    .product-selection-grid {
        padding: 1rem;
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }
    
    .product-card img {
        height: 80px;
    }
    
    .product-info {
        padding: 0.75rem;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .size-btn, .btn-add-box, .product-card, .back-to-menu, .remove-item-btn {
        min-height: 44px; /* iOS accessibility guideline */
        touch-action: manipulation;
    }
    
    .size-btn {
        padding: 0.75rem;
    }
    
    .product-card:active {
        transform: scale(0.98);
    }
    
    .btn-add-box:active {
        transform: translateY(1px);
    }
    
    .remove-item-btn {
        min-width: 44px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .product-card img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}