/**
 * 🌐 TRANSLATOR MODULE v2.0 — Radim Branding (Sprint A+B)
 * Masthead, quick presets, settings bar, favorites, emergency phrases,
 * night mode, slow mode, help balloon. Loaded after translator-module.css.
 */

#module-translator { max-width: 1200px; margin: 0 auto; }

/* ============================================================
   RADIM MASTHEAD
   ============================================================ */
.trl-masthead {
    display: flex;
    gap: 18px;
    padding: 18px 20px;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--radim-primary, var(--radim-primary)) 12%, var(--radim-surface, #fff)) 0%,
        var(--radim-surface, #fff) 100%);
    border: 2px solid color-mix(in srgb, var(--radim-primary, var(--radim-primary)) 22%, transparent);
    border-radius: var(--radim-radius-2xl, 20px);
    margin-bottom: 14px;
    align-items: center;
}

.trl-avatar {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%,
        color-mix(in srgb, var(--radim-primary, var(--radim-primary)) 22%, #fff),
        color-mix(in srgb, var(--radim-primary, var(--radim-primary)) 10%, #fff));
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 3px solid color-mix(in srgb, var(--radim-primary, var(--radim-primary)) 40%, transparent);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--radim-primary) 22%, transparent);
}

.trl-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: translateY(2px) scale(1.05);
}

.trl-mast-body { flex: 1; min-width: 0; }

.trl-greeting {
    font-size: var(--radim-font-lg, 1.125rem);
    font-weight: 700;
    color: var(--radim-text, #1a2733);
    margin: 0 0 8px 0;
}

.trl-greeting strong { color: var(--radim-primary, var(--radim-primary)); }

.trl-daily-phrase {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: color-mix(in srgb, var(--radim-primary, var(--radim-primary)) 8%, var(--radim-surface, #fff));
    border: 1.5px solid color-mix(in srgb, var(--radim-primary, var(--radim-primary)) 30%, transparent);
    border-radius: var(--radim-radius-2xl, 999px);
    font-size: var(--radim-font-sm, 0.95rem);
    color: var(--radim-text, #1a2733);
    cursor: pointer;
    transition: all 0.15s;
}

.trl-daily-phrase:hover {
    border-color: var(--radim-primary, var(--radim-primary));
    transform: translateY(-1px);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--radim-primary) 18%, transparent);
}

.trl-daily-phrase strong { color: var(--radim-primary, var(--radim-primary)); font-weight: 700; }

/* ============================================================
   SETTINGS BAR (auto-read, night, slow, help)
   ============================================================ */
.trl-settings-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 14px;
    justify-content: flex-end;
}

.trl-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--radim-surface, #fff);
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radim-radius-2xl, 999px);
    cursor: pointer;
    font-size: var(--radim-font-sm, 0.9rem);
    font-weight: 600;
    color: var(--radim-text-muted, #6b7b8a);
    transition: all 0.2s;
}

.trl-toggle:hover {
    border-color: var(--radim-primary, var(--radim-primary));
    color: var(--radim-primary, var(--radim-primary));
}

.trl-toggle.active {
    background: color-mix(in srgb, var(--radim-primary, var(--radim-primary)) 18%, var(--radim-surface, #fff));
    border-color: var(--radim-primary, var(--radim-primary));
    color: var(--radim-primary, var(--radim-primary));
}

/* ============================================================
   QUICK PRESETS (one-tap language pairs)
   ============================================================ */
.trl-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.trl-preset {
    flex: 1;
    min-width: 120px;
    padding: 14px 12px;
    background: var(--radim-surface, #fff);
    border: 2px solid color-mix(in srgb, var(--radim-primary, var(--radim-primary)) 25%, transparent);
    border-radius: var(--radim-radius-xl, 16px);
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--radim-text, #1a2733);
    text-align: center;
}

.trl-preset:hover {
    transform: translateY(-2px);
    border-color: var(--radim-primary, var(--radim-primary));
    box-shadow: 0 8px 20px color-mix(in srgb, var(--radim-primary) 18%, transparent);
}

.trl-preset.active {
    background: color-mix(in srgb, var(--radim-primary, var(--radim-primary)) 18%, var(--radim-surface, #fff));
    border-color: var(--radim-primary, var(--radim-primary));
    box-shadow: 0 4px 14px color-mix(in srgb, var(--radim-primary) 25%, transparent);
}

/* ============================================================
   HELP BALLOON
   ============================================================ */
.trl-help-balloon {
    position: relative;
    padding: 14px 18px 14px 52px;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border: 2px solid #6366f1;
    border-radius: var(--radim-radius-lg, 14px);
    color: #3730a3;
    font-size: var(--radim-font-sm, 0.95rem);
    line-height: 1.5;
    margin-bottom: 14px;
    animation: trlHelpSlide 0.3s ease-out;
}

.trl-help-balloon::before {
    content: '🦉';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.6rem;
}

.trl-help-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: transparent;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: #6366f1;
    padding: 4px 8px;
    border-radius: 8px;
}

.trl-help-close:hover { background: rgba(99, 102, 241, 0.15); }

@keyframes trlHelpSlide {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   EMERGENCY PHRASES (red, always at top)
   ============================================================ */
.trl-book-emergency-cat .trl-book-cat-title {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-radius: var(--radim-radius-md, 8px);
    padding: 8px 12px;
    color: #991b1b;
}

.trl-book-emergency {
    border-left: 4px solid #dc2626 !important;
    background: color-mix(in srgb, #dc2626 6%, var(--radim-surface, #fff));
}

.trl-book-emergency .trl-book-phrase-cs { color: #991b1b; font-weight: 600; }

/* ============================================================
   FAVORITES
   ============================================================ */
.trl-book-fav-cat .trl-book-cat-title {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-radius: var(--radim-radius-md, 8px);
    padding: 8px 12px;
    color: #92400e;
}

.trl-book-fav-cat .trl-book-phrase {
    border-left: 4px solid #f59e0b;
}

.trl-icon[data-act="fav"] {
    transition: transform 0.15s;
}

.trl-icon[data-act="fav"]:hover {
    transform: scale(1.25);
}

/* ============================================================
   NIGHT MODE
   ============================================================ */
#module-translator.trl-night {
    background: #1a1f2e;
    color: #e2e8f0;
    padding: 14px;
    border-radius: var(--radim-radius-2xl, 20px);
    margin: 14px auto;
}

#module-translator.trl-night .trl-masthead,
#module-translator.trl-night .trl-toggle,
#module-translator.trl-night .trl-preset,
#module-translator.trl-night .trl-pane,
#module-translator.trl-night .trl-textarea,
#module-translator.trl-night .trl-output,
#module-translator.trl-night .trl-lang-select,
#module-translator.trl-night .trl-history-item,
#module-translator.trl-night .trl-book-phrase {
    background: #2d3748;
    color: #e2e8f0;
    border-color: #4a5568;
}

#module-translator.trl-night .trl-greeting,
#module-translator.trl-night .trl-pane-label,
#module-translator.trl-night .trl-book-phrase-cs {
    color: #f7fafc;
}

#module-translator.trl-night .trl-greeting strong,
#module-translator.trl-night .trl-daily-phrase strong {
    color: #7fd1ca;
}

#module-translator.trl-night .trl-daily-phrase {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

#module-translator.trl-night .trl-toggle.active,
#module-translator.trl-night .trl-preset.active {
    background: #7fd1ca;
    color: #1a202c;
    border-color: #7fd1ca;
}

#module-translator.trl-night .trl-mode-tab {
    background: #2d3748;
    color: #cbd5e1;
}

#module-translator.trl-night .trl-mode-active {
    background: #7fd1ca;
    color: #1a202c;
}

#module-translator.trl-night .trl-btn-primary {
    background: #7fd1ca;
    color: #1a202c;
}

/* ============================================================
   SLOW MODE
   ============================================================ */
#module-translator.trl-slow .trl-textarea,
#module-translator.trl-slow .trl-output,
#module-translator.trl-slow .trl-book-phrase-cs,
#module-translator.trl-slow .trl-book-phrase-tr {
    font-size: 1.2em !important;
    line-height: 1.7 !important;
}

#module-translator.trl-slow .trl-toggle,
#module-translator.trl-slow .trl-btn-primary,
#module-translator.trl-slow .trl-mode-tab {
    min-height: 56px;
    font-size: 1.05rem;
}

#module-translator.trl-slow .trl-preset {
    font-size: 1.8rem;
    padding: 18px 14px;
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 640px) {
    .trl-masthead {
        flex-direction: column;
        text-align: center;
        padding: 14px;
    }
    .trl-settings-bar { justify-content: center; }
    .trl-presets { gap: 6px; }
    .trl-preset { font-size: 1.1rem; padding: 10px 8px; min-width: 0; }
    .trl-daily-phrase { font-size: 0.85rem; padding: 6px 10px; }
}
