/**
 * TunerSuite Translation Community Editor — Premium Dark Theme
 * @package TunerSuite_License_Hub
 * @since   2.3.0
 *
 * Palette
 *   Surface-0 (page bg):  inherit from WooCommerce theme
 *   Surface-1 (cards):    #131c2e
 *   Surface-2 (inputs):   #0c1322
 *   Surface-3 (hover):    #1a2540
 *   Border:               rgba(255,255,255,0.06)
 *   Border-hover:         rgba(255,255,255,0.12)
 *   Accent:               #FF6B00
 *   Accent-glow:          rgba(255,107,0,0.15)
 *   Text-1:               #f1f5f9
 *   Text-2:               #94a3b8
 *   Text-3:               #64748b
 *   Success:              #22c55e
 *   Warning:              #eab308
 *   Danger:               #ef4444
 */

/* ====================================================================
   RESET — scope everything under .ts-te-wrap so WP styles don't leak
   ==================================================================== */
.ts-te-wrap,
.ts-te-wrap *,
.ts-te-wrap *::before,
.ts-te-wrap *::after {
    box-sizing: border-box;
}
.ts-te-wrap {
    max-width: 1260px;
    margin: 0 auto;
    padding: 0 0 80px;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #f1f5f9;
    line-height: 1.5;
}

/* ====================================================================
   HEADER
   ==================================================================== */
.ts-te-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 28px 28px 24px;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #131c2e 0%, #0f1829 100%);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}
/* subtle top-accent line */
.ts-te-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #FF6B00, #ff8f3f, #FF6B00);
    border-radius: 16px 16px 0 0;
}

.ts-te-title {
    margin: 0 0 4px;
    font-size: 1.35rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #f1f5f9;
}
.ts-te-icon {
    color: #FF6B00;
    flex-shrink: 0;
}
.ts-te-subtitle {
    margin: 0;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 400;
}

/* Stats pills */
.ts-te-user-stats {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    margin-top: 4px;
}
.ts-te-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.ts-te-stat-count {
    font-weight: 800;
    font-size: 0.9rem;
}
.ts-te-stat-pending {
    background: rgba(234,179,8,0.1);
    color: #eab308;
    border: 1px solid rgba(234,179,8,0.2);
}
.ts-te-stat-approved {
    background: rgba(34,197,94,0.1);
    color: #22c55e;
    border: 1px solid rgba(34,197,94,0.2);
}

/* ====================================================================
   CONTROLS BAR
   ==================================================================== */
.ts-te-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.ts-te-controls-left {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}
.ts-te-controls-right {
    flex-shrink: 0;
}
.ts-te-result-count {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
}

/* Select & Input shared */
.ts-te-select,
.ts-te-input {
    background: #131c2e;
    border: 1px solid rgba(255,255,255,0.08);
    color: #f1f5f9;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}
.ts-te-select:focus,
.ts-te-input:focus {
    border-color: #FF6B00;
    outline: none;
    box-shadow: 0 0 0 3px rgba(255,107,0,0.15);
}
.ts-te-select {
    min-width: 220px;
    padding-right: 36px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.ts-te-select option {
    background: #131c2e;
    color: #f1f5f9;
}
.ts-te-search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}
.ts-te-search-wrap .ts-te-input {
    width: 100%;
    padding-left: 38px;
}
.ts-te-search-wrap::before {
    content: '';
    position: absolute;
    top: 50%; left: 12px;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 10-1.397 1.398h-.001l3.85 3.85a1 1 0 001.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 110-10 5 5 0 010 10z'/%3E%3C/svg%3E");
    background-size: contain;
    pointer-events: none;
}

/* ====================================================================
   TABLE WRAPPER
   ==================================================================== */
.ts-te-table-wrap {
    background: #131c2e;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    overflow: hidden;
    min-height: 120px;
}

/* ====================================================================
   EMPTY STATE
   ==================================================================== */
.ts-te-empty-state {
    text-align: center;
    padding: 64px 24px;
    color: #475569;
}
.ts-te-empty-state svg {
    opacity: 0.25;
    margin-bottom: 12px;
}
.ts-te-empty-state p {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
}

/* ====================================================================
   LOADING SPINNER
   ==================================================================== */
.ts-te-loading {
    text-align: center;
    padding: 48px 16px;
    color: #64748b;
    font-size: 0.85rem;
}
.ts-te-spinner {
    display: inline-block;
    width: 32px; height: 32px;
    border: 3px solid rgba(255,107,0,0.15);
    border-top-color: #FF6B00;
    border-radius: 50%;
    animation: ts-te-spin 0.7s linear infinite;
    margin-bottom: 10px;
}
@keyframes ts-te-spin { to { transform: rotate(360deg); } }

/* ====================================================================
   TABLE
   ==================================================================== */
.ts-te-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.ts-te-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #0e1726;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    white-space: nowrap;
}
/* Column widths (fixed layout) */
.ts-te-col-english   { width: 34%; }
.ts-te-col-current   { width: 28%; }
.ts-te-col-suggestion { width: 38%; }

.ts-te-table tbody td {
    padding: 14px 18px;
    vertical-align: top;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.855rem;
}
.ts-te-table tbody tr:hover td {
    background: rgba(255,107,0,0.02);
}
.ts-te-table tbody tr:last-child td {
    border-bottom: none;
}

/* Cell content */
.ts-te-english {
    color: #e2e8f0;
    line-height: 1.55;
    word-break: break-word;
}
.ts-te-current {
    color: #7c8ba5;
    line-height: 1.55;
    word-break: break-word;
    font-style: italic;
}
.ts-te-expand-btn {
    background: none;
    border: none;
    color: #FF6B00;
    cursor: pointer;
    font-size: 0.72rem;
    padding: 0;
    font-weight: 600;
}
.ts-te-expand-btn:hover { color: #ff8f3f; }

/* ====================================================================
   SUGGESTION TEXTAREA
   ==================================================================== */
.ts-te-suggestion {
    width: 100%;
    min-height: 56px;
    resize: vertical;
    background: #0c1322;
    border: 1px solid rgba(255,255,255,0.08);
    color: #f1f5f9;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.855rem;
    font-family: inherit;
    line-height: 1.5;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.ts-te-suggestion:focus {
    border-color: #FF6B00;
    outline: none;
    box-shadow: 0 0 0 3px rgba(255,107,0,0.12);
}
.ts-te-suggestion::placeholder {
    color: #3e4a5e;
    font-style: italic;
}

/* ====================================================================
   STATUS BADGES
   ==================================================================== */
.ts-te-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.ts-te-badge-pending {
    background: rgba(234,179,8,0.12);
    color: #eab308;
    border: 1px solid rgba(234,179,8,0.25);
}
.ts-te-badge-approved {
    background: rgba(34,197,94,0.12);
    color: #22c55e;
    border: 1px solid rgba(34,197,94,0.25);
}
.ts-te-badge-rejected {
    background: rgba(239,68,68,0.12);
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.25);
}

/* ====================================================================
   PAGINATION
   ==================================================================== */
.ts-te-pagination {
    padding: 18px 20px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.ts-te-page-info {
    color: #64748b;
    font-size: 0.8rem;
}
.ts-te-page-buttons {
    display: flex;
    gap: 4px;
}
.ts-te-page-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.08);
    color: #94a3b8;
    padding: 6px 13px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.ts-te-page-btn:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.15);
    color: #f1f5f9;
}
.ts-te-page-btn.active {
    background: #FF6B00;
    color: #fff;
    border-color: #FF6B00;
    font-weight: 700;
}

/* ====================================================================
   FLOATING SAVE BAR
   ==================================================================== */
.ts-te-save-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 9990;
    background: linear-gradient(180deg, #0e1726 0%, #0b1220 100%);
    border-top: 2px solid #FF6B00;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.ts-te-save-bar.visible {
    transform: translateY(0);
}
.ts-te-save-bar-inner {
    max-width: 1260px;
    margin: 0 auto;
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ts-te-change-count {
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 500;
}
.ts-te-btn-save {
    background: #FF6B00;
    color: #fff;
    border: none;
    padding: 11px 28px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}
.ts-te-btn-save:hover {
    background: #e05f00;
    box-shadow: 0 4px 16px rgba(255,107,0,0.3);
}
.ts-te-btn-save:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}
.ts-te-btn-spinner {
    display: inline-flex;
    align-items: center;
}
.ts-te-spin {
    animation: ts-te-spin 0.7s linear infinite;
}

/* ====================================================================
   TOAST
   ==================================================================== */
.ts-te-toast {
    position: fixed;
    top: 24px; right: 24px;
    padding: 14px 22px;
    border-radius: 10px;
    z-index: 99999;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.3s, transform 0.3s;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    max-width: 380px;
}
.ts-te-toast-visible {
    opacity: 1;
    transform: translateY(0);
}
.ts-te-toast-success { background: linear-gradient(135deg, #16a34a, #22c55e); }
.ts-te-toast-error   { background: linear-gradient(135deg, #dc2626, #ef4444); }

/* ====================================================================
   MY CONTRIBUTIONS (collapsible)
   ==================================================================== */
.ts-te-contributions {
    margin-top: 28px;
}
.ts-te-contributions-toggle {
    background: #131c2e;
    border: 1px solid rgba(255,255,255,0.06);
    color: #94a3b8;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    width: 100%;
    justify-content: flex-start;
}
.ts-te-contributions-toggle:hover {
    background: #1a2540;
    border-color: rgba(255,255,255,0.1);
    color: #f1f5f9;
}
.ts-te-contributions-toggle svg {
    transition: transform 0.2s;
    flex-shrink: 0;
}
.ts-te-contributions-toggle.open svg {
    transform: rotate(180deg);
}
.ts-te-contributions-badge {
    background: rgba(255,107,0,0.12);
    color: #FF6B00;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    margin-left: auto;
}
.ts-te-contributions-body {
    margin-top: 12px;
    background: #131c2e;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    overflow: hidden;
}
.ts-te-contributions-table {
    width: 100%;
    border-collapse: collapse;
}
.ts-te-contributions-table thead th {
    background: #0e1726;
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ts-te-contributions-table tbody td {
    padding: 11px 16px;
    font-size: 0.82rem;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: top;
}
.ts-te-contributions-table tbody tr:hover td {
    background: rgba(255,107,0,0.02);
}
.ts-te-contributions-table tbody tr:last-child td {
    border-bottom: none;
}
.ts-te-empty-contributions {
    text-align: center;
    padding: 32px 20px;
    color: #475569;
    font-size: 0.85rem;
}

/* ====================================================================
   RESPONSIVE
   ==================================================================== */
@media (max-width: 768px) {
    .ts-te-wrap { padding: 0 0 70px; }
    .ts-te-header {
        flex-direction: column;
        padding: 20px;
        gap: 14px;
    }
    .ts-te-user-stats { width: 100%; }
    .ts-te-controls { flex-direction: column; }
    .ts-te-controls-left { flex-direction: column; width: 100%; }
    .ts-te-select { width: 100%; min-width: unset; }
    .ts-te-search-wrap { max-width: none; min-width: unset; width: 100%; }
    .ts-te-table { table-layout: auto; }
    .ts-te-table thead th,
    .ts-te-table tbody td { padding: 10px 12px; font-size: 0.8rem; }
    .ts-te-suggestion { min-height: 48px; }
    .ts-te-save-bar-inner {
        flex-direction: column;
        gap: 10px;
        padding: 12px 20px;
        text-align: center;
    }
    .ts-te-btn-save { width: 100%; justify-content: center; }
    .ts-te-pagination { flex-direction: column; align-items: center; }
}
@media (max-width: 480px) {
    .ts-te-col-current,
    .ts-te-table thead th:nth-child(2),
    .ts-te-table tbody td:nth-child(2) { display: none; }
    .ts-te-col-english { width: 45%; }
    .ts-te-col-suggestion { width: 55%; }
}
