/* EPD DESIGNER ULTRA-MODERN PERSIAN RTL STYLES */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;600;700;800&display=swap');

.epd-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    direction: rtl;
    text-align: right;
    font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
    padding: 15px;
}

.epd-modal-container {
    background: #ffffff;
    width: 100%;
    max-width: 1180px;
    height: 90vh;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: epdFadeUp 0.25s ease-out;
}

@keyframes epdFadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* HEADER */
.epd-modal-header {
    background: #1e293b;
    color: #ffffff;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}

.epd-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.epd-header-title h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #f8fafc;
}

.epd-close-modal-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
}

.epd-close-modal-btn:hover {
    color: #ef4444;
}

/* BODY LAYOUT */
.epd-modal-body {
    display: flex;
    flex-direction: row;
    flex: 1;
    overflow: hidden;
    background: #f8fafc;
    position: relative;
    width: 100%;
}

/* TOOLBAR SIDEBAR */
.epd-toolbar {
    width: 360px;
    max-width: 360px;
    min-width: 320px;
    background: #ffffff;
    border-left: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
}

.epd-tool-tabs {
    display: flex;
    flex-wrap: wrap;
    background: #f1f5f9;
    padding: 8px;
    gap: 6px;
    border-bottom: 1px solid #e2e8f0;
    max-height: 140px;
    overflow-y: auto;
}

.epd-tab-btn {
    flex: 1 1 calc(33.333% - 6px);
    min-width: 90px;
    padding: 8px 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.epd-tab-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.epd-tab-panels {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.epd-panel {
    display: none;
}

.epd-panel.active {
    display: block;
}

.epd-panel h3 {
    margin: 0 0 14px 0;
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.epd-hint {
    font-size: 11px;
    color: #64748b;
    margin-top: -8px;
    margin-bottom: 15px;
    line-height: 1.6;
}

.epd-field {
    margin-bottom: 16px;
}

.epd-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.epd-field input[type="text"],
.epd-field input[type="number"],
.epd-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    background: #ffffff;
}

.epd-field input[type="color"] {
    width: 100%;
    height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    background: #ffffff;
    padding: 2px;
}

.epd-field-row {
    display: flex;
    gap: 12px;
}

.epd-btn-primary {
    width: 100%;
    background: #2563eb;
    color: #ffffff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.epd-btn-primary:hover {
    background: #1d4ed8;
}

.epd-btn-secondary {
    width: 100%;
    background: #0284c7;
    color: #ffffff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

/* CLIPARTS & BORDERS */
.epd-clipart-grid,
.apd-clipart-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.epd-clipart-item,
.apd-clipart-item,
.epd-border-item {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
}

.epd-clipart-item:hover,
.apd-clipart-item:hover,
.epd-border-item:hover {
    border-color: #2563eb;
    background: #f0f6ff;
}

/* COLOR SWATCHES */
.epd-color-swatches,
.apd-color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.epd-swatch,
.apd-swatch {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.15s;
}

.epd-swatch:hover,
.epd-swatch.active,
.apd-swatch:hover,
.apd-swatch.active {
    transform: scale(1.15);
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* EMOJI GRID */
.epd-emoji-item,
.apd-emoji-item {
    font-size: 22px;
    cursor: pointer;
    text-align: center;
    padding: 4px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    transition: transform 0.1s, border-color 0.1s;
}

.epd-emoji-item:hover,
.apd-emoji-item:hover {
    transform: scale(1.15);
    border-color: #2563eb;
}

/* STAGE CONTAINER */
.epd-stage-container,
.apd-stage-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
    padding: 20px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.epd-view-switcher,
.apd-view-switcher {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.epd-view-btn,
.apd-view-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
}

.epd-view-btn.active,
.apd-view-btn.active {
    background: #1e293b;
    color: #ffffff;
    border-color: #1e293b;
}

.epd-canvas-wrapper,
.apd-canvas-wrapper {
    width: 440px;
    height: 520px;
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.epd-garment-svg,
.apd-garment-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#epd-canvas,
#apd-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.epd-canvas-actions,
.apd-canvas-actions {
    margin-top: 15px;
    display: flex;
    gap: 8px;
    justify-content: center;
    width: 100%;
}

.epd-action-btn,
.apd-action-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.epd-action-btn.danger,
.apd-action-btn.danger {
    background: #fee2e2;
    color: #dc2626;
}

.epd-action-btn.warning,
.apd-action-btn.warning {
    background: #fef3c7;
    color: #d97706;
}

.epd-action-btn:hover,
.apd-action-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* FOOTER */
.epd-modal-footer,
.apd-modal-footer {
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.epd-btn-success {
    background: #16a34a;
    color: #ffffff;
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3);
    transition: all 0.15s;
}

.epd-btn-success:hover {
    background: #15803d;
    transform: translateY(-1px);
}

@keyframes epdSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.epd-spinner {
    animation: epdSpin 1s linear infinite;
}

/* RESPONSIVE MOBILE UX STYLES */
@media (max-width: 768px) {
    .epd-modal-overlay {
        padding: 5px;
    }

    .epd-modal-container {
        height: 98vh;
        border-radius: 10px;
    }

    .epd-modal-body {
        flex-direction: column-reverse;
        overflow-y: auto;
    }

    .epd-toolbar {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e2e8f0;
    }

    .epd-stage-container {
        padding: 10px;
        min-height: 420px;
    }

    .epd-canvas-wrapper,
    .apd-canvas-wrapper {
        width: 320px;
        height: 380px;
    }

    .epd-modal-footer {
        padding: 10px 14px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .epd-footer-info {
        text-align: center;
    }

    .epd-btn-success {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }
}