/**
 * Custom Product Designer Styles
 * Responsive layout với max-width ~1100px
 */

/* ============================================
   CUSTOM FONTS - Thêm font .ttf của bạn tại đây
   ============================================ */

/* Custom Font: VNI-Butlong (Default - Preload) */
@font-face {
    font-family: 'VNI-Butlong';
    src: url('../fonts/VNI-Butlong.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap; /* Hiển thị text ngay với fallback font */
}

/* Custom Font: Lobster Regular */
@font-face {
    font-family: 'Lobster';
    src: url('../fonts/Lobster-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Custom Font: UTM-Androgyne */
@font-face {
    font-family: 'UTM-Androgyne';
    src: url('../fonts/UTM-Androgyne.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Custom Font: UTM-ViceroyJF */
@font-face {
    font-family: 'UTM-ViceroyJF';
    src: url('../fonts/UTM-ViceroyJF.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Custom Font: VNI-CORONET */
@font-face {
    font-family: 'VNI-CORONET';
    src: url('../fonts/VNI-CORONET.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Custom Font: VNI VHOBO */
@font-face {
    font-family: 'VNI VHOBO';
    src: url('../fonts/vni.common.VHOBO.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Custom Font: VNI VINHAN */
@font-face {
    font-family: 'VNI VINHAN';
    src: url('../fonts/vni.common.VINHAN.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Custom Font: VUNIVER */
@font-face {
    font-family: 'VUNIVER';
    src: url('../fonts/VUNIVER.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Custom Font: VnFree */
@font-face {
    font-family: 'VnFree';
    src: url('../fonts/VnFree.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Custom Font: VNI-Briquet */
@font-face {
    font-family: 'VNI-Briquet';
    src: url('../fonts/VNI-Briquet.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Custom Font: VNI-VDUFFY */
@font-face {
    font-family: 'VNI-VDUFFY';
    src: url('../fonts/vni.common.VDUFFY.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Custom Font: VnMystical */
@font-face {
    font-family: 'VnMystical';
    src: url('../fonts/VnMystical.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Custom Font: ScriptMTBold */
@font-face {
    font-family: 'ScriptMTBold';
    src: url('../fonts/scriptmtbold.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Custom Font: SVN-Dancing-Script */
@font-face {
    font-family: 'SVN-Dancing-Script';
    src: url('../fonts/SVN-Dancing-script.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Custom Font: UTM-AS-Signwriter */
@font-face {
    font-family: 'UTM-AS-Signwriter';
    src: url('../fonts/UTM-AS-Signwriter.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Custom Font: UTMTimesBold */
@font-face {
    font-family: 'UTMTimesBold';
    src: url('../fonts/UTMTimesBold.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Custom Font: Mijas-Ultra */
@font-face {
    font-family: 'Mijas-Ultra';
    src: url('../fonts/Mijas-Ultra.otf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Custom Font: Magnolia Script */
@font-face {
    font-family: 'Magnolia Script';
    src: url('../fonts/Magnolia Script.otf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Sau khi khai báo font ở trên, thêm vào dropdown trong file:
   templates/designer-template.php với code:
   <div class="cpd-font-option" data-font="My Custom Font" style="font-family: 'My Custom Font';">My Custom Font</div>
*/

/* ============================================
   END CUSTOM FONTS
   ============================================ */

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.cpd-container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Step Navigation */
.cpd-steps-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.cpd-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: #f5f5f5;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.cpd-step::after {
    content: '';
    position: absolute;
    right: -25px;
    width: 20px;
    height: 2px;
    background: #ddd;
}

.cpd-step:last-child::after {
    display: none;
}

.cpd-step.active {
    background: #3d2817;
    color: #fff;
}

.cpd-step.completed {
    background: #c17a3c;
    color: #fff;
}

.cpd-step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.cpd-step.active .cpd-step-number {
    background: #fff;
    color: #3d2817;
}

.cpd-step.completed .cpd-step-number {
    background: #fff;
    color: #c17a3c;
}

.cpd-step-label {
    font-size: 14px;
    font-weight: 600;
}

/* Step Content Sections */
.cpd-step-content {
    display: none;
}

.cpd-step-content.active {
    display: block;
}

.cpd-section-title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Material & Color Selection Groups */
.cpd-selection-group {
    margin-bottom: 30px;
}

.cpd-selection-label {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Material Buttons */
.cpd-material-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.cpd-material-btn {
    padding: 12px 30px;
    background: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cpd-material-btn:hover {
    border-color: #3d2817;
    background: #fff;
}

.cpd-material-btn.active {
    background: #3d2817;
    border-color: #3d2817;
    color: #fff;
}

/* Color Buttons */
.cpd-color-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.cpd-color-btn {
    padding: 10px 20px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cpd-color-btn::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-hex);
    border: 1px solid rgba(0,0,0,0.1);
}

.cpd-color-btn:hover {
    border-color: #3d2817;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Materials Grid */
.cpd-materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.cpd-material-btn {
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.cpd-material-btn:hover {
    border-color: #c17a3c;
    box-shadow: 0 4px 12px rgba(193, 122, 60, 0.1);
}

.cpd-material-btn.active {
    border-color: #c17a3c;
    background: #fff5f0;
    box-shadow: 0 4px 12px rgba(193, 122, 60, 0.2);
}

.material-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.material-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

/* Colors Grid */
.cpd-colors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.cpd-colors-grid .cpd-color-btn {
    position: relative;
    padding: 18px 20px;
    padding-left: 50px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 14px;
    color: #333;
    font-weight: 500;
    min-height: 60px;
    display: flex;
    align-items: center;
}

.cpd-colors-grid .cpd-color-btn::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--color-hex, #ccc);
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}

.cpd-colors-grid .cpd-color-btn:hover {
    border-color: #c17a3c;
    box-shadow: 0 4px 12px rgba(193, 122, 60, 0.15);
    transform: translateY(-2px);
}

.cpd-colors-grid .cpd-color-btn.active {
    border-color: #c17a3c;
    border-width: 3px;
    background: #fff9f5;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(193, 122, 60, 0.25);
}

.cpd-colors-grid .cpd-color-btn.active::after {
    content: '✓';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #c17a3c;
    font-size: 18px;
    font-weight: bold;
}

/* Selected Price Display */
.cpd-selected-price {
    text-align: center;
    padding: 25px;
    background: #f8f8f8;
    border-radius: 12px;
    margin: 30px 0;
}

.cpd-price-label {
    font-size: 16px;
    color: #666;
    margin-bottom: 10px;
    font-weight: 600;
}

.cpd-price-amount {
    font-size: 32px;
    font-weight: 700;
    color: #c17a3c;
    margin-bottom: 10px;
}

.cpd-price-note {
    font-size: 12px;
    color: #999;
    font-style: italic;
}

/* Step Navigation Buttons */
.cpd-step-navigation {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.cpd-nav-btn {
    flex: 1;
    padding: 16px 32px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cpd-nav-back {
    background: #fff;
    border: 2px solid #ddd;
    color: #333;
}

.cpd-nav-back:hover {
    border-color: #333;
    background: #f5f5f5;
}

.cpd-nav-next {
    background: #3d2817;
    border: 2px solid #3d2817;
    color: #fff;
}

.cpd-nav-next:hover {
    background: #2a1a0f;
    border-color: #2a1a0f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(61, 40, 23, 0.3);
}

/* Main Layout - 2 Columns */
.cpd-main-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

/* Left Column - Product Preview */
.cpd-preview-section {
    position: sticky;
    top: 20px;
}

.cpd-product-preview {
    width: 100%;
    background: #f5f5f5;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Product image in Step 1 - LEFT COLUMN */
.cpd-admin-product-image {
    width: 100%;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    text-align: center;
    display: block;
}

.cpd-admin-product-image img {
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    object-fit: cover;
}

/* Hide admin product image when not in Step 1 */
.cpd-admin-product-image.hidden {
    display: none !important;
}

.cpd-product-preview {
    background: #f8f8f8;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.cpd-canvas-wrapper {
    position: relative;
    width: 100%;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: visible;
    display: inline-block;
    line-height: 0;
}

.cpd-product-image {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    z-index: 1;
    position: relative;
}

.cpd-product-placeholder {
    width: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    color: #999;
    border-radius: 8px;
}

#cpd-canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 10 !important;
    cursor: default;
    pointer-events: auto;
}

/* Fabric.js canvas controls styling */
.canvas-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 10 !important;
}

.upper-canvas {
    cursor: move !important;
    z-index: 11 !important;
}

/* Right Column - Product Info & Controls */
.cpd-info-section {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.cpd-product-title {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.3;
}

.cpd-price-section {
    margin-bottom: 25px;
}

.cpd-price-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.cpd-price {
    font-size: 24px;
    font-weight: 700;
    color: #c17a3c;
}

.cpd-price-range {
    color: #c17a3c;
}

.cpd-price-note {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
    font-style: italic;
}

/* Start Design Button */
.cpd-start-design-btn {
    width: 100%;
    padding: 18px 32px;
    background: #fff;
    border: 2px solid #333;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 30px;
}

.cpd-start-design-btn:hover {
    background: #333;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cpd-start-design-btn.active {
    background: #333;
    color: #fff;
}

/* Product Description */
.cpd-description {
    margin-bottom: 25px;
}

.cpd-description-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.cpd-description-list {
    list-style: none;
    padding: 0;
}

.cpd-description-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cpd-description-list li {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
    padding-left: 20px;
    position: relative;
    margin-bottom: 8px;
}

.cpd-description-list li:before {
    content: '+';
    position: absolute;
    left: 0;
    color: #c17a3c;
    font-weight: 600;
}

.cpd-description-list p {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
    margin: 0;
}

/* Price Display */
.cpd-final-price {
    padding: 20px;
    background: #f8f8f8;
    border-radius: 8px;
    margin-bottom: 20px;
}

.cpd-final-price-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.cpd-final-price-amount {
    font-size: 20px;
    font-weight: 700;
    color: #c17a3c;
}

/* Design Controls Panel */
.cpd-controls-panel {
    display: none;
    margin-top: 30px;
    padding: 25px;
    background: #f8f8f8;
    border-radius: 12px;
}

.cpd-controls-panel.active {
    display: block;
}

.cpd-control-group {
    margin-bottom: 20px;
}

.cpd-control-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.cpd-button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cpd-btn {
    padding: 10px 20px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cpd-btn:hover {
    border-color: #333;
    background: #333;
    color: #fff;
}

.cpd-btn.active {
    border-color: #c17a3c;
    background: #c17a3c;
    color: #fff;
}

.cpd-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.cpd-input:focus {
    outline: none;
    border-color: #c17a3c;
}

.cpd-color-picker {
    width: 100%;
    height: 45px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
}

/* Embroidery Color Picker Grid */
.cpd-embroidery-color-grid {
    display: block;
    margin-top: 10px;
}

.cpd-embroidery-color-grid .cpd-color-btn {
    display: inline-block;
    width: 36px;
    height: 36px;
    margin: 0 6px 6px 0;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background-size: cover;
    background-position: center;
    padding: 0;
    vertical-align: top;
}

.cpd-embroidery-color-grid .cpd-color-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    border-color: #999;
    z-index: 2;
}

.cpd-embroidery-color-grid .cpd-color-btn.active {
    border-color: #c17a3c;
    border-width: 3px;
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(193, 122, 60, 0.4);
    z-index: 3;
}

.cpd-embroidery-color-grid .cpd-color-btn.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 
        0 0 2px rgba(0,0,0,0.8),
        0 0 6px rgba(0,0,0,0.6),
        1px 1px 2px rgba(0,0,0,0.8);
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.9));
}

.cpd-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.cpd-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #c17a3c;
    cursor: pointer;
}

.cpd-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #c17a3c;
    cursor: pointer;
    border: none;
}

/* Icon Grid */
.cpd-icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.cpd-icon-item {
    width: 60px;
    height: 60px;
    border: 2px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
}

.cpd-icon-item:hover {
    border-color: #c17a3c;
    transform: scale(1.05);
}

.cpd-icon-item.active {
    border-color: #c17a3c;
    background: #fff5f0;
}

.cpd-icon-item img {
    max-width: 70%;
    max-height: 70%;
}

/* Save Design Button */
.cpd-save-btn {
    width: 100%;
    padding: 16px 32px;
    background: #c17a3c;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.cpd-save-btn:hover {
    background: #a56630;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(193, 122, 60, 0.3);
}

/* Responsive Design - Tablet and Mobile */
@media (max-width: 1024px) {
    .cpd-main-wrapper {
        grid-template-columns: 1fr !important;
        gap: 30px;
    }
    
    .cpd-preview-section {
        position: relative !important;
        top: 0;
    }
}

@media (max-width: 768px) {
    .cpd-main-wrapper {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .cpd-preview-section {
        position: relative;
        top: 0;
    }
    
    .cpd-product-title {
        font-size: 24px;
    }
    
    .cpd-price {
        font-size: 20px;
    }
    
    .cpd-controls-panel {
        padding: 20px;
    }
    
    .cpd-icon-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }
    
    .cpd-icon-item {
        width: 50px;
        height: 50px;
    }
    
    /* Step navigation mobile */
    .cpd-steps-nav {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .cpd-step {
        padding: 8px 15px;
    }
    
    .cpd-step::after {
        display: none;
    }
    
    .cpd-step-label {
        font-size: 12px;
    }
    
    .cpd-step-number {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    
    /* Color buttons mobile */
    .cpd-color-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Material buttons mobile */
    .cpd-material-buttons {
        flex-direction: column;
    }
    
    .cpd-material-btn {
        width: 100%;
    }
    
    /* Step navigation buttons mobile */
    .cpd-step-navigation {
        flex-direction: column;
    }
    
    .cpd-nav-btn {
        width: 100%;
    }
    
    /* Price display mobile */
    .cpd-price-amount-large {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .cpd-container {
        padding: 0 15px;
        margin: 20px auto;
    }
    
    .cpd-info-section {
        padding: 20px;
    }
    
    .cpd-product-title {
        font-size: 20px;
    }
    
    .cpd-button-group {
        flex-direction: column;
    }
    
    .cpd-btn {
        width: 100%;
    }
}

/* Loading State */
.cpd-loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Success Message */
.cpd-success-message {
    padding: 15px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    color: #155724;
    margin-top: 20px;
    display: none;
}

.cpd-success-message.show {
    display: block;
}

/* Error Message */
.cpd-error-message {
    padding: 15px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
    margin-top: 20px;
    display: none;
}

.cpd-error-message.show {
    display: block;
}

/* Step 4 - Final Design Buttons */
#cpd-back-to-edit:hover {
    background: #6B4423 !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 68, 35, 0.3);
}

#cpd-download-design:hover {
    background: #543419 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(107, 68, 35, 0.4);
}

#cpd-step-4 a[href*="instagram"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(131, 58, 180, 0.6);
}

#cpd-final-image {
    transition: transform 0.3s ease;
}

#cpd-final-image:hover {
    transform: scale(1.02);
}

/* Responsive for Step 4 */
@media (max-width: 768px) {
    #cpd-step-4 > div[style*="display: flex"] {
        flex-direction: column !important;
    }
    
    #cpd-step-4 button {
        width: 100% !important;
    }
}

/* ========================================
   ICON MODAL STYLES
   ======================================== */

/* Modal Overlay */
.cpd-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cpd-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

/* Modal Content */
.cpd-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Header */
.cpd-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.cpd-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.cpd-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cpd-modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

/* Modal Body */
.cpd-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

/* Icon Tabs */
.cpd-icon-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.cpd-icon-tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.cpd-icon-tab:hover {
    color: #333;
}

.cpd-icon-tab.active {
    color: #6B4423;
    border-bottom-color: #6B4423;
}

/* Icon Grid in Modal */
.cpd-icon-grid-modal {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
}

.cpd-icon-item {
    aspect-ratio: 1;
    background: #6B4423;
    border: 2px solid #6B4423;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.cpd-icon-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(107, 68, 35, 0.3);
}

.cpd-icon-item img,
.cpd-icon-item svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}


/* Style cho SVG bên trong div wrapper */
.cpd-icon-item > div > div > svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

/* Icon Modal Button */
.cpd-icon-modal-btn {
    width: 100%;
    padding: 12px 24px;
    background: #6B4423;
    color: #fff;
    border: 2px solid #6B4423;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.cpd-icon-modal-btn:hover {
    background: #5A3619;
    border-color: #5A3619;
    transform: translateY(-1px);
}

/* Custom Font Dropdown */
.cpd-font-dropdown {
    position: relative;
    width: 100%;
}

.cpd-font-dropdown-btn {
    width: 100%;
    padding: 12px 16px;
    background: #fff;
    border: 2px solid #ddd !important;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}
#cpd-font-dropdown-btn {
    width: 100%;
    text-align: left;
    color: black;
    border-color: #C17A3C !important;
    background-color: #FFF5F0;
    border-radius: 6px;
}
#cpd-font-dropdown-btn:hover {
    border-color: #FFF5F0 !important;
    border-radius: 6px;
    background-color: #FFF5F0;
}
#cpd-font-dropdown-btn:focus {
    outline: none;
    border-color: #FFF5F0 !important;
    background-color: #FFF5F0;
    box-shadow: 0 0 0 3px rgba(107, 68, 35, 0.1);
}

.cpd-font-dropdown-btn:hover {
    border-color: #FFF5F0;
}

.cpd-font-dropdown-btn:focus {
    outline: none;
    border-color: #FFF5F0;
    box-shadow: 0 0 0 3px rgba(107, 68, 35, 0.1);
}

#cpd-selected-font-preview {
    flex: 1;
    text-align: left;
    font-size: 16px;
}

.cpd-dropdown-arrow {
    margin-left: 10px;
    transition: transform 0.2s;
    font-size: 10px;
    color: #666;
}

.cpd-font-dropdown-btn.active .cpd-dropdown-arrow {
    transform: rotate(180deg);
}

.cpd-font-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cpd-font-option {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.cpd-font-option:last-child {
    border-bottom: none;
}

.cpd-font-option:hover {
    background: #f8f8f8;
}

.cpd-font-option.active {
    background: #6B4423;
    color: #fff;
}

/* Scrollbar cho dropdown */
.cpd-font-dropdown-menu::-webkit-scrollbar {
    width: 8px;
}

.cpd-font-dropdown-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.cpd-font-dropdown-menu::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.cpd-font-dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive Modal */
@media (max-width: 768px) {
    .cpd-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .cpd-icon-grid-modal {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 10px;
    }
    
    .cpd-modal-header {
        padding: 16px 20px;
    }
    
    .cpd-modal-body {
        padding: 16px 20px;
    }
    
    .cpd-font-dropdown-menu {
        max-height: 200px;
    }
}

@media (max-width: 500px) {
    #cpd-step-4 {
        padding: 30px 10px 20px 10px !important;
    }
}