@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

.ai-translator-wrapper {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.ai-translator-wrapper * {
    box-sizing: border-box;
}

.ai-translator-container {
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 20px 50px -12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    position: relative;
}

.translator-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    padding: 30px 40px;
    text-align: center;
}

.translator-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #ffffff;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.translator-icon {
    width: 36px;
    height: 36px;
}

.translator-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    font-weight: 400;
    margin: 0;
}

.translator-body {
    padding: 30px 40px 40px;
}

.language-selectors {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 25px;
}

.language-selector {
    flex: 1;
    position: relative;
}

.language-selector label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.lang-input-wrapper {
    position: relative;
}

.lang-search {
    width: 100%;
    padding: 14px 45px 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    color: #1f2937;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.lang-search:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.lang-search::placeholder {
    color: #9ca3af;
}

.source-lang .lang-search {
    background: linear-gradient(135deg, #f0f4ff 0%, #f5f3ff 100%);
    cursor: default;
}

.search-icon,
.detect-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #9ca3af;
    pointer-events: none;
}

.detected-lang-label {
    display: block;
    font-size: 12px;
    color: #667eea;
    font-weight: 500;
    margin-top: 6px;
    min-height: 18px;
    animation: fadeIn 0.3s ease;
}

.swap-btn {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 28px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.swap-btn:hover {
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.swap-btn svg {
    width: 22px;
    height: 22px;
}

.language-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    margin-top: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.2s ease;
}

.language-dropdown.active {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lang-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #374151;
}

.lang-option:hover {
    background: linear-gradient(135deg, #f0f4ff 0%, #f5f3ff 100%);
    color: #667eea;
}

.lang-option.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.translation-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.panel {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.panel:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.input-panel textarea {
    width: 100%;
    min-height: 180px;
    padding: 20px;
    border: none;
    background: transparent;
    font-size: 16px;
    line-height: 1.6;
    color: #1f2937;
    resize: vertical;
    font-family: inherit;
}

.input-panel textarea:focus {
    outline: none;
}

.input-panel textarea::placeholder {
    color: #9ca3af;
}

.output-panel {
    background: linear-gradient(135deg, #f8faff 0%, #faf8ff 100%);
}

.output-content {
    min-height: 180px;
    padding: 20px;
    font-size: 16px;
    line-height: 1.6;
    color: #1f2937;
}

.placeholder-text {
    color: #9ca3af;
    font-style: italic;
}

.cultural-notes {
    padding: 0 20px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
    display: none;
}

.cultural-notes.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid #e5e7eb;
    background: rgba(255, 255, 255, 0.5);
}

.char-count {
    font-size: 13px;
    color: #9ca3af;
}

.clear-btn,
.action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.clear-btn:hover,
.action-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.action-btn svg,
.clear-btn svg {
    width: 18px;
    height: 18px;
}

.output-panel .panel-footer {
    justify-content: flex-end;
    gap: 8px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.translate-btn,
.intent-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.translate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.translate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.5);
}

.translate-btn:active {
    transform: translateY(0);
}

.intent-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(240, 147, 251, 0.4);
}

.intent-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(240, 147, 251, 0.5);
}

.translate-btn svg,
.intent-btn svg {
    width: 22px;
    height: 22px;
}

.intent-panel {
    margin-top: 25px;
    background: linear-gradient(135deg, #fdf4ff 0%, #fff5f5 100%);
    border: 2px solid #f5d0fe;
    border-radius: 16px;
    overflow: hidden;
    display: none;
    animation: fadeIn 0.3s ease;
}

.intent-panel.active {
    display: block;
}

.intent-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #ffffff;
    font-weight: 600;
}

.intent-header svg {
    width: 22px;
    height: 22px;
}

.close-intent {
    margin-left: auto;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-intent:hover {
    background: rgba(255, 255, 255, 0.3);
}

.close-intent svg {
    width: 18px;
    height: 18px;
}

.intent-content {
    padding: 20px;
    font-size: 15px;
    line-height: 1.7;
    color: #374151;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(5px);
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner-ring {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    position: absolute;
    border: 3px solid transparent;
    animation: spin 1.5s linear infinite;
}

.spinner-ring:nth-child(1) {
    border-top-color: #667eea;
    animation-delay: 0s;
}

.spinner-ring:nth-child(2) {
    border-right-color: #764ba2;
    animation-delay: 0.2s;
    width: 50px;
    height: 50px;
}

.spinner-ring:nth-child(3) {
    border-bottom-color: #f093fb;
    animation-delay: 0.4s;
    width: 40px;
    height: 40px;
}

.loading-spinner {
    position: relative;
    width: 60px;
    height: 60px;
}

.loading-text {
    position: absolute;
    top: 80px;
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .ai-translator-wrapper {
        padding: 10px;
    }
    
    .translator-header {
        padding: 24px 20px;
    }
    
    .translator-title {
        font-size: 22px;
    }
    
    .translator-title svg {
        width: 28px;
        height: 28px;
    }
    
    .translator-body {
        padding: 20px;
    }
    
    .language-selectors {
        flex-direction: column;
        gap: 15px;
    }
    
    .swap-btn {
        align-self: center;
        margin: 0;
        transform: rotate(90deg);
    }
    
    .swap-btn:hover {
        transform: rotate(270deg) scale(1.1);
    }
    
    .translation-panels {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .translate-btn,
    .intent-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .translator-title {
        font-size: 18px;
    }
    
    .translator-subtitle {
        font-size: 13px;
    }
    
    .lang-search {
        padding: 12px 40px 12px 14px;
        font-size: 14px;
    }
    
    .input-panel textarea,
    .output-content {
        min-height: 150px;
        padding: 16px;
        font-size: 15px;
    }
    
    .translate-btn,
    .intent-btn {
        padding: 14px 24px;
        font-size: 15px;
    }
}

.language-dropdown::-webkit-scrollbar {
    width: 8px;
}

.language-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.language-dropdown::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

.language-dropdown::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

.copy-success {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    animation: slideUp 0.3s ease, fadeOut 0.3s ease 1.7s forwards;
    z-index: 1000;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}
