/* ===================================================== */
/* TRANSLATOR PANEL (Google Translate Glass Floating Panel) */
/* ===================================================== */

.translator-panel {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 380px;
    height: 480px;
    min-width: 320px;
    min-height: 380px;
    background: rgba(18, 18, 26, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 150;
    
    display: flex;
    flex-direction: column;
    overflow: hidden;

    /* Snappy Apple-like Spring Animation */
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) scale(0.94);
    transform-origin: top right;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.translator-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* 8-Way Resizer */
.translator-resizer {
    position: absolute;
    z-index: 200;
}
.translator-resizer.r-n { top: 0; left: 10px; right: 10px; height: 6px; cursor: ns-resize; }
.translator-resizer.r-s { bottom: 0; left: 10px; right: 10px; height: 6px; cursor: ns-resize; }
.translator-resizer.r-w { left: 0; top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }
.translator-resizer.r-e { right: 0; top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }
.translator-resizer.r-nw { top: 0; left: 0; width: 12px; height: 12px; cursor: nwse-resize; }
.translator-resizer.r-ne { top: 0; right: 0; width: 12px; height: 12px; cursor: nesw-resize; }
.translator-resizer.r-sw { bottom: 0; left: 0; width: 12px; height: 12px; cursor: nesw-resize; }
.translator-resizer.r-se { bottom: 0; right: 0; width: 12px; height: 12px; cursor: nwse-resize; }

/* Toolbar Header */
.translator-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    user-select: none;
    cursor: grab;
}

.translator-toolbar:active {
    cursor: grabbing;
}

.translator-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #fff);
}

.translator-title svg {
    width: 16px;
    height: 16px;
    color: var(--accent, #6366f1);
}

.translator-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.translator-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted, #888);
    cursor: pointer;
    transition: all 0.15s ease;
}

.translator-tool-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #fff);
}

.translator-tool-btn.translator-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.translator-tool-btn svg {
    width: 15px;
    height: 15px;
}

/* Lang Bar */
.translator-langbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    gap: 8px;
}

.translator-lang-select {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #fff);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
}

.translator-lang-select:focus {
    border-color: var(--accent, #6366f1);
}

.translator-lang-select option {
    background: #181824;
    color: #fff;
}

.translator-swap-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary, #ccc);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    flex-shrink: 0;
}

.translator-swap-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent, #6366f1);
    color: #fff;
    transform: rotate(180deg);
}

.translator-swap-btn svg {
    width: 14px;
    height: 14px;
}

/* Body Container */
.translator-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 10px;
    overflow-y: auto;
}

/* Box wrapper */
.translator-box {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 8px 10px;
    position: relative;
    flex: 1;
    min-height: 110px;
    transition: border-color 0.15s;
}

.translator-box:focus-within {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(0, 0, 0, 0.3);
}

.translator-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted, #777);
}

.translator-box-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.translator-action-mini-btn {
    background: transparent;
    border: none;
    color: var(--text-muted, #888);
    cursor: pointer;
    padding: 3px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.translator-action-mini-btn:hover {
    color: var(--text-primary, #fff);
    background: rgba(255, 255, 255, 0.08);
}

.translator-action-mini-btn svg {
    width: 13px;
    height: 13px;
}

.translator-textarea {
    flex: 1;
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary, #fff);
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    font-family: inherit;
    padding: 0;
}

.translator-textarea::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.translator-output-area {
    flex: 1;
    width: 100%;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary, #fff);
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    user-select: text;
}

.translator-output-empty {
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
}

/* Footer / Translate trigger */
.translator-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    gap: 8px;
}

.translator-status {
    font-size: 11px;
    color: var(--text-muted, #888);
    display: flex;
    align-items: center;
    gap: 6px;
}

.translator-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent, #6366f1);
    border-radius: 50%;
    animation: translatorSpin 0.7s linear infinite;
    display: inline-block;
}

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

.translator-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--accent, #6366f1);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.translator-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.translator-btn:active {
    transform: translateY(0);
}

.translator-btn svg {
    width: 13px;
    height: 13px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .translator-panel {
        top: 60px;
        left: 10px !important;
        right: 10px !important;
        width: calc(100vw - 20px) !important;
        height: 75vh !important;
        border-radius: 14px;
    }
}
