/* ============================================================
   WC DPM — Product Tabs Admin Styles  (v3 — TinyMCE)
   ============================================================ */

/* ---- Section wrapper ---- */
#wc-dpm-tabs-section {
    margin-top: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
#wc-dpm-tabs-section > h3 {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    padding: 10px 14px;
    background: linear-gradient(90deg, #1d2327 0%, #2c3338 100%);
    color: #fff;
    border-left: 4px solid #2271b1;
    border-radius: 3px 3px 0 0;
    margin: 0;
}

/* ---- Toolbar ---- */
.wc-dpm-tabs-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-top: none;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.wc-dpm-tabs-toolbar .description { color: #787c82; font-size: 12px; }
#wc-dpm-add-tab {
    background: #2271b1 !important;
    color: #fff !important;
    border-color: #2271b1 !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    padding: 5px 14px !important;
    border-radius: 4px !important;
}
#wc-dpm-add-tab:hover { background: #135e96 !important; border-color: #135e96 !important; }

/* ---- Empty state ---- */
#wc-dpm-tabs-empty {
    padding: 32px 20px;
    text-align: center;
    color: #787c82;
    border: 2px dashed #c3c4c7;
    border-radius: 6px;
    font-size: 13px;
    background: #fafafa;
}

/* ---- Tab rows list ---- */
#wc-dpm-tabs-list { margin: 0; padding: 0; list-style: none; }

/* ---- Individual tab row ---- */
.wc-dpm-tab-row {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    transition: box-shadow .2s, border-color .2s;
    overflow: hidden;
}
.wc-dpm-tab-row:hover {
    border-color: #2271b1;
    box-shadow: 0 2px 8px rgba(34,113,177,.12);
}
.wc-dpm-tab-placeholder {
    height: 58px;
    border: 2px dashed #2271b1;
    border-radius: 6px;
    background: #f0f6ff;
    margin-bottom: 10px;
    opacity: .6;
}

/* ---- Header row ---- */
.wc-dpm-tab-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    user-select: none;
    background: #fdfdfd;
    border-bottom: 1px solid transparent;
    transition: background .15s;
}
.wc-dpm-tab-row.wc-dpm-tab-open .wc-dpm-tab-header {
    border-bottom-color: #ebebeb;
    background: #f9f9f9;
}
.wc-dpm-tab-header:hover { background: #f0f6ff; }
.wc-dpm-tab-header::after {
    content: '▶';
    font-size: 9px;
    color: #9ea2a7;
    flex-shrink: 0;
    margin-left: 2px;
    transition: transform .2s;
}
.wc-dpm-tab-row.wc-dpm-tab-open .wc-dpm-tab-header::after { transform: rotate(90deg); }

/* ---- Drag handle ---- */
.wc-dpm-tab-drag {
    color: #c3c4c7;
    cursor: grab;
    font-size: 16px;
    flex-shrink: 0;
    transition: color .15s;
}
.wc-dpm-tab-drag:hover { color: #787c82; }
.wc-dpm-tab-drag:active { cursor: grabbing; }

/* ---- Tab number badge ---- */
.wc-dpm-tab-number {
    font-size: 10px;
    font-weight: 700;
    color: #2271b1;
    background: #dce8f5;
    padding: 3px 8px;
    border-radius: 12px;
    flex-shrink: 0;
    min-width: 46px;
    text-align: center;
    letter-spacing: .3px;
    text-transform: uppercase;
}

/* ---- Title input ---- */
.wc-dpm-tab-title {
    flex: 1;
    min-width: 140px;
    border: 1px solid transparent;
    background: transparent;
    padding: 5px 9px;
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    border-radius: 4px;
    transition: border-color .2s, background .2s, box-shadow .2s;
}
.wc-dpm-tab-title:focus, .wc-dpm-tab-title:hover {
    border-color: #2271b1;
    background: #fff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(34,113,177,.15);
}

/* ---- Badge input ---- */
.wc-dpm-tab-badge-input {
    width: 110px;
    border: 1px solid transparent;
    background: transparent;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    color: #00a32a;
    text-transform: uppercase;
    letter-spacing: .3px;
    transition: border-color .2s, background .2s;
}
.wc-dpm-tab-badge-input::placeholder { color: #c3c4c7; font-weight: 400; text-transform: none; letter-spacing: 0; }
.wc-dpm-tab-badge-input:focus, .wc-dpm-tab-badge-input:hover {
    border-color: #00a32a; background: #fff; outline: none;
}

/* ---- Actions ---- */
.wc-dpm-tab-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}
.wc-dpm-tab-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 3px;
}
.wc-dpm-tab-toggle:hover { background: #f0f0f1; }
.wc-dpm-tab-enabled { cursor: pointer; accent-color: #2271b1; }
.wc-dpm-toggle-label { font-size: 11px; color: #787c82; white-space: nowrap; font-weight: 500; }

/* ---- AI button ---- */
.wc-dpm-tab-ai-btn {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
    color: #fff !important;
    border-color: transparent !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 4px 11px !important;
    border-radius: 4px !important;
    white-space: nowrap !important;
    transition: opacity .2s !important;
}
.wc-dpm-tab-ai-btn:hover { opacity: .88 !important; color: #fff !important; }

/* ---- Remove button ---- */
.wc-dpm-tab-remove {
    color: #d63638 !important;
    border-color: #d63638 !important;
    font-size: 12px !important;
    padding: 4px 9px !important;
    line-height: 1.4 !important;
    border-radius: 4px !important;
    transition: background .15s !important;
}
.wc-dpm-tab-remove:hover { background: #d63638 !important; color: #fff !important; }

/* ---- Tab body ---- */
.wc-dpm-tab-body {
    display: none;
    padding: 0;
    background: #fff;
}
.wc-dpm-tab-row.wc-dpm-tab-open .wc-dpm-tab-body { display: block; }

/* ---- Editor wrapper ---- */
.wc-dpm-tab-editor-wrap { margin: 0; }

/* Hidden raw textarea (TinyMCE replaces it visually) */
.wc-dpm-tab-content-editor {
    width: 100%;
    box-sizing: border-box;
    min-height: 160px;
}

/* TinyMCE container polish */
.wc-dpm-tab-editor-wrap .mce-tinymce {
    border-top: none !important;
    border-radius: 0 0 4px 4px !important;
}
.wc-dpm-tab-editor-wrap .mce-container {
    border-radius: 0 0 4px 4px !important;
}

/* ============================================================
   AI MODAL
   ============================================================ */
.wc-dpm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: dpmFadeIn .18s ease;
}
@keyframes dpmFadeIn { from { opacity: 0; } to { opacity: 1; } }

.wc-dpm-modal-box {
    background: #fff;
    border-radius: 8px;
    padding: 28px 28px 24px;
    width: 520px;
    max-width: 96vw;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    animation: dpmSlideUp .2s ease;
}
@keyframes dpmSlideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.wc-dpm-modal-box h3 {
    margin: 0 0 18px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    padding: 0;
    background: none;
    color: #1d2327;
}
.wc-dpm-modal-provider-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: #6366f1;
    color: #fff;
    letter-spacing: .3px;
    margin-left: 8px;
    vertical-align: middle;
    text-transform: uppercase;
}
.wc-dpm-modal-provider-badge.openai { background: #10a37f; }
.wc-dpm-modal-provider-badge.gemini { background: #4285f4; }
.wc-dpm-modal-box label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #1d2327;
    letter-spacing: .2px;
}
.wc-dpm-modal-box textarea,
.wc-dpm-modal-box input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 9px 11px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    transition: border-color .2s, box-shadow .2s;
}
.wc-dpm-modal-box textarea:focus,
.wc-dpm-modal-box input[type="text"]:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(34,113,177,.15);
}
.wc-dpm-modal-actions { display: flex; gap: 8px; margin-top: 16px; }
#wc-dpm-ai-submit {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
    border-color: transparent !important;
    font-weight: 600 !important;
    color: #fff !important;
}
#wc-dpm-ai-submit:hover { opacity: .88 !important; }

/* ============================================================
   FRONTEND — Tab Badge
   ============================================================ */
.wc-dpm-tab-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 7px;
    background: #00a32a;
    color: #fff;
    border-radius: 10px;
    vertical-align: middle;
    margin-left: 6px;
    line-height: 1.5;
    letter-spacing: .5px;
    text-transform: uppercase;
    position: relative;
    top: -1px;
}

/* ============================================================
   FRONTEND — Tab Content
   ============================================================ */
.wc-dpm-tab-content {
    padding: 6px 0 10px;
    line-height: 1.8;
    font-size: 15px;
    color: #2d3748;
}
.wc-dpm-tab-content h2 { font-size: 22px; font-weight: 700; margin-bottom: 14px; color: #1d2327; }
.wc-dpm-tab-content h3 { font-size: 18px; font-weight: 700; margin-bottom: 12px; color: #1d2327; }
.wc-dpm-tab-content h4 { font-size: 16px; font-weight: 600; margin-bottom: 10px; color: #1d2327; }
.wc-dpm-tab-content ul, .wc-dpm-tab-content ol { padding-left: 22px; margin-bottom: 18px; }
.wc-dpm-tab-content li { margin-bottom: 8px; font-size: 15px; }
.wc-dpm-tab-content blockquote { border-left: 3px solid #2271b1; padding: 10px 16px; margin: 16px 0; background: #f0f6ff; border-radius: 0 4px 4px 0; }
.wc-dpm-tab-content table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.wc-dpm-tab-content table th,
.wc-dpm-tab-content table td { border: 1px solid #e0e0e0; padding: 10px 14px; text-align: left; }
.wc-dpm-tab-content table th { background: #f5f5f5; font-weight: 700; }
.wc-dpm-tab-content code { background: #f0f0f1; padding: 2px 6px; border-radius: 3px; font-family: monospace; font-size: 12px; }
.wc-dpm-tab-content pre { background: #1d2327; color: #f0f0f1; padding: 14px 16px; border-radius: 4px; overflow-x: auto; margin-bottom: 16px; }
.wc-dpm-tab-content hr { border: none; border-top: 1px solid #e0e0e0; margin: 20px 0; }

/* ============================================================
   FRONTEND + ADMIN PREVIEW — FAQ Accordion
   ============================================================ */
.wc-dpm-faq { margin: 16px 0; }

.wc-dpm-faq-item {
    border: 1px solid #dcdcde;
    border-radius: 6px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: box-shadow .2s;
}
.wc-dpm-faq-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }

.wc-dpm-faq-question {
    display: block;
    padding: 14px 20px;
    background: #f6f7f7;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    user-select: none;
    list-style: none;
    position: relative;
    padding-right: 44px;
    transition: background .15s, color .15s;
}
/* Remove default browser marker */
.wc-dpm-faq-question::marker,
.wc-dpm-faq-question::-webkit-details-marker { display: none; }

/* Plus / minus icon */
.wc-dpm-faq-question::after {
    content: '+';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    font-weight: 300;
    color: #2271b1;
    line-height: 1;
    transition: transform .2s;
}
details[open] > .wc-dpm-faq-question::after { content: '−'; }
details[open] > .wc-dpm-faq-question {
    background: #e8f0fa;
    color: #135e96;
    border-bottom: 1px solid #dcdcde;
}

.wc-dpm-faq-answer {
    padding: 16px 20px;
    font-size: 15px;
    line-height: 1.8;
    color: #2d3748;
    background: #fff;
    animation: dpmFaqOpen .18s ease;
}
@keyframes dpmFaqOpen { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.wc-dpm-faq-answer p:last-child { margin-bottom: 0; }

/* ============================================================
   SETTINGS PAGE — AI Section
   ============================================================ */
.wc-dpm-ai-section-heading {
    font-size: 13px;
    font-weight: 700;
    padding: 10px 14px;
    background: linear-gradient(90deg, #1d2327 0%, #2c3338 100%);
    color: #fff;
    border-left: 4px solid #6366f1;
    border-radius: 3px;
    margin: 24px 0 0;
    display: block;
}
.wc-dpm-provider-row { display: none; }
.wc-dpm-provider-row.active { display: table-row; }

/* ============================================================
   GLOBAL AI FLOATING BUTTON
   ============================================================ */
#wc-dpm-global-ai-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 99999;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 13px 24px;
    font-size: 14px;
    font-weight: 700;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99,102,241,.5);
    transition: transform .2s, box-shadow .2s;
    line-height: 1.4;
}
#wc-dpm-global-ai-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(99,102,241,.6);
}
#wc-dpm-global-ai-btn:active { transform: translateY(0); }

/* ============================================================
   GLOBAL AI MODAL ENHANCEMENTS
   ============================================================ */
#wc-dpm-global-ai-modal .wc-dpm-modal-box {
    width: 660px;
    max-height: 92vh;
    overflow-y: auto;
}
.wc-dpm-modal-row {
    margin-bottom: 16px;
}
.wc-dpm-modal-select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    transition: border-color .2s;
}
.wc-dpm-modal-select:focus { border-color: #2271b1; outline: none; box-shadow: 0 0 0 2px rgba(34,113,177,.15); }

/* Quick action tiles */
.wc-dpm-ai-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
}
.wc-dpm-ai-quick-btn {
    background: #f0f6ff;
    border: 1px solid #c8dff7;
    color: #135e96;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
    line-height: 1.4;
}
.wc-dpm-ai-quick-btn:hover { background: #dce8f5; border-color: #2271b1; }
.wc-dpm-ai-quick-btn.active { background: #2271b1; border-color: #2271b1; color: #fff; }

/* Insert mode radios */
.wc-dpm-modal-radio-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.wc-dpm-modal-radio-row > label:first-child { flex: 0 0 100%; margin-bottom: 4px; }
.wc-dpm-radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    color: #3c434a;
}
.wc-dpm-radio-label input[type="radio"] { accent-color: #6366f1; margin: 0; }
