/* ================================
   Empire Store Mousepad Designer
   Responsive Dark Theme (Cairo Font)
   Version: 5.9 - Fixed Shop Page Issues
   ================================ */

/* ===== Fonts & Root Variables ===== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&family=Tajawal:wght@400;500;700&display=swap');

:root {
    --primary-color: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #8b5cf6;
    --secondary-color: #06b6d4;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-bg: #0f172a;
    --card-bg: #1e293b;
    --card-hover: #334155;
    --border-color: #334155;
    --text-white: #f8fafc;
    --text-gray: #cbd5e1;
    --text-light: #94a3b8;
    --radius-xl: 24px;
    --radius-lg: 20px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --shadow: 0 10px 40px rgba(0,0,0,0.3);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.4);
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.2);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    --gradient-success: linear-gradient(135deg, var(--success-color), #34d399);
    --gradient-secondary: linear-gradient(135deg, var(--secondary-color), #22d3ee);
    --gradient-bg: linear-gradient(135deg, #0f172a, #1e1b4b);
}

/* ===== Global Reset - SCOPED TO DESIGNER ONLY ===== */
#empire-mousepad-designer * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

#empire-mousepad-designer {
    font-family: 'Cairo', 'Tajawal', sans-serif;
    background: var(--gradient-bg);
    color: var(--text-white);
    min-height: 100vh;
    padding: 0;
    line-height: 1.6;
    font-weight: 400;
    width: 100%;
    overflow-x: hidden;
    isolation: isolate; /* منع التأثير على العناصر الخارجية */
}

.empire-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ===== Enhanced Header ===== */
#empire-mousepad-designer .designer-header {
    background: var(--gradient-primary);
    padding: 40px 0 30px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

#empire-mousepad-designer .designer-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(139, 92, 246, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(124, 58, 237, 0.4) 0%, transparent 50%);
    animation: float 6s ease-in-out infinite;
}

#empire-mousepad-designer .designer-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255,255,255,0.6), 
        transparent
    );
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(1deg); }
}

#empire-mousepad-designer .header-content {
    text-align: center;
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

#empire-mousepad-designer .designer-header h1 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: white;
    font-weight: 900;
    text-shadow: 0 4px 20px rgba(0,0,0,0.3);
    line-height: 1.1;
    background: linear-gradient(135deg, #fff 0%, #e0e7ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 4px 20px rgba(0,0,0,0.3); }
    to { text-shadow: 0 4px 30px rgba(124, 58, 237, 0.5); }
}

#empire-mousepad-designer .designer-header p {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.9);
    line-height: 1.6;
    font-weight: 400;
    margin-bottom: 15px;
}

#empire-mousepad-designer .product-status {
    margin-top: 15px;
}

#empire-mousepad-designer .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50px;
    padding: 8px 16px;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
}

#empire-mousepad-designer .status-badge.success::before {
    content: '✓';
    background: var(--success-color);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

/* ===== FIXED CANVAS SYSTEM ===== */
#empire-mousepad-designer .canvas-container {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    margin: 20px auto !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    position: relative;
    overflow: hidden !important;
    contain: layout style paint;
}

#empire-mousepad-designer .canvas-container.responsive-canvas {
    width: 100% !important;
    height: auto !important;
    max-width: 800px !important;
    max-height: 70vh !important;
    margin: 0 auto !important;
    background: var(--card-bg) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: var(--radius-lg) !important;
    padding: 15px !important;
}

/* تحسينات أساسية للكانفاس */
#empire-mousepad-designer #designCanvas,
#empire-mousepad-designer #finalCanvas,
#empire-mousepad-designer #orderCanvas {
    display: block !important;
    margin: 0 auto !important;
    border-radius: var(--radius-md) !important;
    background: white !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3) !important;
    cursor: grab;
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    touch-action: manipulation;
}

#empire-mousepad-designer #designCanvas:active,
#empire-mousepad-designer #finalCanvas:active,
#empire-mousepad-designer #orderCanvas:active {
    cursor: grabbing !important;
}

/* إزالة الخطوط البيضاء والهوامش */
#empire-mousepad-designer .canvas-container .upper-canvas,
#empire-mousepad-designer .canvas-container .lower-canvas,
#empire-mousepad-designer .canvas-container .canvas-container {
    border-radius: var(--radius-md) !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* إصلاح حدود Fabric.js */
#empire-mousepad-designer .canvas-container .upper-canvas {
    border-radius: var(--radius-md) !important;
}

/* تحسينات Fabric.js */
#empire-mousepad-designer .fabric-canvas-container {
    position: relative;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100% !important;
    height: 100% !important;
}

/* ===== FIX FOR MOBILE CANVAS RESIZE ISSUE ===== */
#empire-mousepad-designer .canvas-container.responsive-canvas {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    min-height: 300px !important;
    contain: layout style paint !important;
    will-change: transform !important;
}

/* منع إعادة التدفق غير الضرورية */
#empire-mousepad-designer .canvas-container.responsive-canvas canvas {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
}

/* تحسينات خاصة للهواتف */
@media (max-width: 768px) {
    #empire-mousepad-designer .canvas-container.responsive-canvas {
        height: 50vh !important;
        max-height: 400px !important;
        min-height: 250px !important;
    }
    
    /* منع تأثيرات التمرير على الكانفاس */
    #empire-mousepad-designer .canvas-container.responsive-canvas {
        transform: translateZ(0) !important;
        -webkit-transform: translateZ(0) !important;
    }
}

/* تحسينات إضافية للاستقرار */
#empire-mousepad-designer #designCanvas,
#empire-mousepad-designer #finalCanvas,
#empire-mousepad-designer #orderCanvas {
    image-rendering: -webkit-optimize-contrast !important;
    image-rendering: crisp-edges !important;
    image-rendering: pixelated !important;
    transform-style: preserve-3d !important;
}

/* تحسينات للأجهزة المختلفة */
@media (min-width: 1200px) {
    #empire-mousepad-designer .canvas-container.responsive-canvas {
        max-width: 900px !important;
        max-height: 75vh !important;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    #empire-mousepad-designer .canvas-container.responsive-canvas {
        max-width: 700px !important;
        max-height: 65vh !important;
    }
}

@media (max-width: 767px) {
    #empire-mousepad-designer .canvas-container.responsive-canvas {
        max-width: 100% !important;
        max-height: 55vh !important;
        margin: 15px auto !important;
        padding: 10px !important;
    }
}

@media (max-width: 480px) {
    #empire-mousepad-designer .canvas-container.responsive-canvas {
        max-height: 45vh !important;
        margin: 10px auto !important;
        padding: 8px !important;
    }
}

/* تحسينات اللمس */
#empire-mousepad-designer .canvas-container {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y pinch-zoom;
}

/* منع التحديد النصي */
#empire-mousepad-designer .canvas-container {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ===== Progress Bar ===== */
#empire-mousepad-designer .progress-container {
    margin-bottom: 30px;
    position: relative;
    padding: 0 15px;
}

#empire-mousepad-designer .progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 2;
    margin-bottom: 20px;
}

#empire-mousepad-designer .progress-step {
    flex: 1;
    text-align: center;
    position: relative;
}

#empire-mousepad-designer .step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#empire-mousepad-designer .step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-light);
    transition: var(--transition);
    position: relative;
    z-index: 2;
}

#empire-mousepad-designer .progress-step.active .step-number {
    background: var(--gradient-primary);
    border-color: var(--primary-light);
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
    transform: scale(1.05);
}

#empire-mousepad-designer .step-label {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 600;
    transition: var(--transition);
}

#empire-mousepad-designer .progress-step.active .step-label {
    color: var(--text-white);
    font-weight: 700;
}

#empire-mousepad-designer .progress-bar {
    position: absolute;
    top: 20px;
    left: 10%;
    right: 10%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    z-index: 1;
}

#empire-mousepad-designer .progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 2px;
    transition: var(--transition);
    width: 20%;
    position: relative;
    overflow: hidden;
}

#empire-mousepad-designer .progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ===== Steps ===== */
#empire-mousepad-designer .form-step {
    display: none;
    animation: slideInUp 0.5s ease;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#empire-mousepad-designer .form-step.active {
    display: block;
}

#empire-mousepad-designer .step-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

#empire-mousepad-designer .step-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

#empire-mousepad-designer .step-header {
    text-align: center;
    margin-bottom: 30px;
}

#empire-mousepad-designer .step-header h2 {
    font-size: 1.6rem;
    margin-bottom: 10px;
    color: var(--text-white);
    font-weight: 800;
    line-height: 1.2;
}

#empire-mousepad-designer .step-header p {
    font-size: 0.95rem;
    color: var(--text-gray);
    line-height: 1.5;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== Step 1: Size Selection ===== */
#empire-mousepad-designer .sizes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

#empire-mousepad-designer .size-option {
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

#empire-mousepad-designer .size-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 25px;
    transition: var(--transition);
    height: 100%;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

#empire-mousepad-designer .size-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: var(--transition);
}

#empire-mousepad-designer .size-option:hover .size-card {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

#empire-mousepad-designer .size-option:hover .size-card::before {
    transform: scaleX(1);
}

#empire-mousepad-designer .size-option.selected .size-card {
    border-color: var(--primary-color);
    background: rgba(124, 58, 237, 0.1);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

#empire-mousepad-designer .size-option.selected .size-card::before {
    transform: scaleX(1);
}

#empire-mousepad-designer .size-preview {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

#empire-mousepad-designer .mousepad-shape {
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

#empire-mousepad-designer .size-option:hover .mousepad-shape {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6);
}

#empire-mousepad-designer .size-dimensions {
    font-size: 0.8rem;
    background: rgba(0,0,0,0.7);
    padding: 5px 10px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.2);
}

#empire-mousepad-designer .size-info {
    text-align: center;
}

#empire-mousepad-designer .size-info h4 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--text-white);
    font-weight: 700;
}

#empire-mousepad-designer .size-thickness {
    color: var(--text-gray);
    margin-bottom: 12px;
    font-size: 0.85rem;
}

#empire-mousepad-designer .size-badge {
    display: inline-block;
    background: var(--gradient-primary);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

#empire-mousepad-designer .size-option.selected .size-card::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--success-color);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

#empire-mousepad-designer .price-display-section {
    display: flex;
    justify-content: center;
    margin: 25px 0;
}

#empire-mousepad-designer .price-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(16, 185, 129, 0.15);
    border: 2px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-lg);
    padding: 15px 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
    transition: var(--transition);
}

#empire-mousepad-designer .price-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

#empire-mousepad-designer .price-icon {
    font-size: 2rem;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(-3px); }
}

#empire-mousepad-designer .price-content {
    text-align: center;
}

#empire-mousepad-designer .price-label {
    font-size: 0.95rem;
    color: var(--text-gray);
    margin-bottom: 5px;
    font-weight: 600;
}

#empire-mousepad-designer .price-amount {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--success-color);
    text-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

#empire-mousepad-designer .price-amount span {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-gray);
}

/* ===== Step 2: Design Upload ===== */
#empire-mousepad-designer .upload-card {
    margin-bottom: 25px;
}

#empire-mousepad-designer .upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    backdrop-filter: blur(10px);
}

#empire-mousepad-designer .upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(124, 58, 237, 0.05);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

#empire-mousepad-designer .upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.7;
    animation: float 3s ease-in-out infinite;
}

#empire-mousepad-designer .upload-content h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--text-white);
    font-weight: 700;
}

#empire-mousepad-designer .upload-content p {
    color: var(--text-gray);
    margin-bottom: 10px;
    font-size: 0.95rem;
}

#empire-mousepad-designer .upload-formats {
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 500;
    background: rgba(255,255,255,0.05);
    padding: 5px 10px;
    border-radius: 12px;
    display: inline-block;
}

#empire-mousepad-designer .file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

#empire-mousepad-designer .upload-progress {
    margin-top: 15px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 15px;
    border: 2px solid var(--border-color);
    backdrop-filter: blur(10px);
}

#empire-mousepad-designer .progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

#empire-mousepad-designer .progress-text {
    color: var(--text-gray);
    font-weight: 600;
    font-size: 0.85rem;
}

#empire-mousepad-designer .progress-percent {
    color: var(--primary-color);
    font-weight: 800;
    font-size: 0.95rem;
}

#empire-mousepad-designer .progress-bar {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

#empire-mousepad-designer .progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

/* ===== Design Controls ===== */
#empire-mousepad-designer .design-controls {
    margin-top: 20px !important;
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
}

#empire-mousepad-designer .controls-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 12px !important;
    max-width: 600px !important;
    width: 100% !important;
    padding: 0 15px !important;
}

#empire-mousepad-designer .control-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    padding: 16px 12px !important;
    color: var(--text-white) !important;
    cursor: pointer !important;
    transition: var(--transition) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    min-width: 80px !important;
    backdrop-filter: blur(10px) !important;
    min-height: 80px !important;
    justify-content: center !important;
}

#empire-mousepad-designer .control-btn:hover {
    background: rgba(124, 58, 237, 0.1) !important;
    border-color: var(--primary-color) !important;
    transform: translateY(-2px) !important;
    box-shadow: var(--shadow-sm) !important;
}

#empire-mousepad-designer .reset-btn {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

#empire-mousepad-designer .reset-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--error-color);
}

#empire-mousepad-designer .control-text {
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    text-align: center !important;
    line-height: 1.2 !important;
}

/* ===== Enhanced Buttons ===== */
#empire-mousepad-designer .step-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

#empire-mousepad-designer .btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
    position: relative;
    overflow: hidden;
    min-width: 140px;
    justify-content: center;
    backdrop-filter: blur(10px);
}

#empire-mousepad-designer .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

#empire-mousepad-designer .btn:hover::before {
    left: 100%;
}

#empire-mousepad-designer .btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

#empire-mousepad-designer .btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

#empire-mousepad-designer .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
    border: 2px solid var(--border-color);
    backdrop-filter: blur(10px);
}

#empire-mousepad-designer .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2);
}

#empire-mousepad-designer .btn-success {
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

#empire-mousepad-designer .btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

#empire-mousepad-designer .btn-outline {
    background: transparent;
    color: var(--text-white);
    border: 2px solid var(--border-color);
}

#empire-mousepad-designer .btn-outline:hover {
    border-color: var(--primary-color);
    background: rgba(124, 58, 237, 0.1);
    transform: translateY(-2px);
}

#empire-mousepad-designer .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

#empire-mousepad-designer .btn-icon {
    transition: transform 0.3s ease;
}

#empire-mousepad-designer .btn:hover .btn-icon {
    transform: translateX(2px);
}

#empire-mousepad-designer .btn-secondary:hover .btn-icon {
    transform: translateX(-2px);
}

/* ===== Steps 3 & 4 ===== */
#empire-mousepad-designer .final-preview {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

#empire-mousepad-designer .preview-info-card,
#empire-mousepad-designer .specs-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    backdrop-filter: blur(10px);
}

#empire-mousepad-designer .preview-info-card h5,
#empire-mousepad-designer .specs-card h5 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-white);
    font-weight: 700;
    text-align: center;
}

#empire-mousepad-designer .preview-details p,
#empire-mousepad-designer .specs-details p {
    margin-bottom: 10px;
    color: var(--text-gray);
    font-size: 0.95rem;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#empire-mousepad-designer .preview-details p:last-child,
#empire-mousepad-designer .specs-details p:last-child {
    border-bottom: none;
}

#empire-mousepad-designer .notes-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 25px;
    backdrop-filter: blur(10px);
}

#empire-mousepad-designer .notes-header {
    text-align: center;
    margin-bottom: 15px;
}

#empire-mousepad-designer .notes-header h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-white);
    font-weight: 700;
}

#empire-mousepad-designer .notes-header p {
    color: var(--text-gray);
    font-size: 0.95rem;
}

#empire-mousepad-designer .notes-card textarea {
    width: 100%;
    padding: 15px;
    background: var(--dark-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-white);
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
    line-height: 1.5;
    backdrop-filter: blur(10px);
}

#empire-mousepad-designer .notes-card textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
    background: rgba(124, 58, 237, 0.05);
}

#empire-mousepad-designer .order-summary-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 25px;
    backdrop-filter: blur(10px);
}

#empire-mousepad-designer .summary-header {
    text-align: center;
    margin-bottom: 20px;
}

#empire-mousepad-designer .summary-header h3 {
    font-size: 1.1rem;
    color: var(--text-white);
    font-weight: 700;
}

#empire-mousepad-designer .summary-content {
    display: grid;
    gap: 12px;
}

#empire-mousepad-designer .summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    font-weight: 600;
}

#empire-mousepad-designer .summary-item:last-child {
    border-bottom: none;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--success-color);
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* ===== Design Details ===== */
#empire-mousepad-designer .detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

#empire-mousepad-designer .detail-item:last-child {
    border-bottom: none;
}

#empire-mousepad-designer .detail-label {
    color: var(--text-gray);
    font-weight: 600;
}

#empire-mousepad-designer .detail-value {
    color: var(--text-white);
    font-weight: 700;
}

#empire-mousepad-designer .spec-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-gray);
}

#empire-mousepad-designer .spec-item:last-child {
    border-bottom: none;
}

#empire-mousepad-designer .spec-item strong {
    color: var(--text-white);
}

/* ===== Success Step ===== */
#empire-mousepad-designer .success-step-card {
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-lg);
    padding: 40px 30px;
    text-align: center;
    margin: 25px 0;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.2);
}

#empire-mousepad-designer .success-step-icon {
    font-size: 3rem;
    margin-bottom: 25px;
    animation: bounce 0.8s ease;
}

#empire-mousepad-designer .success-step-content h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--success-color);
    font-weight: 800;
}

#empire-mousepad-designer .success-step-content p {
    color: var(--text-gray);
    font-size: 1rem;
    margin-bottom: 25px;
    line-height: 1.5;
}

#empire-mousepad-designer .success-details {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 20px 0;
    text-align: right;
}

#empire-mousepad-designer .success-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.95rem;
}

#empire-mousepad-designer .success-detail-item:last-child {
    border-bottom: none;
}

#empire-mousepad-designer .success-detail-label {
    color: var(--text-gray);
    font-weight: 600;
    font-size: 0.95rem;
}

#empire-mousepad-designer .success-detail-value {
    color: var(--text-white);
    font-weight: 700;
    font-size: 0.95rem;
}

#empire-mousepad-designer .success-step-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 25px;
}

#empire-mousepad-designer .success-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    min-height: 55px;
    backdrop-filter: blur(10px);
}

#empire-mousepad-designer .success-btn-primary {
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

#empire-mousepad-designer .success-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

#empire-mousepad-designer .success-btn-secondary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

#empire-mousepad-designer .success-btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

#empire-mousepad-designer .success-btn-outline {
    background: transparent;
    color: var(--text-white);
    border: 2px solid var(--border-color);
}

#empire-mousepad-designer .success-btn-outline:hover {
    border-color: var(--primary-color);
    background: rgba(124, 58, 237, 0.1);
    transform: translateY(-2px);
}

/* ===== Notifications ===== */
#empire-mousepad-designer .notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px 20px;
    box-shadow: var(--shadow);
    z-index: 1001;
    display: none;
    max-width: 350px;
    animation: slideInRight 0.3s ease;
    backdrop-filter: blur(10px);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

#empire-mousepad-designer .notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

#empire-mousepad-designer .notification-icon {
    font-size: 1.4rem;
}

#empire-mousepad-designer .notification-text {
    color: var(--text-white);
    font-weight: 600;
    font-size: 0.95rem;
}

#empire-mousepad-designer .notification.success {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

#empire-mousepad-designer .notification.error {
    border-color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
}

#empire-mousepad-designer .notification.info {
    border-color: var(--primary-color);
    background: rgba(124, 58, 237, 0.1);
}

/* ===== Additional Effects ===== */
#empire-mousepad-designer .loading-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#empire-mousepad-designer .btn.adding-to-cart {
    position: relative;
    overflow: hidden;
}

#empire-mousepad-designer .btn.adding-to-cart::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}

#empire-mousepad-designer .btn-success.added-to-cart {
    animation: celebrate 0.8s ease;
}

@keyframes celebrate {
    0% { transform: scale(1); }
    25% { transform: scale(1.02) rotate(1deg); }
    50% { transform: scale(1.01) rotate(-1deg); }
    75% { transform: scale(1.02) rotate(1deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* ===== Error Message ===== */
#empire-mousepad-designer .error-notice {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--error-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 25px;
    text-align: center;
    backdrop-filter: blur(10px);
}

#empire-mousepad-designer .error-content h3 {
    color: var(--error-color);
    font-size: 1.1rem;
    margin-bottom: 12px;
    font-weight: 700;
}

#empire-mousepad-designer .error-content p {
    color: var(--text-gray);
    font-size: 0.95rem;
    margin-bottom: 15px;
}

/* ===== Final Design ===== */
#empire-mousepad-designer .final-design {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

#empire-mousepad-designer .design-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    backdrop-filter: blur(10px);
}

#empire-mousepad-designer .design-header {
    text-align: center;
    margin-bottom: 15px;
}

#empire-mousepad-designer .design-header h4 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-white);
    font-weight: 700;
}

#empire-mousepad-designer .design-header p {
    color: var(--text-gray);
    font-size: 0.95rem;
}

/* ===== Mobile Responsive Improvements ===== */

/* Large devices (desktops, 1200px and up) */
@media (min-width: 1200px) {
    #empire-mousepad-designer .empire-container {
        max-width: 1140px;
    }
}

/* Medium devices (tablets, 768px to 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
    #empire-mousepad-designer .empire-container {
        max-width: 960px;
        padding: 0 15px;
    }
    
    #empire-mousepad-designer .designer-header {
        padding: 30px 0 20px;
    }
    
    #empire-mousepad-designer .designer-header h1 {
        font-size: 1.6rem;
    }
    
    #empire-mousepad-designer .step-content {
        padding: 25px 20px;
    }
    
    #empire-mousepad-designer .sizes-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Small devices (landscape phones, 576px to 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    #empire-mousepad-designer .empire-container {
        max-width: 100%;
        padding: 0 15px;
    }
    
    #empire-mousepad-designer .designer-header {
        padding: 25px 0 15px;
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    }
    
    #empire-mousepad-designer .designer-header h1 {
        font-size: 1.4rem;
    }
    
    #empire-mousepad-designer .designer-header p {
        font-size: 0.95rem;
    }
    
    #empire-mousepad-designer .step-content {
        padding: 20px 15px;
        border-radius: var(--radius-md);
    }
    
    #empire-mousepad-designer .step-header h2 {
        font-size: 1.3rem;
    }
    
    #empire-mousepad-designer .btn {
        padding: 12px 18px;
        font-size: 0.9rem;
        min-width: 120px;
    }
    
    #empire-mousepad-designer .sizes-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    #empire-mousepad-designer .controls-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        max-width: 500px !important;
        gap: 10px !important;
    }
    
    #empire-mousepad-designer .control-btn {
        padding: 14px 10px !important;
        min-height: 70px !important;
        min-width: 70px !important;
    }
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575px) {
    #empire-mousepad-designer .empire-container {
        padding: 0 10px;
    }
    
    #empire-mousepad-designer {
        min-height: 100vh;
        height: auto;
        overflow-x: hidden;
    }
    
    #empire-mousepad-designer .designer-header {
        padding: 20px 0 12px;
        margin-bottom: 15px;
        border-radius: 0 0 var(--radius-md) var(--radius-md);
    }
    
    #empire-mousepad-designer .designer-header h1 {
        font-size: 1.3rem;
        margin-bottom: 8px;
    }
    
    #empire-mousepad-designer .designer-header p {
        font-size: 0.9rem;
    }
    
    #empire-mousepad-designer .header-content {
        padding: 0 10px;
    }
    
    #empire-mousepad-designer .step-content {
        padding: 20px 12px;
        margin-bottom: 15px;
        border-radius: var(--radius-md);
    }
    
    #empire-mousepad-designer .step-header {
        margin-bottom: 20px;
    }
    
    #empire-mousepad-designer .step-header h2 {
        font-size: 1.2rem;
        margin-bottom: 8px;
    }
    
    #empire-mousepad-designer .step-header p {
        font-size: 0.9rem;
    }
    
    #empire-mousepad-designer .btn {
        width: 100%;
        padding: 14px 16px;
        font-size: 0.9rem;
        min-width: auto;
        justify-content: center;
    }
    
    #empire-mousepad-designer .step-actions {
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
        padding-top: 15px;
    }
    
    #empire-mousepad-designer .sizes-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }
    
    #empire-mousepad-designer .size-card {
        padding: 20px 15px;
    }
    
    #empire-mousepad-designer .controls-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        max-width: 350px !important;
    }
    
    #empire-mousepad-designer .control-btn {
        padding: 14px 8px !important;
        min-height: 70px !important;
        min-width: 60px !important;
        font-size: 0.8rem !important;
        flex-direction: row !important;
        justify-content: flex-start !important;
        gap: 6px !important;
    }
    
    #empire-mousepad-designer .control-text {
        font-size: 0.75rem !important;
        text-align: right !important;
    }
    
    /* جعل أزرار التحكم تأخذ مساحة كاملة على الهواتف الصغيرة */
    #empire-mousepad-designer .control-btn[data-action="reset"] {
        grid-column: 1 / span 2;
        justify-content: center !important;
    }
    
    #empire-mousepad-designer .price-card {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        padding: 15px;
    }
    
    #empire-mousepad-designer .upload-area {
        padding: 25px 15px;
    }
    
    #empire-mousepad-designer .upload-icon {
        font-size: 2.5rem;
    }
    
    #empire-mousepad-designer .notification {
        right: 10px;
        left: 10px;
        max-width: none;
        top: 10px;
    }
    
    #empire-mousepad-designer .success-step-card {
        padding: 25px 20px;
    }
    
    #empire-mousepad-designer .success-step-content h3 {
        font-size: 1.3rem;
    }
    
    #empire-mousepad-designer .success-step-content p {
        font-size: 0.95rem;
    }
    
    #empire-mousepad-designer .success-btn {
        padding: 14px 16px;
        font-size: 0.9rem;
        min-height: 50px;
    }
    
    /* Fix for mobile viewport */
    html, body {
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #empire-mousepad-designer {
        position: relative;
        min-height: 100vh;
    }
}

/* Ultra small devices (phones under 360px) */
@media (max-width: 360px) {
    #empire-mousepad-designer .empire-container {
        padding: 0 8px;
    }
    
    #empire-mousepad-designer .designer-header {
        padding: 15px 0 10px;
    }
    
    #empire-mousepad-designer .designer-header h1 {
        font-size: 1.2rem;
    }
    
    #empire-mousepad-designer .step-content {
        padding: 15px 10px;
    }
    
    #empire-mousepad-designer .step-header h2 {
        font-size: 1.1rem;
    }
    
    #empire-mousepad-designer .btn {
        padding: 12px 14px;
        font-size: 0.85rem;
    }
    
    #empire-mousepad-designer .size-info h4 {
        font-size: 0.95rem;
    }
    
    #empire-mousepad-designer .controls-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
        max-width: 300px !important;
    }
    
    #empire-mousepad-designer .control-btn {
        padding: 12px 6px !important;
        min-height: 60px !important;
        min-width: 50px !important;
        font-size: 0.75rem !important;
    }
    
    #empire-mousepad-designer .control-text {
        font-size: 0.7rem !important;
    }
}

/* ===== Touch Device Optimizations ===== */
@media (hover: none) and (pointer: coarse) {
    #empire-mousepad-designer .btn:hover {
        transform: none;
    }
    
    #empire-mousepad-designer .size-option:hover .size-card {
        transform: none;
    }
    
    #empire-mousepad-designer .control-btn:hover {
        transform: none;
    }
    
    #empire-mousepad-designer .upload-area:hover {
        transform: none;
    }
}

/* ===== High DPI Screen Optimizations ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #empire-mousepad-designer #designCanvas,
    #empire-mousepad-designer #finalCanvas,
    #empire-mousepad-designer #orderCanvas {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ===== Print Styles ===== */
@media print {
    #empire-mousepad-designer {
        background: white !important;
        color: black !important;
    }
    
    #empire-mousepad-designer .btn,
    #empire-mousepad-designer .notification,
    #empire-mousepad-designer .success-step-card {
        display: none !important;
    }
}

/* ===== Reduced Motion Support ===== */
@media (prefers-reduced-motion: reduce) {
    #empire-mousepad-designer * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Dark Mode Support ===== */
@media (prefers-color-scheme: dark) {
    #empire-mousepad-designer {
        background: var(--gradient-bg);
    }
}

/* ===== iOS Safari Specific Fixes ===== */
@supports (-webkit-touch-callout: none) {
    #empire-mousepad-designer {
        min-height: -webkit-fill-available;
    }
    
    #empire-mousepad-designer .canvas-container {
        -webkit-overflow-scrolling: touch;
    }
}

/* ===== Enhanced Focus States for Accessibility ===== */
#empire-mousepad-designer .btn:focus,
#empire-mousepad-designer .control-btn:focus,
#empire-mousepad-designer .size-option:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ===== Improved Form Elements ===== */
#empire-mousepad-designer input,
#empire-mousepad-designer select,
#empire-mousepad-designer textarea {
    font-family: 'Cairo', 'Tajawal', sans-serif;
}

/* ===== Performance Optimizations ===== */
#empire-mousepad-designer .designer-header::before {
    will-change: transform;
}

#empire-mousepad-designer .canvas-container {
    contain: layout style paint;
}

/* ===== Square Canvas for Square Sizes ===== */
#empire-mousepad-designer .canvas-container.square-canvas {
    aspect-ratio: 1 / 1;
    max-width: 80vw;
    margin: 0 auto;
}

#empire-mousepad-designer .canvas-container.square-canvas canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

/* تحسينات للأبعاد المربعة في المعاينة */
#empire-mousepad-designer #step3 .canvas-container.square-canvas,
#empire-mousepad-designer #step4 .canvas-container.square-canvas {
    max-width: 400px;
    max-height: 400px;
}

/* ===== Additional Mobile Fixes ===== */
@media (max-width: 768px) {
    #empire-mousepad-designer #step2 .step-content {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 70vh;
    }
    
    #empire-mousepad-designer .step-actions {
        position: sticky;
        bottom: 0;
        background: var(--card-bg);
        padding: 15px;
        margin: 0 -12px -12px;
        border-top: 1px solid var(--border-color);
    }
}

/* ===== Design Preview Container ===== */
#empire-mousepad-designer .design-preview-container {
    text-align: center;
    margin: 20px 0;
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    border: 2px dashed #e2e8f0;
}

#empire-mousepad-designer #modalDesignImage {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    display: block;
    margin: 0 auto;
}

/* تحسينات للوضع الداكن */
@media (prefers-color-scheme: dark) {
    #empire-mousepad-designer .design-preview-container {
        background: #475569;
        border-color: #64748b;
    }
}

/* ===== Canvas Centering and Responsive Improvements ===== */
#empire-mousepad-designer .canvas-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0 auto;
}

/* تحسين المسافات بين العناصر */
#empire-mousepad-designer .preview-section {
    margin-bottom: 15px;
}

#empire-mousepad-designer .design-controls {
    margin-top: 15px;
}

/* تحسين التخطيط العام */
#empire-mousepad-designer .step-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== FABRIC CANVAS TOUCH IMPROVEMENTS ===== */
#empire-mousepad-designer .canvas-container {
    touch-action: pan-x pan-y pinch-zoom;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

#empire-mousepad-designer .canvas-container canvas {
    touch-action: pan-x pan-y pinch-zoom;
}

/* ===== NEW: Canvas Preview Improvements ===== */
#empire-mousepad-designer #step3 .canvas-container,
#empire-mousepad-designer #step4 .canvas-container {
    border: none;
    background: transparent;
    border-radius: 0;
    padding: 0;
}

#empire-mousepad-designer #step3 .canvas-container canvas,
#empire-mousepad-designer #step4 .canvas-container canvas {
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

/* إخفاء أزرار التحكم في خطوات المعاينة */
#empire-mousepad-designer #step3 .design-controls,
#empire-mousepad-designer #step4 .design-controls {
    display: none !important;
}

/* ===== NEW: 25MB File Size Update ===== */
#empire-mousepad-designer .upload-formats {
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 500;
    background: rgba(255,255,255,0.05);
    padding: 5px 10px;
    border-radius: 12px;
    display: inline-block;
}

/* ===== Mobile Responsive for Controls ===== */
@media (max-width: 767px) {
    #empire-mousepad-designer .design-controls {
        margin-top: 15px !important;
    }
    
    #empire-mousepad-designer .controls-grid {
        padding: 0 10px !important;
    }
}

/* تحسينات للوضع الداكن */
@media (prefers-color-scheme: dark) {
    #empire-mousepad-designer .control-btn {
        background: rgba(255, 255, 255, 0.05) !important;
        border-color: var(--border-color) !important;
        color: var(--text-white) !important;
    }
    
    #empire-mousepad-designer .control-btn:hover {
        background: rgba(124, 58, 237, 0.15) !important;
        border-color: var(--primary-color) !important;
    }
    
    #empire-mousepad-designer .reset-btn {
        background: rgba(239, 68, 68, 0.1) !important;
        border-color: rgba(239, 68, 68, 0.3) !important;
    }
    
    #empire-mousepad-designer .reset-btn:hover {
        background: rgba(239, 68, 68, 0.2) !important;
        border-color: var(--error-color) !important;
    }
}

/* تحسينات إضافية للأمان */
.empire-mousepad-isolated {
    all: initial;
    font-family: 'Cairo', 'Tajawal', sans-serif !important;
}

/* منع تأثيرات الـ transform على العناصر الخارجية */
#empire-mousepad-designer {
    transform: none !important;
    position: relative;
    z-index: 9999;
}

/* التأكد من أن الـ scroll يعمل بشكل طبيعي */
html, body {
    overflow-x: visible;
    overflow-y: auto;
}

/* إصلاح مشكلة التمرير على الهواتف */
@media (max-width: 768px) {
    #empire-mousepad-designer {
        -webkit-overflow-scrolling: touch;
        overflow-y: auto;
    }
}