/* Englix Pro — Flat design, Ripro-aligned palette */

.englix-wrap {
    --ex-primary: #2271b1;
    --ex-primary-light: #3582c4;
    --ex-bg: #f0f2f5;
    --ex-surface: #ffffff;
    --ex-border: #e8eaed;
    --ex-text: #1d2327;
    --ex-muted: #646970;
    --ex-radius: 8px;
    --ex-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.englix-wrap {
    background: var(--ex-bg);
    padding-bottom: 3rem;
}

/* Hero — Ripro archive-hero compatible */
.englix-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 0;
    border-bottom: none;
}

.englix-hero.has-default-bg {
    background: linear-gradient(135deg, #153e6b 0%, #2271b1 45%, #3582c4 100%);
}

.englix-hero.has-custom-bg {
    background: #1a1a2e;
}

.englix-hero .archive-hero-bg,
.englix-hero-bg {
    display: block;
}

.englix-hero-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.englix-hero.has-custom-bg .englix-hero-overlay {
    background: rgba(15, 15, 16, calc(var(--englix-hero-overlay, 55) / 100));
}

.englix-hero.has-default-bg .englix-hero-overlay {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.18) 100%);
}

.englix-hero .container {
    position: relative;
    z-index: 2;
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
}

.englix-hero-badge {
    display: inline-block;
    padding: 0.25rem 0.85rem;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.englix-hero .archive-title {
    font-size: 1.85rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.englix-hero-desc,
.englix-hero .archive-desc {
    color: rgba(255, 255, 255, 0.88) !important;
    font-size: 1rem;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
}

.englix-flag-wave {
    animation: none;
}

/* App shell */
.englix-app {
    max-width: 960px;
    margin: 0 auto;
}

/* Topbar */
.englix-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: var(--ex-radius);
    padding: 0.875rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--ex-shadow);
}

.englix-topbar-balance {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.englix-topbar-balance i {
    color: var(--ex-primary);
    font-size: 1.1rem;
}

.englix-topbar-label,
.englix-topbar-unit {
    color: var(--ex-muted);
}

.englix-topbar-balance strong {
    font-size: 1.25rem;
    color: var(--ex-text);
    font-weight: 700;
}

/* Main nav */
.englix-main-nav {
    display: flex;
    gap: 0;
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: var(--ex-radius);
    padding: 4px;
    margin-bottom: 1rem;
}

.englix-main-nav-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ex-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.englix-main-nav-btn i {
    margin-right: 0.35rem;
}

.englix-main-nav-btn.is-active {
    background: var(--ex-primary);
    color: #fff;
}

.englix-main-nav-btn:not(.is-active):hover {
    background: #f6f7f7;
    color: var(--ex-text);
}

/* Panels */
.englix-panel {
    display: none;
}

.englix-panel.is-active {
    display: block;
}

/* Grid layout */
.englix-grid {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 991.98px) {
    .englix-grid {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.englix-card {
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: var(--ex-radius);
    box-shadow: var(--ex-shadow);
}

.englix-card-main {
    padding: 1.25rem 1.5rem;
}

.englix-card-aside {
    padding: 1.25rem;
    align-self: start;
}

.englix-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.englix-card-head h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--ex-text);
}

.englix-cost-pill {
    font-size: 0.8rem;
    padding: 0.25rem 0.65rem;
    background: #fff8e6;
    color: #996800;
    border-radius: 4px;
    font-weight: 500;
}

/* Segmented tabs */
.englix-seg-tabs {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    background: #f6f7f7;
    border-radius: 6px;
    padding: 3px;
    gap: 3px;
}

.englix-seg-tabs button {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ex-muted);
    border-radius: 4px;
    cursor: pointer;
}

.englix-seg-tabs button.is-active {
    background: var(--ex-surface);
    color: var(--ex-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.englix-tab-pane {
    display: none;
}

.englix-tab-pane.is-active {
    display: block;
}

.englix-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ex-text);
    margin-bottom: 0.5rem;
}

.englix-input,
.englix-textarea {
    border-radius: 6px;
    border-color: var(--ex-border);
    font-size: 0.95rem;
}

.englix-input:focus,
.englix-textarea:focus {
    border-color: var(--ex-primary);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.12);
}

.englix-textarea {
    min-height: 120px;
    resize: vertical;
}

/* Style chips */
.englix-style-section {
    margin-top: 1.25rem;
}

.englix-style-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

@media (max-width: 575.98px) {
    .englix-style-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.englix-style-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0.5rem;
    border: 1px solid var(--ex-border);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    margin: 0;
    background: #fafafa;
}

.englix-style-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.englix-style-chip:hover {
    border-color: var(--ex-primary-light);
}

.englix-style-chip.is-active {
    border-color: var(--ex-primary);
    background: rgba(34, 113, 177, 0.06);
}

.englix-style-chip-flag {
    font-size: 1.5rem;
    line-height: 1;
}

.englix-style-chip-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ex-text);
    margin-top: 0.25rem;
}

/* Action */
.englix-action-row {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--ex-border);
}

.englix-generate-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 6px;
    background-color: #2271b1 !important;
    border-color: #2271b1 !important;
    color: #fff !important;
}

.englix-generate-btn:hover:not(:disabled),
.englix-generate-btn:focus:not(:disabled),
.englix-generate-btn:active:not(:disabled) {
    background-color: #3582c4 !important;
    border-color: #3582c4 !important;
    color: #fff !important;
}

.englix-generate-btn:disabled {
    opacity: 0.55;
    background-color: #2271b1 !important;
    border-color: #2271b1 !important;
}

/* Aside */
.englix-aside-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    color: var(--ex-text);
}

.englix-aside-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.82rem;
    color: var(--ex-muted);
}

.englix-aside-list li {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--ex-border);
}

.englix-aside-list li:last-child {
    border-bottom: none;
}

.englix-aside-list span {
    margin-right: 0.35rem;
}

.englix-aside-note {
    font-size: 0.8rem;
    color: var(--ex-muted);
    margin: 0;
}

/* Section head */
.englix-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.englix-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: var(--ex-text);
}

.englix-section-desc {
    font-size: 0.85rem;
    color: var(--ex-muted);
    margin: 0.25rem 0 1rem;
}

/* Tags */
.englix-tag {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.2rem 0.55rem;
    background: rgba(34, 113, 177, 0.1);
    color: var(--ex-primary);
    border-radius: 4px;
    font-weight: 500;
}

.englix-tag.is-muted {
    background: #f0f0f1;
    color: var(--ex-muted);
}

/* Reply cards */
.englix-replies-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

@media (max-width: 767.98px) {
    .englix-replies-grid {
        grid-template-columns: 1fr;
    }
}

.englix-reply-card {
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: var(--ex-radius);
    padding: 1rem 1.15rem;
    box-shadow: var(--ex-shadow);
}

.englix-reply-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.englix-reply-tone {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ex-muted);
}

.englix-reply-emoji {
    font-size: 1.1rem;
}

.englix-reply-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--ex-text);
    margin: 0 0 0.75rem;
    word-break: break-word;
}

.englix-copy-btn.copied {
    background: #198754;
    border-color: #198754;
    color: #fff;
}

.englix-results {
    animation: englixFadeIn 0.35s ease;
}

@keyframes englixFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* History */
.englix-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.englix-history-item {
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: var(--ex-radius);
    padding: 0.875rem 1rem;
    box-shadow: var(--ex-shadow);
}

.englix-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.englix-history-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
}

.englix-history-meta time {
    color: var(--ex-muted);
}

.englix-history-toggle {
    border: none;
    background: #f6f7f7;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--ex-muted);
    flex-shrink: 0;
    transition: transform 0.2s;
}

.englix-history-item.is-open .englix-history-toggle {
    transform: rotate(180deg);
}

.englix-history-preview {
    font-size: 0.88rem;
    color: var(--ex-text);
    margin: 0.5rem 0 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.englix-history-body {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--ex-border);
}

.englix-history-reply {
    padding: 0.65rem 0;
    border-bottom: 1px dashed var(--ex-border);
}

.englix-history-reply:last-child {
    border-bottom: none;
}

.englix-history-reply-tone {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ex-muted);
}

.englix-history-reply p {
    font-size: 0.9rem;
    margin: 0.35rem 0;
    line-height: 1.55;
}

.englix-copy-link {
    border: none;
    background: none;
    padding: 0;
    font-size: 0.78rem;
    color: var(--ex-primary);
    cursor: pointer;
}

.englix-copy-link:hover {
    text-decoration: underline;
}

.englix-history-footer {
    text-align: center;
    margin-top: 1rem;
}

.englix-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--ex-muted);
    background: var(--ex-surface);
    border: 1px dashed var(--ex-border);
    border-radius: var(--ex-radius);
}

.englix-empty i {
    font-size: 2rem;
    opacity: 0.35;
    margin-bottom: 0.75rem;
    display: block;
}

.englix-empty-inline {
    padding: 2rem 1rem;
}

/* Loading */
.englix-loading {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.75);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.englix-loading-box {
    background: var(--ex-surface);
    border: 1px solid var(--ex-border);
    border-radius: var(--ex-radius);
    padding: 2rem 2.5rem;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.englix-loading-box p {
    margin: 0.75rem 0 0;
    font-size: 0.9rem;
    color: var(--ex-muted);
}

.englix-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--ex-border);
    border-top-color: var(--ex-primary);
    border-radius: 50%;
    animation: englixSpin 0.7s linear infinite;
    margin: 0 auto;
}

@keyframes englixSpin {
    to { transform: rotate(360deg); }
}

/* ── Dark mode (follows Ripro data-bs-theme) ── */
[data-bs-theme="dark"] .englix-wrap {
    --ex-bg: #0f0f10;
    --ex-surface: #191a1f;
    --ex-border: #29292e;
    --ex-text: #f0f1f3;
    --ex-muted: #a1a1a8;
    --ex-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .englix-main-nav-btn:not(.is-active):hover {
    background: #29292e;
    color: var(--ex-text);
}

[data-bs-theme="dark"] .englix-cost-pill {
    background: rgba(247, 195, 46, 0.15);
    color: #f7c32e;
}

[data-bs-theme="dark"] .englix-seg-tabs {
    background: #29292e;
}

[data-bs-theme="dark"] .englix-seg-tabs button.is-active {
    background: var(--ex-surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

[data-bs-theme="dark"] .englix-style-chip {
    background: #29292e;
}

[data-bs-theme="dark"] .englix-style-chip.is-active {
    background: rgba(34, 113, 177, 0.18);
}

[data-bs-theme="dark"] .englix-input,
[data-bs-theme="dark"] .englix-textarea {
    background: #29292e;
    border-color: var(--ex-border);
    color: var(--ex-text);
}

[data-bs-theme="dark"] .englix-history-item {
    background: var(--ex-surface);
}

[data-bs-theme="dark"] .englix-history-preview {
    color: var(--ex-muted);
}

[data-bs-theme="dark"] .englix-reply-card {
    background: var(--ex-surface);
}

[data-bs-theme="dark"] .englix-aside-note {
    color: var(--ex-muted);
}

[data-bs-theme="dark"] .englix-loading {
    background: rgba(15, 15, 16, 0.82);
}

[data-bs-theme="dark"] .englix-hero.has-default-bg {
    background: linear-gradient(135deg, #0d2847 0%, #1a4f8a 50%, #2271b1 100%);
}

[data-bs-theme="dark"] .englix-empty {
    color: var(--ex-muted);
}
