/**
 * AF Translate — Elite Accessibility UI Framework
 * Architecture: California Inclusive Design Specification (A11y/UX Winner)
 */

 :root {
    /* Color Tokens - Optimized Contextual Contrast (WCAG 2.2 Triple-A Target) */
    --aft-bg-app: #f8fafc;
    --aft-surface: #ffffff;
    --aft-border-muted: #cbd5e1;       /* Accessible 3:1 boundary gray */
    --aft-border-focus: #0f172a;       /* Prominent interactive focus edge */

    --aft-text-main: #0f172a;          /* Rich contrast off-black */
    --aft-text-muted: #475569;         /* High-contrast functional subtext */
    --aft-text-ghost: #64748b;         /* Minimum descriptive text baseline */

    /* Accessible Luxury Accents */
    --aft-brand: #1d4ed8;              /* High-contrast calibrated Cobalt Blue */
    --aft-brand-focus-ring: rgba(29, 78, 216, 0.24);

    /* Accessible High-Contrast Semantic Micro-Pills */
    --aft-status-ok-txt: #064e3b;
    --aft-status-ok-bg: #d1fae5;
    --aft-status-warn-txt: #7f1d1d;
    --aft-status-warn-bg: #fee2e2;
    --aft-status-neutral-txt: #1e293b;
    --aft-status-neutral-bg: #e2e8f0;

    /* Structural Geometry & Target Safety */
    --aft-radius-sm: 8px;
    --aft-radius-md: 12px;
    --aft-radius-lg: 16px;
    --aft-transition-smooth: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);

    /* Clean Shadows (Enhanced depth separation for focus elements) */
    --aft-shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.05);
    --aft-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --aft-shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
}

/* --- Layout Frame System --- */
.af-translate-wrapper {
    margin: 2rem auto;
    max-width: 1280px;
    padding: 0 1.5rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--aft-text-main);
    line-height: 1.5;
}

/* --- Header Architecture --- */
.af-translate-header {
    border-bottom: 2px solid var(--aft-border-muted);
    padding-bottom: 1.5rem;
    margin-bottom: 2.5rem;
}

.af-translate-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--aft-text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.af-translate-header h1 span {
    color: var(--aft-brand);
    font-weight: 500;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 2.5rem 0 1rem;
    color: var(--aft-text-main);
}

/* --- The Cards Ecosystem --- */
.af-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.af-sys-card {
    background: var(--aft-surface);
    border: 1px solid var(--aft-border-muted);
    box-shadow: var(--aft-shadow-md);
    padding: 1.5rem;
    border-radius: var(--aft-radius-md);
    transition: var(--aft-transition-smooth);
}

.af-sys-card:hover {
    border-color: var(--aft-text-ghost);
    box-shadow: var(--aft-shadow-lg);
}

/* --- Split Canvas System Layout --- */
.af-editor-canvas {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1rem;
    width: 100%;
}

.split-workspace-container {
    display: grid;
    grid-template-columns: 55% 45%;
    gap: 1.5rem;
    min-height: 600px;
    align-items: start;
}

@media (max-width: 1024px) {
    .split-workspace-container {
        grid-template-columns: 1fr;
    }
}

.pane-card {
    background: var(--aft-surface);
    border: 1px solid var(--aft-border-muted);
    border-radius: var(--aft-radius-md);
    box-shadow: var(--aft-shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pane-header {
    padding: 1rem 1.25rem;
    background: var(--aft-bg-app);
    border-bottom: 1px solid var(--aft-border-muted);
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--aft-text-main);
    display: flex;
    align-items: center;
}

.scrollable-table-wrapper {
    max-height: 620px;
    overflow-y: auto;
    position: relative;
}

/* --- Interactive Workspace Data Tables --- */
.strings-manager-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.strings-manager-table th {
    position: sticky;
    top: 0;
    background: var(--aft-bg-app);
    z-index: 2;
    padding: 0.875rem 1.25rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--aft-text-muted);
    border-bottom: 2px solid var(--aft-border-muted);
}

.strings-manager-table td {
    padding: 1.125rem 1.25rem; /* Enhanced 44px minimum target safe click zone */
    font-size: 0.875rem;
    color: var(--aft-text-main);
    border-bottom: 1px solid var(--aft-border-muted);
    vertical-align: top;
    cursor: pointer;
    transition: var(--aft-transition-smooth);
}

.strings-manager-table tr.string-row:hover td {
    background: rgba(241, 245, 249, 0.7);
}

/* Explicit accessibility active target focus mapping */
.strings-manager-table tr.string-row.is-active td {
    background: #eff6ff;
    border-bottom-color: #bfdbfe;
}
.strings-manager-table tr.string-row.is-active td:first-child {
    box-shadow: inset 4px 0 0 0 var(--aft-brand);
}

/* --- High-Contrast Badges & Dots --- */
.badge-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: var(--aft-radius-sm);
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-context {
    background: #f5f3ff;
    color: #5b21b6;
    border: 1px solid #ddd6fe;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.badge-plural {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    margin-left: 0.5rem;
}

.state-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.625rem;
    vertical-align: middle;
}

.dot-untranslated { background: #b45309; } /* Calibrated for dark gold visibility */
.dot-translated { background: #15803d; }   /* Solid accessible forest green */
.dot-dirty {
    background: #b91c1c;
    box-shadow: 0 0 0 2px #fef2f2, 0 0 4px #b91c1c;
}

/* --- High-Precision Progress Engine --- */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--aft-status-neutral-bg);
    border-radius: 100px;
    overflow: hidden;
    /* margin-bottom: 0.5rem; */
}

.progress-bar-fill {
    height: 100%;
    background: var(--aft-brand);
    border-radius: 100px;
    transition: var(--aft-transition-smooth);
}

.progress-lbl {
    font-size: 0.875rem;
    color: var(--aft-text-muted);
    font-weight: 600;
}

/* --- Search & Filtering Control Center --- */
.workspace-filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--aft-surface);
    padding: 1rem;
    border: 1px solid var(--aft-border-muted);
    border-radius: var(--aft-radius-md);
    margin-bottom: 1.5rem;
    box-shadow: var(--aft-shadow-sm);
}

.workspace-filter-toolbar input,
.workspace-filter-toolbar select {
    height: 44px; /* Native tap/click optimization minimum size */
    padding: 0 1rem;
    background: var(--aft-surface);
    border: 1px solid var(--aft-border-muted);
    border-radius: var(--aft-radius-sm);
    font-size: 0.9375rem;
    color: var(--aft-text-main);
    transition: var(--aft-transition-smooth);
    outline: none;
}

.workspace-filter-toolbar input { flex-grow: 1; }
.workspace-filter-toolbar select { min-width: 240px; }

/* Enhanced Focus States (No hidden outlines) */
.workspace-filter-toolbar input:focus-visible,
.workspace-filter-toolbar select:focus-visible {
    border-color: var(--aft-brand);
    box-shadow: 0 0 0 3px var(--aft-brand-focus-ring);
}

/* --- Interactive Workbench Editor Controls --- */
.workbench-inner {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.meta-block-card {
    background: var(--aft-bg-app);
    padding: 1rem;
    border-radius: var(--aft-radius-sm);
    border-left: 4px solid var(--aft-text-ghost);
    font-size: 0.875rem;
    color: var(--aft-text-muted);
    line-height: 1.6;
}

.workbench-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.workbench-field-group label {
    font-weight: 600;
    color: var(--aft-text-main);
    font-size: 0.875rem;
}

.read-reference-box {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: var(--aft-radius-sm);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    color: #334155;
    border: 1px solid var(--aft-border-muted);
}

.workbench-textarea {
    width: 100%;
    border-radius: var(--aft-radius-sm);
    border: 1px solid var(--aft-border-muted);
    padding: 1rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--aft-text-main);
    background: var(--aft-surface);
    transition: var(--aft-transition-smooth);
    resize: vertical;
}

.workbench-textarea:focus-visible {
    border-color: var(--aft-brand);
    box-shadow: 0 0 0 3px var(--aft-brand-focus-ring);
    outline: none;
}

.workbench-empty-state {
    padding: 5rem 1.5rem;
    text-align: center;
    color: var(--aft-text-ghost);
    font-style: italic;
    font-size: 0.9375rem;
}

/* --- Floating Command Sticky Bar --- */
.editor-sticky-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--aft-border-muted);
    padding: 1.25rem 2rem;
    border-radius: var(--aft-radius-lg);
    margin-top: 2.5rem;
    position: sticky;
    bottom: 1.5rem;
    box-shadow: var(--aft-shadow-lg);
    z-index: 99;
}

/* Global Canvas Layout */
.af-workspace-wrapper {
    margin: 20px 20px 0 0;
    max-width: 1400px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Navigation Utility Elements */
.af-back-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    margin-bottom: 16px;
    font-weight: 500;
}

/* Consolidated Control Center Hub */
.af-dashboard-header-hub {
    background: #ffffff;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    margin-bottom: 24px;
}
.af-hub-primary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f1;
}
.af-hub-title-area h2 {
    margin: 0 0 6px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1d2327;
    display: flex;
    align-items: center;
    gap: 10px;
}
.af-context-badge {
    background: #f0f6fc;
    color: #0a4b78;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.af-hub-meta-text {
    font-size: 13px;
    color: #646970;
    margin: 0;
}
.af-hub-secondary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background: #f8f9fa;
    border-radius: 0 0 6px 6px;
}
.af-button-cluster {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Core Data Table View Card */
.af-data-view-card {
    background: #ffffff;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    padding: 24px;
}
.af-card-title {
    margin: 0 0 18px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
}

/* Table Grid Row Polish overrides */
table.af-localization-table {
    border: none;
    box-shadow: none;
}
table.af-localization-table thead th {
    background: #f0f0f1;
    font-weight: 600;
    padding: 12px;
    color: #2c3338;
}
table.af-localization-table tbody td {
    padding: 16px 12px;
    vertical-align: middle;
}

/* Dashboard Progress Tracks */
.af-progress-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}
.af-progress-track {
    width: 140px;
    background: #e0e0e0;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}
.af-progress-fill {
    height: 100%;
    background: #00a32a;
    transition: width 0.3s ease;
}
.af-progress-label {
    font-size: 13px;
    font-weight: 600;
    color: #2c3338;
}

/* Dynamic Action Modals */
.af-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 30, 37, 0.5);
    backdrop-filter: blur(2px);
    z-index: 99999;
    justify-content: center;
    align-items: center;
}
.af-modal-box {
    background: #ffffff;
    padding: 32px;
    border-radius: 8px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* --- Native Clean Canvas Safeguard --- */
body.toplevel_page_af-translate div.fs-notice.promotion,
body.toplevel_page_af-translate div.fs-notice.success,
body.toplevel_page_af-translate div.fs-notice.updated,
body.toplevel_page_af-translate .notice-success,
body.toplevel_page_af-translate div.updated,
body.toplevel_page_af-translate div.notice {
    display: none !important;
}
body.af-translate_page_af-translate-themes div.fs-notice.promotion,
body.af-translate_page_af-translate-themes div.fs-notice.success,
body.af-translate_page_af-translate-themes div.fs-notice.updated,
body.af-translate_page_af-translate-themes .notice-success,
body.af-translate_page_af-translate-themes div.updated,
body.af-translate_page_af-translate-themes div.notice {
    display: none !important;
}
body.af-translate_page_af-translate-plugins div.fs-notice.promotion,
body.af-translate_page_af-translate-plugins div.fs-notice.success,
body.af-translate_page_af-translate-plugins div.fs-notice.updated,
body.af-translate_page_af-translate-plugins .notice-success,
body.af-translate_page_af-translate-plugins div.updated,
body.af-translate_page_af-translate-plugins div.notice {
    display: none !important;
}
body.af-translate_page_af-translate-ai-connecter div.fs-notice.promotion,
body.af-translate_page_af-translate-ai-connecter div.fs-notice.success,
body.af-translate_page_af-translate-ai-connecter div.fs-notice.updated,
body.af-translate_page_af-translate-ai-connecter .notice-success,
body.af-translate_page_af-translate-ai-connecter div.updated,
body.af-translate_page_af-translate-ai-connecter div.notice {
    display: none !important;
}