/* ── CM Translator v1.2 ── */

#cmt-widget {
    position: fixed;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1;
    user-select: none;
}

/* ── Posiciones ── */
#cmt-widget.pos-bottom-right { bottom: 24px; right: 24px; }
#cmt-widget.pos-bottom-left  { bottom: 24px; left:  24px; }
#cmt-widget.pos-top-right    { top:    24px; right: 24px; }
#cmt-widget.pos-top-left     { top:    24px; left:  24px; }

/* ── Botón principal ── */
#cmt-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0,0,0,.28);
    transition: transform .15s, box-shadow .15s, background .15s;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .2px;
}
#cmt-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(0,0,0,.34);
    background: #16213e;
}
#cmt-btn:active { transform: translateY(0); }

/* Globo SVG inline */
#cmt-btn .cmt-globe {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    opacity: .9;
}

/* Spinner dentro del botón */
#cmt-btn .cmt-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cmt-spin .7s linear infinite;
    flex-shrink: 0;
}
#cmt-widget.is-loading #cmt-btn .cmt-spinner { display: block; }
#cmt-widget.is-loading #cmt-btn .cmt-globe   { display: none; }

/* Barra de progreso */
#cmt-progress-bar {
    position: absolute;
    bottom: -5px;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #4facfe, #00f2fe);
    border-radius: 3px;
    transition: width .3s ease;
    display: none;
}
#cmt-widget.is-loading #cmt-progress-bar { display: block; }

@keyframes cmt-spin {
    to { transform: rotate(360deg); }
}

/* ── Dropdown ── */
#cmt-menu {
    display: none;
    position: absolute;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18), 0 1px 4px rgba(0,0,0,.08);
    overflow: hidden;
    min-width: 180px;
    animation: cmt-pop .18s cubic-bezier(.34,1.56,.64,1) both;
}
#cmt-widget.is-open #cmt-menu { display: block; }

/* Posicionamiento del dropdown según esquina */
.pos-bottom-right #cmt-menu,
.pos-bottom-left  #cmt-menu { bottom: calc(100% + 10px); }
.pos-top-right    #cmt-menu,
.pos-top-left     #cmt-menu { top: calc(100% + 10px); }

.pos-bottom-right #cmt-menu,
.pos-top-right    #cmt-menu { right: 0; }
.pos-bottom-left  #cmt-menu,
.pos-top-left     #cmt-menu { left: 0; }

@keyframes cmt-pop {
    from { opacity: 0; transform: scale(.92) translateY(6px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Header del dropdown */
#cmt-menu-header {
    padding: 11px 16px 9px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #aaa;
    border-bottom: 1px solid #f0f0f0;
}

/* Opciones de idioma */
.cmt-lang-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    cursor: pointer;
    transition: background .1s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: #222;
    font-size: 14px;
    border-bottom: 1px solid #f7f7f7;
}
.cmt-lang-item:last-child { border-bottom: none; }
.cmt-lang-item:hover      { background: #f5f8ff; }

.cmt-lang-item.is-active {
    background: #eef4ff;
    color: #1a56db;
    font-weight: 600;
}
.cmt-lang-item.is-active::after {
    content: '✓';
    margin-left: auto;
    font-size: 13px;
    color: #1a56db;
}

.cmt-lang-flag  { font-size: 20px; line-height: 1; }
.cmt-lang-info  { display: flex; flex-direction: column; gap: 1px; }
.cmt-lang-full  { font-size: 13px; font-weight: 500; }
.cmt-lang-code  { font-size: 10px; color: #aaa; letter-spacing: .5px; }

/* ── Mensaje de error flotante ── */
#cmt-toast {
    position: fixed;
    bottom: 80px;
    right: 24px;
    background: #1a1a2e;
    color: #fff;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    box-shadow: 0 4px 16px rgba(0,0,0,.22);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
    z-index: 99998;
    max-width: 280px;
}
#cmt-toast.show { opacity: 1; }
