/**
 * Text Humanizer Plugin Styles
 * Version: 1.0.0
 */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* CSS Variables */
.text-humanizer-wrapper {
    --th-primary: #6366f1;
    --th-primary-dark: #4f46e5;
    --th-primary-light: #818cf8;
    --th-secondary: #ec4899;
    --th-success: #10b981;
    --th-dark: #0f172a;
    --th-gray-50: #f8fafc;
    --th-gray-100: #f1f5f9;
    --th-gray-200: #e2e8f0;
    --th-gray-300: #cbd5e1;
    --th-gray-400: #94a3b8;
    --th-gray-500: #64748b;
    --th-gray-600: #475569;
    --th-gray-700: #334155;
    --th-gray-800: #1e293b;
    --th-gray-900: #0f172a;
}

/* Main Container */
.text-humanizer-wrapper {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    padding: 0;
    margin: 0 -20px;
}

.text-humanizer-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 90%, rgba(139, 92, 246, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
}

.text-humanizer-wrapper > * {
    position: relative;
    z-index: 2;
}

/* Navigation */
.th-navbar {
    padding: 24px 0;
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.th-nav-content {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.th-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.th-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.th-nav-badge {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Hero Section */
.th-hero {
    text-align: center;
    padding: 80px 24px 60px;
    max-width: 1440px;
    margin: 0 auto;
}

.th-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.th-hero h1 {
    font-size: 4rem;
    font-weight: 800;
    color: white;
    margin-bottom: 24px;
    line-height: 1.1;
    letter-spacing: -2px;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.th-hero p {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 700px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

/* Main Editor */
.th-editor-wrapper {
    max-width: 1440px;
    margin: 0 auto 60px;
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 48px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.th-editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.th-editor-panel {
    position: relative;
}

.th-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.th-panel-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--th-gray-500);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.th-panel-meta {
    display: flex;
    gap: 12px;
    align-items: center;
}

.th-word-count {
    font-size: 0.875rem;
    color: var(--th-gray-500);
    background: var(--th-gray-100);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 500;
}

.th-editor-container {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid var(--th-gray-200);
    transition: all 0.3s ease;
    background: white;
}

.th-editor-container:focus-within {
    border-color: var(--th-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

#th-inputText {
    width: 100%;
    height: 480px;
    padding: 24px;
    border: none;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    resize: none;
    background: transparent;
    color: var(--th-gray-800);
    line-height: 1.8;
}

#th-inputText:focus {
    outline: none;
}

#th-inputText::placeholder {
    color: var(--th-gray-400);
}

.th-output-area {
    width: 100%;
    height: 480px;
    padding: 24px;
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.8;
    white-space: pre-wrap;
    color: var(--th-gray-800);
    background: white;
}

.th-output-area::-webkit-scrollbar {
    width: 10px;
}

.th-output-area::-webkit-scrollbar-track {
    background: var(--th-gray-100);
}

.th-output-area::-webkit-scrollbar-thumb {
    background: var(--th-gray-300);
    border-radius: 5px;
}

.th-output-area::-webkit-scrollbar-thumb:hover {
    background: var(--th-gray-400);
}

.th-output-area.th-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--th-gray-400);
    font-style: italic;
}

/* Action Bar */
.th-action-bar {
    display: flex;
    gap: 16px;
    margin-top: 32px;
    justify-content: center;
}

.th-btn-primary,
.th-btn-secondary,
.th-btn-copy {
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.th-btn-primary {
    background: linear-gradient(135deg, var(--th-primary) 0%, var(--th-primary-dark) 100%);
    color: white;
    box-shadow: 
        0 10px 30px rgba(99, 102, 241, 0.3),
        0 0 0 1px rgba(99, 102, 241, 0.2) inset;
    position: relative;
    overflow: hidden;
}

.th-btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.th-btn-primary:hover:not(:disabled)::before {
    left: 100%;
}

.th-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 
        0 15px 40px rgba(99, 102, 241, 0.4),
        0 0 0 1px rgba(99, 102, 241, 0.2) inset;
}

.th-btn-primary:disabled {
    background: var(--th-gray-300);
    cursor: not-allowed;
    box-shadow: none;
}

.th-btn-secondary {
    background: white;
    color: var(--th-gray-700);
    border: 2px solid var(--th-gray-200);
}

.th-btn-secondary:hover {
    background: var(--th-gray-50);
    border-color: var(--th-gray-300);
    transform: translateY(-2px);
}

.th-btn-copy {
    padding: 6px 14px;
    font-size: 0.875rem;
    background: var(--th-primary);
    color: white;
    border-radius: 8px;
}

.th-btn-copy:hover {
    background: var(--th-primary-dark);
    transform: translateY(-1px);
}

.th-btn-copy.copied {
    background: var(--th-success);
}

/* Loading Animation */
.th-loading-dots {
    display: inline-flex;
    gap: 4px;
}

.th-loading-dots span {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: th-pulse 1.4s infinite ease-in-out;
}

.th-loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.th-loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes th-pulse {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Features Section */
.th-features {
    max-width: 1440px;
    margin: 0 auto 60px;
    padding: 0 24px;
}

.th-features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.th-feature-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 32px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.th-feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.th-feature-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.th-feature-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--th-gray-900);
    margin-bottom: 12px;
}

.th-feature-description {
    font-size: 0.9375rem;
    color: var(--th-gray-600);
    line-height: 1.6;
}

/* Footer */
.th-footer {
    text-align: center;
    padding: 40px 24px;
    color: var(--th-gray-700);
}

.th-footer-text {
    font-size: 0.875rem;
    color: var(--th-gray-700);
    margin-bottom: 8px;
    font-weight: 500;
}

.th-footer-badge {
    font-size: 0.875rem;
    color: var(--th-gray-600);
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .th-editor-grid {
        grid-template-columns: 1fr;
    }

    .th-features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .th-hero h1 {
        font-size: 2.5rem;
    }

    .th-features-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .th-hero h1 {
        font-size: 2rem;
    }

    .th-hero p {
        font-size: 1rem;
    }

    .th-editor-wrapper {
        padding: 24px;
    }

    #th-inputText,
    .th-output-area {
        height: 360px;
    }

    .th-action-bar {
        flex-direction: column;
    }

    .th-btn-primary,
    .th-btn-secondary {
        width: 100%;
    }
}


/* ==============================================
   Professional UI Theme Overrides (v1.1)
   Polished, neutral, theme-friendly styles
   ============================================== */

/* Reset the loud background and layout to blend with the site theme */
.text-humanizer-wrapper {
    --th-container-max: 1600px;
    background: transparent;
    margin: 0;
    min-height: auto;
    padding: 0;
}
/* Full-bleed breakout on desktop: span entire viewport width while inner content stays limited */
@media (min-width: 1024px) {
    .text-humanizer-wrapper {
        width: 100vw;
        max-width: 100vw;
        position: relative;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        left: auto;
        right: auto;
        transform: none;
    }
}
.text-humanizer-wrapper::before { display: none; }

/* Container helpers */
.th-nav-content,
.th-hero,
.th-editor-wrapper { 
    max-width: var(--th-container-max);
}

/* Navbar: clean, subtle */
.th-navbar {
    padding: 16px 0;
    background: #ffffff;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    backdrop-filter: none;
}
.th-logo { color: var(--th-gray-900); text-shadow: none; }
.th-logo-icon {
    background: linear-gradient(180deg, #ffffff, #f5f7fb);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.10);
}
.th-nav-badge {
    color: var(--th-gray-700);
    background: rgba(99, 102, 241, 0.10);
    border: 1px solid rgba(99, 102, 241, 0.20);
}

/* Hero: restrained typography */
.th-hero { padding: 48px 24px 28px; }
.th-hero-badge {
    background: rgba(99, 102, 241, 0.10);
    color: var(--th-gray-700);
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: none;
}
.th-hero h1 {
    font-size: 2.25rem;
    letter-spacing: -0.5px;
    color: var(--th-gray-900);
    text-shadow: none;
}
.th-hero p {
    font-size: 1.0625rem;
    color: var(--th-gray-600);
}

/* Editor card */
.th-editor-wrapper {
    background: #ffffff;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.06);
    border: 1px solid rgba(16, 24, 40, 0.08);
}

/* Grid responsiveness */
.th-editor-grid { gap: 20px; }
@media (max-width: 1024px) { .th-editor-grid { grid-template-columns: 1fr; } }

/* Panel header */
.th-panel-label { color: var(--th-gray-600); letter-spacing: 0.8px; }
.th-word-count { background: var(--th-gray-50); color: var(--th-gray-600); }

/* Textareas and output */
.th-editor-container textarea#th-inputText,
.th-editor-container .th-output-area {
    background: #ffffff;
    border: 1px solid rgba(16, 24, 40, 0.12);
    border-radius: 12px;
    box-shadow: none;
}
.th-editor-container textarea#th-inputText:focus {
    outline: none;
    border-color: var(--th-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.20);
}
.th-output-area {
    color: var(--th-gray-800);
}
.th-output-area.th-empty { color: var(--th-gray-500); }

/* Action bar buttons */
.th-action-bar { gap: 12px; display:flex; align-items:center; flex-wrap: wrap; }
.th-btn-primary {
    background: var(--th-primary);
    color: #fff;
    border: 1px solid var(--th-primary);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}
.th-btn-primary:hover { background: var(--th-primary-dark); border-color: var(--th-primary-dark); }
.th-btn-primary:disabled {
    background: var(--th-gray-300);
    border-color: var(--th-gray-300);
}

.th-btn-secondary {
    background: #ffffff;
    color: var(--th-gray-700);
    border: 1px solid rgba(16, 24, 40, 0.14);
}
.th-btn-secondary:hover { background: var(--th-gray-50); }

/* Export dropdown */
.th-export-group { position: relative; }
.th-export-btn { display:inline-flex; align-items:center; gap:8px; }
.th-menu { position:absolute; top: 110%; right:0; min-width: 220px; background:#fff; border:1px solid rgba(16,24,40,0.12); border-radius:10px; box-shadow: 0 10px 24px rgba(16,24,40,0.12); padding:6px; display:none; z-index: 40; }
.th-menu.open { display:block; }
.th-menu-item { display:block; width:100%; text-align:left; padding:8px 10px; border-radius:8px; border:1px solid transparent; background:#fff; color: var(--th-gray-800); cursor:pointer; }
.th-menu-item:hover, .th-menu-item:focus { background: var(--th-gray-50); outline:none; }
.th-menu-item[disabled] { opacity:0.6; cursor:not-allowed; }

@media (prefers-color-scheme: dark){
  .th-menu { background:#0b1220; border-color: rgba(255,255,255,0.12); box-shadow: 0 10px 24px rgba(0,0,0,0.35); }
  .th-menu-item { background:#0b1220; color:#e2e8f0; }
  .th-menu-item:hover, .th-menu-item:focus { background:#111A2E; }
}

/* Copy button */
.th-btn-copy {
    background: #ffffff;
    color: var(--th-gray-700);
    border: 1px solid rgba(16, 24, 40, 0.14);
}
.th-btn-copy.copied { background: rgba(16, 185, 129, 0.12); color: #065f46; border-color: rgba(16, 185, 129, 0.35); }

/* Feature cards */
.th-features { padding: 8px 24px 0; }
.th-features-grid { gap: 16px; }
.th-feature-card {
    background: #ffffff;
    border: 1px solid rgba(16, 24, 40, 0.08);
    box-shadow: 0 6px 16px rgba(16, 24, 40, 0.05);
}
.th-feature-title { color: var(--th-gray-800); }
.th-feature-description { color: var(--th-gray-600); }

/* Footer */
.th-footer { padding: 24px; }
.th-footer-text { color: var(--th-gray-700); font-weight: 500; }
.th-footer-badge { color: var(--th-gray-600); font-weight: 500; }

/* Loading dots tone down */
.th-loading-dots span {
    background: rgba(255, 255, 255, 0.9);
}

/* Accessible focus everywhere */
.text-humanizer-wrapper button:focus-visible,
.text-humanizer-wrapper a:focus-visible,
.text-humanizer-wrapper textarea:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .th-navbar { background: #0b1220; border-bottom-color: rgba(255,255,255,0.08); }
  .th-logo { color: #f8fafc; }
  .th-nav-badge { color: #e2e8f0; background: rgba(99,102,241,0.18); border-color: rgba(99,102,241,0.35); }
  .th-hero-badge { background: rgba(99,102,241,0.18); color: #e2e8f0; border-color: rgba(99,102,241,0.35); }
  .th-hero h1 { color: #f8fafc; }
  .th-hero p { color: #cbd5e1; }
  .th-editor-wrapper { background: #0f172a; border-color: rgba(255,255,255,0.06); box-shadow: 0 10px 24px rgba(0,0,0,0.35); }
  .th-panel-label { color: #cbd5e1; }
  .th-word-count { background: #0b1220; color: #cbd5e1; }
  .th-editor-container textarea#th-inputText,
  .th-editor-container .th-output-area { background: #0b1220; color: #e2e8f0; border-color: rgba(255,255,255,0.10); }
  .th-output-area.th-empty { color: #94a3b8; }
  .th-btn-secondary, .th-btn-copy { background: #0b1220; color: #e2e8f0; border-color: rgba(255,255,255,0.12); }
  .th-feature-card { background: #0b1220; border-color: rgba(255,255,255,0.10); box-shadow: 0 6px 16px rgba(0,0,0,0.25); }
  .th-feature-title { color: #f1f5f9; }
  .th-feature-description { color: #cbd5e1; }
  .th-footer-text { color: #e2e8f0; font-weight: 500; }
  .th-footer-badge { color: #cbd5e1; font-weight: 500; }
}


/* ==============================================
   UI tweak: remove hero badge pill per request
   ============================================== */
.text-humanizer-wrapper .th-hero-badge { display: none !important; }


/* ==============================================
   UI tweak: remove top navbar and entire hero section per request
   ============================================== */
.text-humanizer-wrapper .th-navbar { display: none !important; }
.text-humanizer-wrapper .th-hero { display: none !important; }


/* ==============================================
   Tone selector styles
   ============================================== */
.text-humanizer-wrapper .th-options-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 12px;
}
.text-humanizer-wrapper .th-options-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--th-gray-600);
}
.text-humanizer-wrapper .th-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 8px 12px;
    border: 1px solid rgba(16, 24, 40, 0.14);
    border-radius: 8px;
    background: #ffffff;
    color: var(--th-gray-800);
    font-size: 0.9375rem;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.text-humanizer-wrapper .th-select:focus {
    outline: none;
    border-color: var(--th-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.20);
}
@media (max-width: 640px) {
    .text-humanizer-wrapper .th-options-bar {
        flex-wrap: wrap;
    }
    .text-humanizer-wrapper .th-options-label {
        width: 100%;
    }
    .text-humanizer-wrapper .th-select {
        width: 100%;
    }
}

@media (prefers-color-scheme: dark) {
  .text-humanizer-wrapper .th-select {
    background: #0b1220;
    color: #e2e8f0;
    border-color: rgba(255,255,255,0.12);
  }
}


/* ==============================================
   Intensity control (range) styles
   ============================================== */
.text-humanizer-wrapper .th-range-wrap {
    display: inline-flex;
    flex-direction: column;
    gap: 8px;
    min-width: 220px;
}
.text-humanizer-wrapper .th-range {
    -webkit-appearance: none;
    appearance: none;
    width: 220px;
    height: 6px;
    background: var(--th-gray-200);
    border-radius: 999px;
    outline: none;
    border: 1px solid rgba(16, 24, 40, 0.10);
}
.text-humanizer-wrapper .th-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--th-primary);
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.20);
    cursor: pointer;
}
.text-humanizer-wrapper .th-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--th-primary);
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.20);
    cursor: pointer;
}
.text-humanizer-wrapper .th-range:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.20);
}
.text-humanizer-wrapper .th-range-markers {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--th-gray-600);
}
.text-humanizer-wrapper .th-intensity-value {
    font-size: 0.875rem;
    color: var(--th-gray-700);
    margin-left: 8px;
}

@media (max-width: 640px) {
  .text-humanizer-wrapper .th-range { width: 100%; }
}

@media (prefers-color-scheme: dark) {
  .text-humanizer-wrapper .th-range { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.10); }
  .text-humanizer-wrapper .th-range-markers { color: #cbd5e1; }
  .text-humanizer-wrapper .th-intensity-value { color: #e2e8f0; }
}

/* ==============================================
   Analysis panel styles
   ============================================== */
.text-humanizer-wrapper .th-analysis {
  margin: 16px auto 0;
  max-width: var(--th-container-max);
  padding: 16px 24px 8px;
  background: #ffffff;
  border: 1px solid rgba(16,24,40,0.08);
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(16,24,40,0.05);
}
.text-humanizer-wrapper .th-analysis-header{
  display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px;
}
.text-humanizer-wrapper .th-tabs{display:flex;gap:8px;}
.text-humanizer-wrapper .th-tab{
  appearance:none;border:1px solid rgba(16,24,40,0.12);background:#fff;color:var(--th-gray-900);
  padding:6px 12px;border-radius:8px;font-weight:600;font-size:0.9rem;cursor:pointer;
  transition: all 0.2s ease;
}
.text-humanizer-wrapper .th-tab:hover{background:var(--th-gray-50);color:var(--th-gray-900);} 
.text-humanizer-wrapper .th-tab:focus{outline:none;box-shadow:0 0 0 3px rgba(99,102,241,0.20);} 
.text-humanizer-wrapper .th-tab-active{background:var(--th-primary);border-color:var(--th-primary);color:#fff;}
.text-humanizer-wrapper .th-highlight-toggle{display:flex;align-items:center;gap:8px;color:var(--th-gray-700);font-size:0.9rem;}
.text-humanizer-wrapper .th-tabpanels{border-top:1px dashed rgba(16,24,40,0.10);padding-top:12px;}
.text-humanizer-wrapper .th-tabpanel{display:none;}
.text-humanizer-wrapper .th-tabpanel-active{display:block;}
.text-humanizer-wrapper .th-metric-block{margin-bottom:12px;}
.text-humanizer-wrapper .th-metric-title{font-size:0.95rem;color:var(--th-gray-900);margin:0 0 6px;font-weight:700;}
.text-humanizer-wrapper .th-metric-body{font-size:0.93rem;color:var(--th-gray-900);font-weight:500;} 
.text-humanizer-wrapper .th-badge{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;font-weight:600;font-size:0.85rem;border:1px solid transparent;}
.text-humanizer-wrapper .th-badge-good{background:rgba(16,185,129,0.12);color:#065f46;border-color:rgba(16,185,129,0.35);} 
.text-humanizer-wrapper .th-badge-warn{background:rgba(245,158,11,0.12);color:#7c2d12;border-color:rgba(245,158,11,0.35);} 
.text-humanizer-wrapper .th-badge-poor{background:rgba(239,68,68,0.12);color:#7f1d1d;border-color:rgba(239,68,68,0.35);} 
.text-humanizer-wrapper .th-metrics-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;}
.text-humanizer-wrapper .th-metric-tile{background:#fff;border:1px solid rgba(16,24,40,0.08);border-radius:10px;padding:10px 12px;}
.text-humanizer-wrapper .th-metric-label{color:var(--th-gray-700);font-size:0.8rem;margin-bottom:4px;font-weight:600;}
.text-humanizer-wrapper .th-metric-value{font-weight:800;color:var(--th-gray-900);font-size:1rem;} 
.text-humanizer-wrapper .th-keyword-table{width:100%;border-collapse:collapse;font-size:0.9rem;}
.text-humanizer-wrapper .th-keyword-table th,
.text-humanizer-wrapper .th-keyword-table td{border-bottom:1px solid rgba(16,24,40,0.08);padding:6px 8px;text-align:left;}
.text-humanizer-wrapper .th-row-flag{background:rgba(239,68,68,0.06);} 
.text-humanizer-wrapper .th-meter{height:8px;background:var(--th-gray-200);border-radius:999px;overflow:hidden;}
.text-humanizer-wrapper .th-meter > span{display:block;height:100%;background:linear-gradient(90deg,#ef4444,#f59e0b,#10b981);} 
.text-humanizer-wrapper .th-keyword-flag{background:rgba(245,158,11,0.18);border-bottom:1px dotted rgba(245,158,11,0.8);} 

@media (max-width: 900px){
  .text-humanizer-wrapper .th-metrics-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media (max-width: 520px){
  .text-humanizer-wrapper .th-metrics-grid{grid-template-columns:1fr;}
}

@media (prefers-color-scheme: dark){
  .text-humanizer-wrapper .th-analysis{background:#0b1220;border-color:rgba(255,255,255,0.10);box-shadow:0 6px 16px rgba(0,0,0,0.25);} 
  .text-humanizer-wrapper .th-tab{background:#0b1220;color:#f1f5f9;border-color:rgba(255,255,255,0.20);} 
  .text-humanizer-wrapper .th-tab:hover{background:#111A2E;color:#f8fafc;} 
  .text-humanizer-wrapper .th-tab-active{background:var(--th-primary);border-color:var(--th-primary);color:#fff;} 
  .text-humanizer-wrapper .th-metric-title{color:#f1f5f9;font-weight:700;} 
  .text-humanizer-wrapper .th-metric-body{color:#f8fafc;font-weight:500;} 
  .text-humanizer-wrapper .th-metric-tile{background:#0b1220;border-color:rgba(255,255,255,0.10);} 
  .text-humanizer-wrapper .th-metric-label{color:#cbd5e1;font-weight:600;} 
  .text-humanizer-wrapper .th-metric-value{color:#f8fafc;font-weight:800;} 
  .text-humanizer-wrapper .th-keyword-table th,
  .text-humanizer-wrapper .th-keyword-table td{border-bottom-color:rgba(255,255,255,0.12);color:#e2e8f0;} 
  .text-humanizer-wrapper .th-keyword-flag{background:rgba(245,158,11,0.24);}
}
/* ==============================================
   History & Analytics panels
   ============================================== */
.text-humanizer-wrapper .th-history,
.text-humanizer-wrapper .th-analytics,
.text-humanizer-wrapper .th-suggestions {
  margin: 16px auto 0;
  max-width: var(--th-container-max);
  padding: 16px 24px 12px;
  background: #ffffff;
  border: 1px solid rgba(16,24,40,0.08);
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(16,24,40,0.05);
}
.text-humanizer-wrapper .th-history-header,
.text-humanizer-wrapper .th-suggestions-header {
  display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px;
}
.text-humanizer-wrapper .th-history-title,
.text-humanizer-wrapper .th-suggestions-title { font-weight:800; color: var(--th-gray-800); }
.text-humanizer-wrapper .th-history-filters,
.text-humanizer-wrapper .th-suggestions-actions { display:flex; align-items:center; gap:8px; }
.text-humanizer-wrapper .th-checkbox-inline { display:flex; align-items:center; gap:6px; font-size:0.9rem; color: var(--th-gray-700); }
.text-humanizer-wrapper .th-empty-note { color: var(--th-gray-600); font-size:0.95rem; padding: 8px 0; }

/* History list */
.text-humanizer-wrapper .th-history-list { display:flex; flex-direction:column; gap:10px; }
.text-humanizer-wrapper .th-history-item { display:flex; justify-content:space-between; gap:12px; border:1px solid rgba(16,24,40,0.08); border-radius:10px; padding:10px 12px; }
.text-humanizer-wrapper .th-history-meta { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:6px; }
.text-humanizer-wrapper .th-history-preview { color: var(--th-gray-700); font-size:0.95rem; }
.text-humanizer-wrapper .th-history-actions { display:flex; gap:8px; align-items:center; }
@media (max-width: 700px){
  .text-humanizer-wrapper .th-history-item { flex-direction:column; }
  .text-humanizer-wrapper .th-history-actions { justify-content:flex-end; }
}

/* Analytics tiles */
.text-humanizer-wrapper .th-tiles-grid { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:12px; }
.text-humanizer-wrapper .th-tile { background:#fff; border:1px solid rgba(16,24,40,0.08); border-radius:10px; padding:10px 12px; }
.text-humanizer-wrapper .th-tile-label { color: var(--th-gray-600); font-size:0.82rem; margin-bottom:4px; }
.text-humanizer-wrapper .th-tile-value { color: var(--th-gray-900); font-weight:800; font-size:1.05rem; }
@media (max-width: 900px){ .text-humanizer-wrapper .th-tiles-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 520px){ .text-humanizer-wrapper .th-tiles-grid { grid-template-columns: 1fr; } }

/* Suggestions */
.text-humanizer-wrapper .th-suggest-chips { display:flex; flex-wrap:wrap; gap:8px; }
.text-humanizer-wrapper .th-suggest-chip { display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border-radius:999px; font-size:0.88rem; border:1px dashed rgba(245,158,11,0.55); background: rgba(245,158,11,0.10); color:#7c2d12; }
.text-humanizer-wrapper .th-suggest-chip .th-action { cursor:pointer; color: var(--th-primary); font-weight:700; margin-left:4px; }

@media (prefers-color-scheme: dark){
  .text-humanizer-wrapper .th-history,
  .text-humanizer-wrapper .th-analytics,
  .text-humanizer-wrapper .th-suggestions { background:#0b1220; border-color: rgba(255,255,255,0.10); box-shadow: 0 6px 16px rgba(0,0,0,0.25); }
  .text-humanizer-wrapper .th-history-item { background:#0b1220; border-color: rgba(255,255,255,0.12); }
  .text-humanizer-wrapper .th-history-title,
  .text-humanizer-wrapper .th-suggestions-title { color: #e2e8f0; }
  .text-humanizer-wrapper .th-history-preview { color: #e2e8f0; }
  .text-humanizer-wrapper .th-tile { background:#0b1220; border-color: rgba(255,255,255,0.10); }
  .text-humanizer-wrapper .th-tile-label { color: #cbd5e1; }
  .text-humanizer-wrapper .th-tile-value { color: #f8fafc; }
  .text-humanizer-wrapper .th-suggest-chip { background: rgba(245,158,11,0.20); border-color: rgba(245,158,11,0.65); color: #fde68a; }
}

/* ==============================================
   Advanced Options: Custom Prompt & Vocabulary
   ============================================== */
.text-humanizer-wrapper .th-advanced-options {
  margin: 20px 0;
  border: 1px solid rgba(16,24,40,0.08);
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}
.text-humanizer-wrapper .th-advanced-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--th-gray-50);
  border: none;
  border-bottom: 1px solid rgba(16,24,40,0.08);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--th-gray-900);
  transition: background 0.2s ease;
}
.text-humanizer-wrapper .th-advanced-toggle:hover {
  background: var(--th-gray-100);
}
.text-humanizer-wrapper .th-advanced-toggle .th-toggle-icon {
  transition: transform 0.2s ease;
  font-size: 0.8rem;
  color: var(--th-gray-600);
}
.text-humanizer-wrapper .th-advanced-panel {
  padding: 20px;
  background: #ffffff;
}
.text-humanizer-wrapper .th-advanced-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(16,24,40,0.08);
}
.text-humanizer-wrapper .th-advanced-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.text-humanizer-wrapper .th-advanced-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.text-humanizer-wrapper .th-advanced-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--th-gray-900);
  margin: 0;
}
.text-humanizer-wrapper .th-btn-icon {
  background: transparent;
  border: 1px solid rgba(16,24,40,0.12);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--th-gray-700);
  transition: all 0.2s ease;
}
.text-humanizer-wrapper .th-btn-icon:hover {
  background: var(--th-gray-50);
  border-color: var(--th-gray-300);
}

/* Prompt Builder */
.text-humanizer-wrapper .th-prompt-presets {
  margin-bottom: 16px;
}
.text-humanizer-wrapper .th-prompt-editor {
  margin-top: 12px;
}
.text-humanizer-wrapper .th-prompt-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(16,24,40,0.14);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--th-gray-900);
  background: #ffffff;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.text-humanizer-wrapper .th-prompt-textarea:focus {
  outline: none;
  border-color: var(--th-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.20);
}
.text-humanizer-wrapper .th-prompt-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}
.text-humanizer-wrapper .th-prompt-actions .th-select {
  min-width: 200px;
}

/* Vocabulary Protection */
.text-humanizer-wrapper .th-vocab-protection {
  transition: opacity 0.2s ease;
}
.text-humanizer-wrapper .th-vocab-mode {
  margin-bottom: 16px;
}
.text-humanizer-wrapper .th-vocab-input {
  margin-top: 12px;
}
.text-humanizer-wrapper .th-vocab-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(16,24,40,0.14);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--th-gray-900);
  background: #ffffff;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.text-humanizer-wrapper .th-vocab-textarea:focus {
  outline: none;
  border-color: var(--th-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.20);
}
.text-humanizer-wrapper .th-vocab-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}
.text-humanizer-wrapper .th-vocab-actions .th-select {
  min-width: 200px;
}

@media (prefers-color-scheme: dark) {
  .text-humanizer-wrapper .th-advanced-options {
    background: #0b1220;
    border-color: rgba(255,255,255,0.10);
  }
  .text-humanizer-wrapper .th-advanced-toggle {
    background: #111A2E;
    border-bottom-color: rgba(255,255,255,0.10);
    color: #f1f5f9;
  }
  .text-humanizer-wrapper .th-advanced-toggle:hover {
    background: #1a2332;
  }
  .text-humanizer-wrapper .th-advanced-panel {
    background: #0b1220;
  }
  .text-humanizer-wrapper .th-advanced-section {
    border-bottom-color: rgba(255,255,255,0.10);
  }
  .text-humanizer-wrapper .th-advanced-title {
    color: #f1f5f9;
  }
  .text-humanizer-wrapper .th-btn-icon {
    background: #111A2E;
    border-color: rgba(255,255,255,0.12);
    color: #e2e8f0;
  }
  .text-humanizer-wrapper .th-btn-icon:hover {
    background: #1a2332;
    border-color: rgba(255,255,255,0.20);
  }
  .text-humanizer-wrapper .th-prompt-textarea,
  .text-humanizer-wrapper .th-vocab-textarea {
    background: #0b1220;
    border-color: rgba(255,255,255,0.12);
    color: #e2e8f0;
  }
  .text-humanizer-wrapper .th-prompt-textarea:focus,
  .text-humanizer-wrapper .th-vocab-textarea:focus {
    border-color: var(--th-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.30);
  }
}
