/* ClassEx Translator v2.0 — Styles */

.cxt-widget * { box-sizing: border-box; }

.cxt-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    max-width: 740px;
    margin: 28px auto;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 6px 32px rgba(0,0,0,0.11);
    border: 1px solid #e0e7ef;
    background: #ffffff;
}

/* Header */
.cxt-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 24px;
    background: linear-gradient(135deg, #0073aa 0%, #005f8e 100%);
    color: #fff;
}
.cxt-logo          { font-size: 32px; flex-shrink: 0; }
.cxt-header strong { display: block; font-size: 18px; font-weight: 700; }
.cxt-header p      { margin: 3px 0 0; font-size: 13px; opacity: 0.85; }

/* Tier bar */
.cxt-tier-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: #f0f7ff;
    border-bottom: 1px solid #dce8f5;
    flex-wrap: wrap;
}
.cxt-tier-badge {
    background: #0073aa;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 999px;
}
.cxt-tier-usage { font-size: 13px; color: #475569; }

/* Upload area */
.cxt-upload-area { margin: 20px 22px; }

.cxt-upload-inner {
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    padding: 36px 20px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.cxt-upload-inner:hover,
.cxt-upload-inner.cxt-drag-over { border-color: #0073aa; background: #e0f2fe; }

.cxt-upload-icon  { font-size: 44px; display: block; margin-bottom: 10px; }
.cxt-upload-title { font-size: 16px; font-weight: 600; color: #1e293b; margin: 0 0 5px; }
.cxt-upload-sub   { font-size: 14px; color: #64748b; margin: 0 0 5px; }
.cxt-upload-note  { font-size: 12px; color: #94a3b8; margin: 0 0 14px; }

.cxt-upload-tip {
    font-size: 12px;
    color: #475569;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 10px 14px;
    margin: 0 0 16px;
    text-align: left;
    line-height: 1.6;
}
.cxt-upload-tip a { color: #0073aa; font-weight: 600; text-decoration: none; }
.cxt-upload-tip a:hover { text-decoration: underline; }

.cxt-file-input { display: none; }

.cxt-file-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
}
.cxt-file-icon    { font-size: 26px; }
.cxt-file-details { flex: 1; }
.cxt-file-name    { display: block; font-size: 14px; font-weight: 600; color: #1e293b; word-break: break-all; }
.cxt-file-size    { display: block; font-size: 12px; color: #64748b; margin-top: 2px; }

/* Settings */
.cxt-settings { padding: 0 22px 18px; display: flex; flex-direction: column; gap: 18px; }

.cxt-setting-group { display: flex; flex-direction: column; gap: 7px; }

.cxt-label { font-size: 13px; font-weight: 600; color: #374151; }

.cxt-lang-note { font-size: 12px; color: #0073aa; font-weight: 500; margin: 0; }

.cxt-select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    color: #1e293b;
    background: #f8fafc;
    max-width: 260px;
    outline: none;
    transition: border-color 0.2s;
}
.cxt-select:focus { border-color: #0073aa; background: #fff; }

.cxt-lang-grid {
    display: grid;
    grid-template-columns: repeat( auto-fill, minmax( 150px, 1fr ) );
    gap: 8px;
}

.cxt-lang-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    transition: border-color 0.2s, background 0.2s;
    user-select: none;
}
.cxt-lang-option:hover { border-color: #0073aa; background: #f0f7ff; }
.cxt-lang-option input { accent-color: #0073aa; flex-shrink: 0; }
.cxt-lang-option.cxt-locked { opacity: 0.45; cursor: not-allowed; }

.cxt-text-only-badge {
    font-size: 10px;
    background: #fef3c7;
    color: #92400e;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    margin-left: auto;
}

.cxt-format-row { display: flex; gap: 16px; flex-wrap: wrap; }
.cxt-format-opt { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.cxt-format-opt input { accent-color: #0073aa; }

/* Action bar */
.cxt-action-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

/* Progress */
.cxt-progress { padding: 18px 22px; background: #f0f7ff; border-top: 1px solid #dce8f5; }
.cxt-progress-track { height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.cxt-progress-bar   { height: 100%; background: linear-gradient(90deg, #0073aa, #00a8e8); border-radius: 999px; width: 0%; transition: width 1s ease; }
.cxt-progress-text  { font-size: 13px; color: #0073aa; font-style: italic; text-align: center; margin: 0; }

/* Buttons */
.cxt-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 9px 20px;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.4;
    transition: background 0.18s, transform 0.1s;
    white-space: nowrap;
}
.cxt-btn:active   { transform: scale(0.96); }
.cxt-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.cxt-translate-btn { background: #0073aa; color: #fff; font-size: 15px; padding: 12px 28px; min-width: 140px; justify-content: center; }
.cxt-translate-btn:hover:not(:disabled) { background: #005f8e; }

.cxt-browse-btn { background: #fff; color: #0073aa; border: 2px solid #0073aa; margin-top: 4px; }
.cxt-browse-btn:hover { background: #e0f2fe; }

.cxt-remove-btn { background: transparent; color: #dc2626; border: 1px solid #fecaca; padding: 6px 12px; font-size: 13px; }
.cxt-remove-btn:hover { background: #fef2f2; }

.cxt-copy-btn, .cxt-dl-btn { background: #f1f5f9; color: #374151; border: 1px solid #e2e8f0; padding: 6px 12px; font-size: 12px; }
.cxt-copy-btn:hover, .cxt-dl-btn:hover { background: #e2e8f0; }

.cxt-dl-all-btn { background: #0073aa; color: #fff; font-size: 13px; }
.cxt-dl-all-btn:hover { background: #005f8e; }

/* Status */
.cxt-status       { font-size: 13px; font-style: italic; color: #64748b; flex: 1; }
.cxt-status-error { color: #dc2626; font-weight: 600; font-style: normal; }

/* Results */
.cxt-results { padding: 22px; border-top: 1px solid #e2e8f0; }

.cxt-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}
.cxt-results-header h3 { margin: 0; font-size: 17px; font-weight: 700; color: #16a34a; }

.cxt-result {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    animation: cxt-pop 0.25s ease both;
}
.cxt-result-error { background: #fef2f2; border-color: #fecaca; }
.cxt-result-error h4 { color: #dc2626; margin: 0 0 6px; font-size: 14px; }
.cxt-result-error p  { color: #7f1d1d; font-size: 13px; margin: 0; }

.cxt-result-head {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.cxt-result-head h4 { margin: 0; font-size: 15px; font-weight: 700; color: #1e293b; flex: 1; min-width: 100px; }

/* Tabs */
.cxt-tabs {
    display: flex;
    gap: 3px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 12px;
}
.cxt-tab {
    background: transparent;
    border: none;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s, border-color 0.2s;
    border-radius: 0;
}
.cxt-tab:hover    { color: #0073aa; }
.cxt-tab-active   { color: #0073aa; border-bottom-color: #0073aa; font-weight: 700; }

.cxt-panel        { display: none; }
.cxt-panel-active { display: block; }

.cxt-text-box {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    font-size: 13px;
    line-height: 1.7;
    color: #374151;
    max-height: 260px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.cxt-mono { font-family: monospace; font-size: 12px; }

.cxt-audio { width: 100%; border-radius: 8px; margin-top: 6px; }
.cxt-audio-note { font-size: 12px; color: #64748b; margin: 6px 0 0; }
.cxt-coming-soon { font-size: 13px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 12px 14px; margin: 0; line-height: 1.6; }

.cxt-results-upgrade { padding: 14px 18px; background: #fffbeb; border-top: 1px solid #fde68a; font-size: 13px; color: #92400e; }
.cxt-results-upgrade a { color: #0073aa; font-weight: 600; }

/* Limit box */
.cxt-limit-box {
    margin: 0;
    padding: 26px 22px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    text-align: center;
    border-top: 3px solid #f59e0b;
}
.cxt-limit-title { font-size: 17px; font-weight: 700; color: #fbbf24; margin: 0 0 8px; }
.cxt-limit-sub   { font-size: 14px; color: #cbd5e1; margin: 0 0 20px; }
.cxt-limit-reset { font-size: 12px; color: #64748b; margin: 12px 0 4px; font-style: italic; }
.cxt-payment-note { font-size: 12px; color: #64748b; margin: 4px 0 0; }

.cxt-plans-grid {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.cxt-plan {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 18px 16px;
    min-width: 150px;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cxt-plan-featured { border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245,158,11,0.3); }
.cxt-plan-badge { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: #f59e0b; color: #1e293b; font-size: 10px; font-weight: 700; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.cxt-plan-name  { font-size: 14px; font-weight: 700; color: #f1f5f9; }
.cxt-plan-price { font-size: 20px; font-weight: 700; color: #60a5fa; }
.cxt-plan-price span { font-size: 12px; font-weight: 400; color: #94a3b8; }
.cxt-plan-feat  { font-size: 12px; color: #94a3b8; }
.cxt-plan-btn   { background: #f59e0b; color: #1e293b; font-weight: 700; font-size: 13px; padding: 8px 14px; border-radius: 999px; text-decoration: none; margin-top: 4px; display: block; }
.cxt-plan-btn:hover { background: #fbbf24; }

/* Animation */
@keyframes cxt-pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 540px) {
    .cxt-widget { margin: 10px; border-radius: 14px; }
    .cxt-settings { padding: 0 14px 14px; }
    .cxt-upload-area { margin: 14px; }
    .cxt-results { padding: 14px; }
    .cxt-lang-grid { grid-template-columns: 1fr 1fr; }
    .cxt-action-bar { flex-direction: column; align-items: stretch; }
    .cxt-translate-btn { width: 100%; justify-content: center; }
    .cxt-plans-grid { flex-direction: column; align-items: center; }
    .cxt-plan { width: 100%; max-width: 260px; }
}

/* ── Limit box views ─────────────────────────────────────────── */
.cxt-limit-rule {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 12px 16px;
    margin: 0 0 18px;
    text-align: left;
}
.cxt-limit-rule p {
    font-size: 13px;
    color: #cbd5e1;
    margin: 6px 0 0;
    line-height: 1.5;
}
.cxt-rule-badge {
    font-size: 11px;
    font-weight: 700;
    background: #f59e0b;
    color: #1e293b;
    padding: 2px 10px;
    border-radius: 999px;
}

.cxt-limit-divider {
    text-align: center;
    font-size: 13px;
    color: #475569;
    font-style: italic;
    padding: 14px 0;
}

.cxt-plans-single { justify-content: center; }
.cxt-plans-single .cxt-plan { max-width: 320px; width: 100%; }

.cxt-plan-note {
    font-size: 11px;
    color: #f59e0b;
    line-height: 1.5;
    margin: 2px 0;
}

/* ── Login prompt ────────────────────────────────────────────── */
.cxt-login-prompt {
    padding: 48px 28px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.cxt-login-icon { font-size: 52px; }
.cxt-login-prompt h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}
.cxt-login-prompt p {
    font-size: 14px;
    color: #64748b;
    max-width: 380px;
    line-height: 1.6;
    margin: 0;
}
.cxt-login-btns {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 8px;
}
.cxt-login-note {
    font-size: 12px;
    color: #94a3b8;
    max-width: 340px;
    line-height: 1.6;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    margin-top: 4px;
}

/* ── Receipt instruction ─────────────────────────────────────── */
.cxt-receipt-instruction {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 14px 18px;
    margin: 16px 0 8px;
    text-align: left;
}
.cxt-receipt-instruction p {
    font-size: 13px;
    color: #166534;
    line-height: 1.6;
    margin: 0;
}

/* ── Payment modal ───────────────────────────────────────────── */
.cxt-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.cxt-modal {
    background: #ffffff;
    border-radius: 20px;
    padding: 36px 28px;
    max-width: 460px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0,0,0,0.3);
    animation: cxt-pop 0.25s ease both;
}
.cxt-modal-icon { font-size: 42px; margin-bottom: 12px; }
.cxt-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 6px;
}
.cxt-modal-plan {
    font-size: 14px;
    color: #0073aa;
    font-weight: 600;
    margin: 0 0 18px;
}
.cxt-modal-instruction {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 16px;
    text-align: left;
    margin-bottom: 20px;
}
.cxt-modal-instruction p {
    font-size: 13px;
    color: #374151;
    line-height: 1.6;
    margin: 0 0 6px;
}
.cxt-modal-instruction p:last-child { margin: 0; }
.cxt-modal-email {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #0073aa !important;
    text-align: center;
    padding: 4px 0;
}
.cxt-modal-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Account bar ─────────────────────────────────────────────── */
.cxt-account-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 20px;
    background: #f0f7ff;
    border-bottom: 1px solid #dce8f5;
    font-size: 13px;
}
.cxt-account-greeting {
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cxt-admin-pill {
    font-size: 11px;
    background: #16a34a;
    color: #fff;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 700;
}
.cxt-account-links {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cxt-account-link {
    font-size: 12px;
    font-weight: 600;
    color: #0073aa;
    text-decoration: none;
    transition: color 0.2s;
}
.cxt-account-link:hover { color: #005f8e; }
.cxt-account-sep { color: #cbd5e1; font-size: 12px; }
