/* Tratok Translator - Frontend Styles */

.tratok-language-switcher {
    margin: 12px 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.tratok-switcher-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.tratok-switcher-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-right: 4px;
}

.tratok-lang-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tratok-lang-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #d0d5dd;
    border-radius: 20px;
    background: #fff;
    color: #344054;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1.4;
}

.tratok-lang-btn:hover {
    background: #f2f4f7;
    border-color: #98a2b3;
}

.tratok-lang-btn.active {
    background: #1d2939;
    color: #fff;
    border-color: #1d2939;
}

.tratok-lang-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tratok-lang-btn[data-cached="1"]::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #12b76a;
    border-radius: 50%;
    margin-left: 6px;
}

/* Loading indicator */
.tratok-translate-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 13px;
    color: #667085;
}

.tratok-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e4e7ec;
    border-top-color: #1d2939;
    border-radius: 50%;
    animation: tratok-spin 0.6s linear infinite;
}

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

/* Error toast */
.tratok-error-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #d92d20;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    animation: tratok-slide-in 0.3s ease;
}

@keyframes tratok-slide-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Floating switcher variant */
.tratok-switcher-floating {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99998;
    margin: 0;
}

.tratok-floating-toggle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #1d2939;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease;
}

.tratok-floating-toggle:hover {
    transform: scale(1.05);
}

.tratok-floating-panel {
    position: absolute;
    bottom: 60px;
    right: 0;
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    min-width: 260px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid #e4e7ec;
}

.tratok-floating-panel .tratok-switcher-inner {
    flex-direction: column;
    align-items: flex-start;
}

.tratok-floating-panel .tratok-lang-buttons {
    flex-direction: column;
    width: 100%;
}

.tratok-floating-panel .tratok-lang-btn {
    width: 100%;
    justify-content: center;
}

/* Responsive */
@media (max-width: 600px) {
    .tratok-switcher-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .tratok-lang-btn {
        padding: 5px 10px;
        font-size: 12px;
    }
}

/* ============================================
   Nav Menu Trigger (opens modal)
   ============================================ */

.tratok-nav-switcher {
    list-style: none;
}

.tratok-nav-switcher > a.tratok-nav-trigger {
    cursor: pointer;
    white-space: nowrap;
}

.tratok-nav-globe {
    display: inline-block;
    vertical-align: middle;
    margin-right: 3px;
    width: 16px;
    height: 16px;
}

.tratok-nav-current {
    vertical-align: middle;
}

/* ============================================
   Language Modal — full-screen overlay
   Rendered in wp_footer, outside all nav/main.
   ============================================ */

.tratok-lang-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.tratok-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.tratok-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: tratok-modal-in 0.2s ease;
}

@keyframes tratok-modal-in {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

.tratok-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e4e7ec;
}

.tratok-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1d2939;
}

.tratok-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #98a2b3;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.tratok-modal-close:hover {
    color: #344054;
}

/* Flag grid */
.tratok-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (min-width: 480px) {
    .tratok-modal-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.tratok-modal-lang {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    border: 2px solid #e4e7ec;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.tratok-modal-lang:hover {
    border-color: #d0d5dd;
    background: #f9fafb;
    transform: translateY(-1px);
}

.tratok-modal-lang.active {
    border-color: #0d9488;
    background: #f0fdfa;
}

.tratok-modal-flag {
    font-size: 28px;
    line-height: 1;
}

.tratok-modal-name {
    font-size: 12px;
    font-weight: 600;
    color: #344054;
    line-height: 1.2;
}

.tratok-modal-lang.active .tratok-modal-name {
    color: #0d9488;
}

/* Loading state on trigger */
.tratok-nav-loading > a.tratok-nav-trigger::after {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: tratok-spin 0.6s linear infinite;
    margin-left: 6px;
    vertical-align: middle;
}
