/* =========================================================
   ProfCast Admin — Site Text Management CSS
   ========================================================= */

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

/* ── Design Tokens ─────────────────────────────────────── */
:root {
    --pc-primary:        #2563eb;
    --pc-primary-dark:   #1d4ed8;
    --pc-primary-light:  #eff6ff;
    --pc-primary-ring:   rgba(37, 99, 235, 0.12);
    --pc-danger:         #dc2626;
    --pc-danger-light:   #fef2f2;
    --pc-danger-ring:    rgba(220, 38, 38, 0.12);
    --pc-success:        #16a34a;
    --pc-success-light:  #f0fdf4;
    --pc-warning:        #d97706;
    --pc-warning-light:  #fffbeb;
    --pc-warning-border: #fde68a;
    --pc-info-bg:        #1e3a5f;
    --pc-info-text:      #bfdbfe;

    --pc-text:           #111827;
    --pc-text-secondary: #4b5563;
    --pc-text-muted:     #9ca3af;
    --pc-border:         #e5e7eb;
    --pc-border-dark:    #d1d5db;
    --pc-bg:             #f4f6f9;
    --pc-white:          #ffffff;
    --pc-surface:        #f8fafc;

    --pc-shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --pc-shadow-md:  0 4px 12px rgba(0,0,0,0.08);
    --pc-shadow-lg:  0 8px 32px rgba(0,0,0,0.12);
    --pc-shadow-xl:  0 20px 60px rgba(0,0,0,0.18);

    --pc-radius-sm:  6px;
    --pc-radius-md:  10px;
    --pc-radius-lg:  14px;
    --pc-radius-xl:  20px;
    --pc-radius-full: 9999px;

    --pc-transition: all 0.18s ease;
}

/* ── Page Header & Top Bar ─────────────────────────────── */
.text-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.text-header-info {
    min-width: 0;
}

.text-header-info h1 {
    margin: 0 0 5px;
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--pc-text);
    letter-spacing: -0.3px;
}

.text-header-info p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--pc-text-secondary);
}

.text-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Status Bar / Stats ────────────────────────────────── */
.text-status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px 18px;
    background: var(--pc-white);
    border: 1px solid var(--pc-border);
    border-radius: var(--pc-radius-lg);
    box-shadow: var(--pc-shadow-sm);
    flex-wrap: wrap;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--pc-text-secondary);
    padding: 4px 10px;
    background: var(--pc-surface);
    border: 1px solid var(--pc-border);
    border-radius: var(--pc-radius-full);
}

.status-chip strong {
    color: var(--pc-text);
}

.status-chip--file {
    font-family: monospace;
    color: var(--pc-primary);
    background: var(--pc-primary-light);
    border-color: #bfdbfe;
}

.status-chip--dirty {
    color: var(--pc-warning);
    background: var(--pc-warning-light);
    border-color: var(--pc-warning-border);
    font-weight: 600;
}

.status-chip--clean {
    color: var(--pc-success);
    background: var(--pc-success-light);
    border-color: #bbf7d0;
}

/* ── Language Switcher Tabs ────────────────────────────── */
.lang-tabs {
    display: inline-flex;
    background: #e2e8f0;
    padding: 4px;
    border-radius: var(--pc-radius-md);
    gap: 4px;
}

.lang-tab {
    padding: 8px 18px;
    border: none;
    background: transparent;
    border-radius: var(--pc-radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--pc-text-secondary);
    cursor: pointer;
    transition: var(--pc-transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.lang-tab:hover:not(.active) {
    color: var(--pc-text);
    background: rgba(255, 255, 255, 0.5);
}

.lang-tab.active {
    background: var(--pc-white);
    color: var(--pc-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ── Control Bar / Filters ─────────────────────────────── */
.text-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 240px;
    max-width: 400px;
}

.search-wrapper .search-icon {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    pointer-events: none;
    width: 17px;
    height: 17px;
    color: var(--pc-text-muted);
}

.search-input,
.filter-select {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 1.5px solid var(--pc-border);
    border-radius: var(--pc-radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--pc-white);
    color: var(--pc-text);
    transition: var(--pc-transition);
    outline: none;
    box-sizing: border-box;
}

.filter-select {
    padding: 10px 14px;
    min-width: 180px;
    max-width: 240px;
    cursor: pointer;
}

.search-input:focus,
.filter-select:focus {
    border-color: var(--pc-primary);
    box-shadow: 0 0 0 3px var(--pc-primary-ring);
}

.toggle-modified-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    background: var(--pc-white);
    border: 1.5px solid var(--pc-border);
    border-radius: var(--pc-radius-md);
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--pc-text-secondary);
    cursor: pointer;
    user-select: none;
    transition: var(--pc-transition);
}

.toggle-modified-filter:hover {
    border-color: var(--pc-border-dark);
}

.toggle-modified-filter input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--pc-warning);
    cursor: pointer;
}

.toggle-modified-filter.is-active {
    border-color: var(--pc-warning);
    background: var(--pc-warning-light);
    color: var(--pc-warning);
    font-weight: 600;
}

.btn-filter-clear {
    padding: 9px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--pc-danger);
    background: var(--pc-danger-light);
    border: 1px solid #fecaca;
    border-radius: var(--pc-radius-md);
    cursor: pointer;
    transition: var(--pc-transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-filter-clear:hover {
    background: #fee2e2;
}

.results-count {
    font-size: 0.84rem;
    color: var(--pc-text-secondary);
    white-space: nowrap;
    margin-right: auto;
}

/* ── Translations Container ────────────────────────────── */
.translations-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 30px;
}

/* ── Translation Card / Row ────────────────────────────── */
.translation-card {
    background: var(--pc-white);
    border: 1px solid var(--pc-border);
    border-radius: var(--pc-radius-lg);
    box-shadow: var(--pc-shadow-sm);
    padding: 16px 20px;
    transition: var(--pc-transition);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.translation-card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--pc-shadow-md);
}

.translation-card.is-dirty {
    border-color: var(--pc-warning);
    background: #fffdfa;
    box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.2);
}

.translation-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.translation-path {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--pc-text);
    direction: ltr;
    text-align: left;
}

.translation-section-badge {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: var(--pc-primary);
    background: var(--pc-primary-light);
    border: 1px solid #bfdbfe;
    padding: 2px 8px;
    border-radius: var(--pc-radius-full);
}

.btn-copy-key {
    background: none;
    border: none;
    color: var(--pc-text-muted);
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    transition: var(--pc-transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.btn-copy-key:hover {
    color: var(--pc-primary);
    background: var(--pc-surface);
}

.translation-card-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dirty-badge {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--pc-warning);
    background: var(--pc-warning-light);
    border: 1px solid var(--pc-warning-border);
    padding: 2px 8px;
    border-radius: var(--pc-radius-full);
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.dirty-badge::before {
    content: '●';
    font-size: 8px;
}

.btn-reset-field {
    padding: 2px 8px;
    font-size: 11px;
    color: var(--pc-text-muted);
    background: var(--pc-surface);
    border: 1px solid var(--pc-border);
    border-radius: var(--pc-radius-sm);
    cursor: pointer;
    transition: var(--pc-transition);
}

.btn-reset-field:hover {
    color: var(--pc-danger);
    background: var(--pc-danger-light);
    border-color: #fecaca;
}

.translation-editor-wrap {
    width: 100%;
}

.text-input,
.text-textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--pc-border);
    border-radius: var(--pc-radius-md);
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--pc-text);
    background: var(--pc-white);
    transition: var(--pc-transition);
    outline: none;
    box-sizing: border-box;
    line-height: 1.55;
}

.text-input:focus,
.text-textarea:focus {
    border-color: var(--pc-primary);
    box-shadow: 0 0 0 3px var(--pc-primary-ring);
    background: #fff;
}

.translation-card.is-dirty .text-input,
.translation-card.is-dirty .text-textarea {
    border-color: #f59e0b;
}

.text-textarea {
    resize: vertical;
    min-height: 76px;
}

.text-textarea--large {
    min-height: 130px;
}

/* ── Important Notice Box ──────────────────────────────── */
.notice-box {
    background: #fffbeb;
    border: 1.5px solid #fde68a;
    border-radius: var(--pc-radius-lg);
    padding: 18px 22px;
    margin-top: 0;
    margin-bottom: 22px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.notice-box-icon {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.notice-box-content h3 {
    margin: 0 0 6px;
    font-size: 0.98rem;
    font-weight: 700;
    color: #92400e;
}

.notice-box-content p {
    margin: 0;
    font-size: 0.88rem;
    color: #78350f;
    line-height: 1.6;
}

/* ── Empty & Error States ──────────────────────────────── */
.state-container {
    text-align: center;
    padding: 60px 32px;
    background: var(--pc-white);
    border: 1px solid var(--pc-border);
    border-radius: var(--pc-radius-lg);
}

.state-container .state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: #d1d5db;
}

.state-container h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: var(--pc-text);
}

.state-container p {
    margin: 0 0 20px;
    font-size: 0.88rem;
    color: var(--pc-text-secondary);
    line-height: 1.5;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: var(--pc-primary);
    color: #fff;
    border: none;
    border-radius: var(--pc-radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--pc-transition);
    white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
    background: var(--pc-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}

.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: var(--pc-white);
    color: var(--pc-text-secondary);
    border: 1.5px solid var(--pc-border);
    border-radius: var(--pc-radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--pc-transition);
    white-space: nowrap;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--pc-surface);
    color: var(--pc-text);
    border-color: #d1d5db;
}

.btn-secondary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-success {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: var(--pc-success);
    color: #fff;
    border: none;
    border-radius: var(--pc-radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--pc-transition);
    white-space: nowrap;
}

.btn-success:hover:not(:disabled) {
    background: #15803d;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.28);
}

.btn-success:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: var(--pc-danger);
    color: #fff;
    border: none;
    border-radius: var(--pc-radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--pc-transition);
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    transform: translateY(-1px);
}

.btn-danger:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ── Modal System ──────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.hidden { display: none; }

.modal-dialog {
    background: var(--pc-white);
    border-radius: var(--pc-radius-xl);
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--pc-shadow-xl);
    animation: pc-modal-in 0.24s cubic-bezier(0.34, 1.3, 0.64, 1);
}

@keyframes pc-modal-in {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--pc-border);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--pc-text);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--pc-surface);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pc-text-secondary);
    transition: var(--pc-transition);
}

.modal-close:hover {
    background: #fee2e2;
    color: var(--pc-danger);
}

.modal-body {
    padding: 22px 24px;
    overflow-y: auto;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--pc-text-secondary);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--pc-border);
}

/* ── Toast Notifications ───────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    width: max-content;
    max-width: calc(100vw - 40px);
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 0.87rem;
    font-weight: 500;
    box-shadow: var(--pc-shadow-lg);
    animation: pc-toast-in 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
    pointer-events: all;
    max-width: 460px;
    word-break: break-word;
}

.toast.removing {
    animation: pc-toast-out 0.22s ease forwards;
}

.toast svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

.toast-success { background: #052e16; color: #bbf7d0; }
.toast-error   { background: #450a0a; color: #fecaca; }
.toast-info    { background: var(--pc-info-bg); color: var(--pc-info-text); }

@keyframes pc-toast-in {
    from { opacity: 0; transform: translateY(16px) scale(0.92); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pc-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes pc-toast-out {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.94); }
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 850px) {
    .text-header {
        flex-direction: column;
        align-items: stretch;
    }
    .text-header-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .text-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .search-wrapper,
    .filter-select {
        max-width: 100%;
        min-width: 100%;
    }
    .toggle-modified-filter {
        justify-content: center;
    }
    .translation-path {
        font-size: 0.78rem;
        word-break: break-all;
    }
}
