/* ============================================
   AI Translate WP — Frontend Styles
   ============================================ */

/* Switcher Base */
.aitwp-switcher {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    z-index: 999999;
    line-height: 1.4;
}

.aitwp-switcher * {
    box-sizing: border-box;
}

/* Fixed Positioning */
.aitwp-fixed {
    position: fixed;
}

.aitwp-pos-bottom-right {
    bottom: 24px;
    right: 24px;
}

.aitwp-pos-bottom-left {
    bottom: 24px;
    left: 24px;
}

.aitwp-pos-top-right {
    top: 24px;
    right: 24px;
}

.aitwp-pos-top-left {
    top: 24px;
    left: 24px;
}

/* Dropdown Switcher */
.aitwp-switcher-dropdown {
    position: relative;
}

.aitwp-switcher-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #344054;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.aitwp-switcher-toggle:hover {
    border-color: #98a2b3;
    box-shadow: 0 2px 6px rgba(16, 24, 40, 0.15);
}

.aitwp-flag {
    font-size: 20px;
    line-height: 1;
}

.aitwp-arrow {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.aitwp-switcher.open .aitwp-arrow {
    transform: rotate(180deg);
}

/* Dropdown List */
.aitwp-switcher-list {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    max-height: 320px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(16, 24, 40, 0.16), 0 4px 8px rgba(16, 24, 40, 0.08);
    list-style: none;
    margin: 0;
    padding: 6px;
    display: none;
    animation: aitwp-slide-up 0.2s ease;
}

.aitwp-pos-top-right .aitwp-switcher-list,
.aitwp-pos-top-left .aitwp-switcher-list {
    bottom: auto;
    top: calc(100% + 8px);
    animation: aitwp-slide-down 0.2s ease;
}

.aitwp-switcher.open .aitwp-switcher-list {
    display: block;
}

.aitwp-switcher-list li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.aitwp-lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: #344054;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.15s ease;
    font-size: 14px;
}

.aitwp-lang-option:hover {
    background: #f2f4f7;
    color: #1d2939;
    text-decoration: none;
}

.aitwp-lang-option.aitwp-active {
    background: #eff8ff;
    color: #175cd3;
    font-weight: 600;
}

.aitwp-lang-option.aitwp-active::after {
    content: "✓";
    margin-left: auto;
    font-size: 14px;
    color: #175cd3;
}

/* Flags Bar Switcher */
.aitwp-switcher-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.1);
}

.aitwp-bar-flag {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.15s ease;
    font-size: 22px;
}

.aitwp-bar-flag:hover {
    background: #f2f4f7;
    transform: scale(1.1);
}

.aitwp-bar-flag.aitwp-active {
    background: #eff8ff;
    box-shadow: inset 0 0 0 2px #175cd3;
}

.aitwp-code {
    font-size: 11px;
    font-weight: 700;
    color: #475467;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Loading State */
.aitwp-translating .aitwp-translatable {
    position: relative;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.aitwp-translating .aitwp-translatable::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 30%, rgba(33, 113, 177, 0.08) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: aitwp-shimmer 1.5s infinite;
    pointer-events: none;
}

.aitwp-translated .aitwp-translatable {
    opacity: 1;
}

/* Animations */
@keyframes aitwp-slide-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes aitwp-slide-down {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes aitwp-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Scrollbar styling for dropdown */
.aitwp-switcher-list::-webkit-scrollbar {
    width: 6px;
}

.aitwp-switcher-list::-webkit-scrollbar-track {
    background: transparent;
}

.aitwp-switcher-list::-webkit-scrollbar-thumb {
    background: #d0d5dd;
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 480px) {
    .aitwp-switcher-toggle {
        padding: 8px 12px;
        font-size: 13px;
    }

    .aitwp-switcher-list {
        min-width: 180px;
    }

    .aitwp-pos-bottom-right,
    .aitwp-pos-bottom-left {
        bottom: 16px;
    }

    .aitwp-pos-bottom-right {
        right: 16px;
    }

    .aitwp-pos-bottom-left {
        left: 16px;
    }
}

/* Inline switcher */
.aitwp-inline {
    position: relative;
    display: inline-block;
}

.aitwp-inline .aitwp-switcher-list {
    bottom: auto;
    top: calc(100% + 4px);
    animation: aitwp-slide-down 0.2s ease;
}
