/**
 * Translate Me Widget Styles
 */

:root {
    --tm-widget-bg: #ffffff;
    --tm-widget-text: #333333;
    --tm-widget-border: #e0e0e0;
    --tm-accent-color: #2271b1;
    --tm-accent-hover: #135e96;
    --tm-border-radius: 8px;
    --tm-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Widget Container */
.tm-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.tm-widget.tm-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.tm-widget.tm-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.tm-widget.tm-position-top-right {
    top: 20px;
    right: 20px;
}

.tm-widget.tm-position-top-left {
    top: 20px;
    left: 20px;
}

/* Toggle Button */
.tm-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: var(--tm-widget-bg);
    border: 1px solid var(--tm-widget-border);
    border-radius: var(--tm-border-radius);
    box-shadow: var(--tm-shadow);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--tm-widget-text);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tm-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

.tm-toggle-icon {
    font-size: 18px;
}

.tm-toggle-text {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Panel */
.tm-panel {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: var(--tm-widget-bg);
    border: 1px solid var(--tm-widget-border);
    border-radius: var(--tm-border-radius);
    box-shadow: var(--tm-shadow);
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.tm-widget.tm-position-bottom-left .tm-panel,
.tm-widget.tm-position-top-left .tm-panel {
    right: auto;
    left: 0;
}

.tm-widget.tm-position-top-right .tm-panel,
.tm-widget.tm-position-top-left .tm-panel {
    bottom: auto;
    top: calc(100% + 10px);
    transform: translateY(-10px);
}

.tm-widget.tm-expanded .tm-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tm-widget.tm-position-top-right.tm-expanded .tm-panel,
.tm-widget.tm-position-top-left.tm-expanded .tm-panel {
    transform: translateY(0);
}

/* Language List */
/* Panel Header */
.tm-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--tm-widget-border);
    font-weight: 600;
    color: var(--tm-widget-text);
}

.tm-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #646970;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.tm-close:hover {
    background: #f0f0f1;
    color: #d63638;
}

.tm-languages {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.tm-languages li {
    margin: 0;
    padding: 0;
}

.tm-language-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    color: var(--tm-widget-text);
    transition: background 0.15s ease;
}

.tm-language-btn:hover {
    background: #f0f0f1;
}

.tm-language-btn.tm-active {
    background: #f0f6fc;
    color: var(--tm-accent-color);
    font-weight: 500;
}

.tm-flag {
    font-size: 16px;
    line-height: 1;
}

.tm-language-name {
    flex: 1;
}

.tm-check {
    opacity: 0;
    color: var(--tm-accent-color);
}

.tm-language-btn.tm-active .tm-check {
    opacity: 1;
}

/* Dismiss Button */
.tm-dismiss {
    display: block;
    width: calc(100% - 32px);
    margin: 0 16px 16px;
    padding: 8px;
    border: 1px solid var(--tm-widget-border);
    border-radius: 4px;
    background: transparent;
    color: #646970;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tm-dismiss:hover {
    background: #fcf0f1;
    color: #d63638;
    border-color: #d63638;
}

/* Shortcode Select */
.tm-shortcode-select {
    position: relative;
    display: inline-block;
}

.tm-shortcode-select select {
    appearance: none;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--tm-widget-border);
    border-radius: 4px;
    background: var(--tm-widget-bg);
    font-size: 14px;
    cursor: pointer;
    min-width: 150px;
}

.tm-shortcode-select::after {
    content: '▼';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #646970;
    pointer-events: none;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .tm-widget.tm-position-bottom-right,
    .tm-widget.tm-position-bottom-left,
    .tm-widget.tm-position-top-right,
    .tm-widget.tm-position-top-left {
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
    }
    
    .tm-toggle {
        margin: 10px;
    }
    
    .tm-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        max-height: 70vh;
        border-radius: var(--tm-border-radius) var(--tm-border-radius) 0 0;
        transform: translateY(100%);
    }
    
    .tm-widget.tm-expanded .tm-panel {
        transform: translateY(0);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .tm-toggle,
    .tm-panel,
    .tm-language-btn {
        transition: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .tm-toggle,
    .tm-panel {
        border-width: 2px;
    }
}
