/* Avasya Translate v2 - Frontend Styles */

/* Inline Switcher */
.avasya-switcher-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.avasya-lang-link {
    text-decoration: none;
    color: #333;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.avasya-lang-link:hover {
    background: rgba(0,0,0,0.05);
    color: #000;
}

.avasya-lang-link.active {
    font-weight: 700;
    color: #0073aa;
}

.avasya-sep {
    color: #ccc;
    user-select: none;
}

/* Dropdown Switcher */
.avasya-switcher-dropdown {
    position: relative;
    display: inline-block;
}

.avasya-switcher-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.avasya-switcher-toggle:hover {
    border-color: #999;
}

.avasya-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

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

.avasya-switcher-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin: 4px 0 0;
    padding: 4px 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    list-style: none;
    min-width: 160px;
    z-index: 9999;
}

.avasya-switcher-dropdown.open .avasya-switcher-list {
    display: block;
}

.avasya-switcher-list a {
    display: block;
    padding: 8px 14px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
}

.avasya-switcher-list a:hover {
    background: #f5f5f5;
}

.avasya-switcher-list a.active {
    font-weight: 700;
    color: #0073aa;
    background: #f0f7fc;
}

/* Floating Switcher */
.avasya-floating-switcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.avasya-floating-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.avasya-floating-toggle:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

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

.avasya-current-name {
    font-weight: 500;
}

.avasya-floating-list {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    overflow: hidden;
    min-width: 180px;
}

.avasya-floating-switcher.open .avasya-floating-list {
    display: block;
    animation: avasyaFadeUp 0.2s ease;
}

.avasya-floating-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.avasya-floating-item:last-child {
    border-bottom: none;
}

.avasya-floating-item:hover {
    background: #f8f8f8;
}

.avasya-floating-item.active {
    background: #f0f7fc;
    font-weight: 600;
    color: #0073aa;
}

.avasya-floating-item .flag {
    font-size: 20px;
    line-height: 1;
}

.avasya-floating-item .name {
    flex: 1;
}

@keyframes avasyaFadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   SCAN MODE - Inline Translation Panel
   ========================================== */

#avasya-scan-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 480px;
    height: 100vh;
    background: #1d2327;
    color: #e0e0e0;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
}

.asp-header {
    padding: 14px 18px;
    background: #2c3338;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #3c4349;
}

.asp-header strong {
    font-size: 15px;
    color: #72aee6;
}

.asp-count {
    color: #72aee6;
    font-weight: 600;
    font-size: 12px;
}

.asp-controls {
    padding: 10px 18px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    border-bottom: 1px solid #3c4349;
    background: #2c3338;
}

.asp-controls label {
    color: #ccc;
    font-size: 12px;
}

.asp-controls input[type="text"] {
    padding: 4px 8px;
    border: 1px solid #555;
    border-radius: 3px;
    background: #1d2327;
    color: #fff;
    font-size: 12px;
    width: 100px;
}

.asp-btn {
    padding: 6px 16px;
    border: 1px solid #555;
    border-radius: 3px;
    background: #3c4349;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
    white-space: nowrap;
}

.asp-btn:hover {
    background: #4f5962;
}

.asp-primary {
    background: #2271b1 !important;
    border-color: #2271b1 !important;
    font-weight: 600;
}

.asp-primary:hover {
    background: #135e96 !important;
}

.asp-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.asp-row {
    padding: 12px 18px;
    border-bottom: 1px solid #2c3338;
    transition: background 0.1s;
}

.asp-row:hover {
    background: #232829;
}

.asp-row.asp-saved {
    border-left: 3px solid #00a32a;
}

.asp-original {
    font-size: 13px;
    line-height: 1.5;
    color: #e0e0e0;
    margin-bottom: 6px;
    word-break: break-word;
}

.asp-translation {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #555;
    border-radius: 3px;
    background: #2c3338;
    color: #72aee6;
    font-size: 13px;
    line-height: 1.4;
    resize: none;
    overflow: hidden;
    font-family: inherit;
    box-sizing: border-box;
}

.asp-translation:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
    background: #1d2327;
}

.asp-translation::placeholder {
    color: #666;
}

.asp-empty {
    padding: 40px 18px;
    text-align: center;
    color: #888;
}

/* RTL */
[dir="rtl"] .avasya-floating-switcher {
    right: auto;
    left: 20px;
}

[dir="rtl"] .avasya-floating-list {
    right: auto;
    left: 0;
}

/* Responsive */
@media (max-width: 600px) {
    .avasya-floating-switcher {
        bottom: 10px;
        right: 10px;
    }
    .avasya-floating-toggle {
        padding: 8px 12px;
        font-size: 13px;
    }
    .avasya-current-name {
        display: none;
    }
    #avasya-scan-toolbar {
        font-size: 11px;
        padding: 8px 12px;
    }
    .avasya-scan-actions {
        gap: 8px;
    }
}
