/* ========================================
   Embroidery Designer - Frontend Styles
   التصميم المميز الكامل للإضافة
   ======================================== */

.embroidery-designer-wrapper {
    --bg: #0b0f14;
    --panel: #0f1620;
    --panel2: #121b27;
    --text: #e9eef6;
    --muted: #a8b3c7;
    --line: #1f2b3b;
    --accent: #f5c04d;
    --accent2: #23c483;
    --danger: #ff5c7a;
    --ok: #54d38a;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    --radius: 16px;
    
    font-family: "Cairo", system-ui, -apple-system, Segoe UI, Roboto, Arial;
    background: radial-gradient(1200px 600px at 70% -10%, rgba(245, 192, 77, .18), transparent 60%), 
                radial-gradient(900px 500px at 10% 0%, rgba(35, 196, 131, .12), transparent 55%), 
                var(--bg);
    color: var(--text);
    padding: 28px 18px 60px;
    border-radius: 20px;
    margin: 20px 0;
}

.embroidery-designer-wrapper * {
    box-sizing: border-box;
}

.embroidery-designer-wrapper a {
    color: inherit;
}

.embroidery-designer-wrapper .ed-container {
    max-width: 1240px;
    margin: 0 auto;
}

/* Hero Section */
.embroidery-designer-wrapper .hero {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 18px;
    align-items: start;
    margin-bottom: 18px;
}

@media (max-width: 980px) {
    .embroidery-designer-wrapper .hero {
        grid-template-columns: 1fr;
    }
}

.embroidery-designer-wrapper .hero-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .02));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 18px 16px;
    box-shadow: var(--shadow);
}

.embroidery-designer-wrapper .hero h1 {
    margin: 0 0 10px;
    font-size: 28px;
    line-height: 1.2;
}

.embroidery-designer-wrapper .hero p {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.8;
}

.embroidery-designer-wrapper .badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.embroidery-designer-wrapper .badge {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text);
    background: rgba(255, 255, 255, .03);
}

.embroidery-designer-wrapper .badge strong {
    color: var(--accent);
}

.embroidery-designer-wrapper .cta-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

/* Buttons */
.embroidery-designer-wrapper .btn {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    padding: 11px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    transition: .2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.embroidery-designer-wrapper .btn:hover {
    transform: translateY(-1px);
    border-color: rgba(245, 192, 77, .35);
}

.embroidery-designer-wrapper .btn.primary {
    background: linear-gradient(180deg, rgba(245, 192, 77, .22), rgba(245, 192, 77, .12));
    border-color: rgba(245, 192, 77, .35);
}

.embroidery-designer-wrapper .btn.success {
    background: linear-gradient(180deg, rgba(35, 196, 131, .22), rgba(35, 196, 131, .10));
    border-color: rgba(35, 196, 131, .35);
}

.embroidery-designer-wrapper .btn.danger {
    background: linear-gradient(180deg, rgba(255, 92, 122, .18), rgba(255, 92, 122, .08));
    border-color: rgba(255, 92, 122, .35);
}

.embroidery-designer-wrapper .btn.small {
    padding: 9px 12px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
}

.embroidery-designer-wrapper .hint {
    font-size: 12px;
    color: var(--muted);
    margin-top: 8px;
}

/* Layout Grid */
.embroidery-designer-wrapper .grid {
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    gap: 18px;
}

@media (max-width: 980px) {
    .embroidery-designer-wrapper .grid {
        grid-template-columns: 1fr;
    }
}

.embroidery-designer-wrapper .panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .02));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.embroidery-designer-wrapper .panel .hd {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: rgba(255, 255, 255, .02);
}

.embroidery-designer-wrapper .panel .hd h2 {
    margin: 0;
    font-size: 16px;
}

.embroidery-designer-wrapper .panel .bd {
    padding: 16px;
}

/* Canvas Area */
.embroidery-designer-wrapper .canvas-wrap {
    background: radial-gradient(700px 380px at 60% -10%, rgba(245, 192, 77, .10), transparent 50%), 
                radial-gradient(600px 320px at 10% 10%, rgba(35, 196, 131, .08), transparent 50%), 
                rgba(255, 255, 255, .02);
    border: 1px dashed rgba(255, 255, 255, .12);
    border-radius: 14px;
    padding: 14px;
}

.embroidery-designer-wrapper .canvas-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.embroidery-designer-wrapper .seg {
    display: flex;
    background: rgba(255, 255, 255, .03);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}

.embroidery-designer-wrapper .seg button {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 9px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    transition: .15s;
}

.embroidery-designer-wrapper .seg button.active {
    background: rgba(245, 192, 77, .18);
    color: var(--text);
}

.embroidery-designer-wrapper .canvas-holder {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, .20);
}

.embroidery-designer-wrapper canvas {
    display: block;
}

.embroidery-designer-wrapper .safe-area-label {
    position: absolute;
    left: 12px;
    bottom: 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, .75);
    background: rgba(0, 0, 0, .35);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px;
    padding: 6px 10px;
    backdrop-filter: blur(6px);
}

/* Form Controls */
.embroidery-designer-wrapper .cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 560px) {
    .embroidery-designer-wrapper .cols {
        grid-template-columns: 1fr;
    }
}

.embroidery-designer-wrapper .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.embroidery-designer-wrapper .field.hidden {
    display: none;
}

.embroidery-designer-wrapper .label {
    font-size: 13px;
    color: var(--muted);
}

.embroidery-designer-wrapper select,
.embroidery-designer-wrapper input[type="number"],
.embroidery-designer-wrapper input[type="text"],
.embroidery-designer-wrapper input[type="tel"],
.embroidery-designer-wrapper input[type="email"],
.embroidery-designer-wrapper textarea {
    width: 100%;
    padding: 11px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .08);
    color: #ffffff;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
}

.embroidery-designer-wrapper select option {
    background: #1a1f2e !important;
    background-color: #1a1f2e !important;
    color: #ffffff !important;
    padding: 10px;
}

/* Fix for native select dropdown on different browsers */
.embroidery-designer-wrapper select:focus {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(245, 192, 77, .35);
}

/* Ensure select dropdown has dark background */
.embroidery-designer-wrapper select {
    appearance: auto;
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    color-scheme: dark;
}

/* Force dark background for all select dropdowns */
.embroidery-designer-wrapper select option,
.embroidery-designer-wrapper select optgroup {
    background: #1a1f2e !important;
    background-color: #1a1f2e !important;
    color: #ffffff !important;
}

/* Override browser default styles */
.embroidery-designer-wrapper select::-webkit-scrollbar {
    width: 8px;
}

.embroidery-designer-wrapper select::-webkit-scrollbar-track {
    background: #0b0f14;
}

.embroidery-designer-wrapper select::-webkit-scrollbar-thumb {
    background: rgba(245, 192, 77, 0.3);
    border-radius: 4px;
}

.embroidery-designer-wrapper select::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 192, 77, 0.5);
}

.embroidery-designer-wrapper textarea {
    min-height: 80px;
    resize: vertical;
}

/* File Input */
.embroidery-designer-wrapper .file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    width: 100%;
}

.embroidery-designer-wrapper .file-input-wrapper input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.embroidery-designer-wrapper .file-input-label {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .03);
    color: var(--muted);
    cursor: pointer;
    transition: .2s;
    font-size: 14px;
}

.embroidery-designer-wrapper .file-input-label:hover {
    border-color: rgba(245, 192, 77, .35);
    background: rgba(255, 255, 255, .05);
}

.embroidery-designer-wrapper .file-input-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(245, 192, 77, .2);
    border-radius: 6px;
    color: var(--accent);
    font-size: 12px;
    flex-shrink: 0;
}

.embroidery-designer-wrapper .file-input-text {
    flex: 1;
}

/* Color Swatches */
.embroidery-designer-wrapper .colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.embroidery-designer-wrapper .swatch {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, .18);
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
    position: relative;
    transition: .12s;
}

.embroidery-designer-wrapper .swatch.active {
    border-color: rgba(245, 192, 77, .75);
    transform: translateY(-1px);
}

.embroidery-designer-wrapper .swatch::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .08);
}

.embroidery-designer-wrapper .note {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.7;
    margin: 6px 0 0;
}

/* Size Table */
.embroidery-designer-wrapper table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--line);
}

.embroidery-designer-wrapper th,
.embroidery-designer-wrapper td {
    padding: 10px 10px;
    border-bottom: 1px solid var(--line);
    text-align: center;
    font-size: 13px;
}

.embroidery-designer-wrapper th {
    background: rgba(255, 255, 255, .03);
    color: var(--muted);
    font-weight: 700;
}

.embroidery-designer-wrapper tr:last-child td {
    border-bottom: 0;
}

.embroidery-designer-wrapper td input {
    text-align: center;
    padding: 9px 8px;
    border-radius: 10px;
}

/* Pricing Box */
.embroidery-designer-wrapper .price-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .02);
}

.embroidery-designer-wrapper .price-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    font-size: 14px;
    color: var(--muted);
}

.embroidery-designer-wrapper .price-row strong {
    color: var(--text);
}

.embroidery-designer-wrapper .total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px dashed rgba(255, 255, 255, .14);
}

.embroidery-designer-wrapper .total .val {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: .3px;
}

.embroidery-designer-wrapper .divider {
    height: 1px;
    background: var(--line);
    margin: 14px 0;
}

/* Modal */
.embroidery-designer-wrapper .modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .55);
    padding: 18px;
    z-index: 9999;
}

.embroidery-designer-wrapper .modal.open {
    display: flex;
}

.embroidery-designer-wrapper .modal-card {
    width: min(980px, 100%);
    background: #0c121b;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
    max-height: 90vh;
    overflow-y: auto;
}

.embroidery-designer-wrapper .modal-hd {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.embroidery-designer-wrapper .modal-hd h3 {
    margin: 0;
    font-size: 16px;
}

.embroidery-designer-wrapper .modal-bd {
    padding: 16px;
}

.embroidery-designer-wrapper .close {
    cursor: pointer;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, .03);
    color: var(--text);
    font-weight: 800;
}

.embroidery-designer-wrapper .summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
}

@media (max-width: 900px) {
    .embroidery-designer-wrapper .summary {
        grid-template-columns: 1fr;
    }
}

.embroidery-designer-wrapper .summary .box {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, .02);
    border-radius: 14px;
    padding: 14px;
}

.embroidery-designer-wrapper .kv {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, .08);
}

.embroidery-designer-wrapper .kv:last-child {
    border-bottom: 0;
}

.embroidery-designer-wrapper .kv b {
    color: var(--text);
}

.embroidery-designer-wrapper .imgprev {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, .10);
    overflow: hidden;
    background: rgba(0, 0, 0, .25);
}

.embroidery-designer-wrapper .imgprev img {
    width: 100%;
    display: block;
}

.embroidery-designer-wrapper .footer-note {
    margin-top: 10px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.7;
}

/* Tooltip */
.embroidery-designer-wrapper .tooltip-wrap {
    position: relative;
    display: inline-block;
}

.embroidery-designer-wrapper .tooltip-wrap .tooltip-text {
    visibility: hidden;
    opacity: 0;
    background: linear-gradient(135deg, rgba(245, 192, 77, 0.95), rgba(214, 167, 58, 0.95));
    color: #0b0f14;
    text-align: center;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s, visibility 0.3s;
}

.embroidery-designer-wrapper .tooltip-wrap .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -8px;
    border-width: 8px;
    border-style: solid;
    border-color: rgba(245, 192, 77, 0.95) transparent transparent transparent;
}

.embroidery-designer-wrapper .tooltip-wrap:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.embroidery-designer-wrapper .tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(245, 192, 77, 0.2);
    border: 1px solid rgba(245, 192, 77, 0.4);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 800;
    color: var(--accent);
    margin-right: 6px;
    cursor: help;
}

/* Select2 Dark Theme */
.embroidery-designer-wrapper .select2-container--default .select2-selection--single {
    background: rgba(255, 255, 255, .08) !important;
    border: 1px solid var(--line) !important;
    border-radius: 12px !important;
    height: 43px !important;
    padding: 6px 12px !important;
}

.embroidery-designer-wrapper .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #ffffff !important;
    line-height: 30px;
    padding-left: 0;
    padding-right: 0;
    font-weight: 500 !important;
    font-size: 14px !important;
}

.embroidery-designer-wrapper .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 41px;
    right: 8px;
}

.embroidery-designer-wrapper .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--muted) transparent transparent transparent;
}

.select2-dropdown {
    background: var(--panel) !important;
    border: 1px solid var(--line) !important;
    border-radius: 12px !important;
    box-shadow: var(--shadow) !important;
    z-index: 9999 !important;
}

/* Ensure Select2 container has proper z-index */
.select2-container {
    z-index: 9998 !important;
}

.select2-container--open {
    z-index: 9999 !important;
}

.select2-container--default .select2-results__option {
    background: transparent;
    color: #ffffff !important;
    padding: 10px 12px;
    font-weight: 500;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: rgba(245, 192, 77, .18);
    color: var(--text);
}

.select2-container--default .select2-results__option[aria-selected="true"] {
    background: rgba(245, 192, 77, .12);
    color: var(--accent);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    background: rgba(255, 255, 255, .03);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    padding: 8px 12px;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    outline: none;
    border-color: rgba(245, 192, 77, .35);
}
