/* Base Styles & Variables */
:root {
    --primary-color: #4a6bdf;
    --primary-dark: #3a56b2;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --error-color: #dc3545;
    --background: #f8f9fa;
    --card-bg: rgba(255, 255, 255, 0.9);
    --text-color: #333;
    --text-muted: #6c757d;
    --border-color: #e0e0e0;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --background: #1a1a2e;
    --card-bg: rgba(30, 30, 60, 0.9);
    --text-color: #f8f9fa;
    --text-muted: #adb5bd;
    --border-color: #2a2a4a;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background);
    color: var(--text-color);
    line-height: 1.6;
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    flex: 1;
    width: 100%;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 2.5rem;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, var(--primary-color), #6c5ce7);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Header & Logo Styles */
header {
    text-align: center;
    margin-bottom: 0rem;
    padding: 0rem 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 0rem;
    flex-wrap: wrap;
}

.logo {
    height: 60px;
    width: auto;
    border-radius: 4px;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.header-text {
    text-align: left;
}

.header-text h1 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--text-color);
    font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .header-text {
        text-align: center;
        width: 100%;
    }

    .logo {
        margin-bottom: 0rem;
        height: 50px;
    }

    .header-text h1 {
        font-size: 1.2rem;
    }
}

/* Ensure the header doesn't get too wide on large screens */
@media (min-width: 1200px) {
    .header-content {
        max-width: 1200px;
        margin: 0 auto 1rem;
    }
}

/* Translator Container */
.translator-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

/* Text Areas */
.text-container {
    position: relative;
    margin-bottom: 1rem;
}

.textarea-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.clear-btn {
    position: absolute;
    right: 10px;
    top: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    background-color: var(--card-bg);
    z-index: 2;
}

.clear-btn:hover {
    color: var(--error-color);
    background-color: rgba(0, 0, 0, 0.1);
}

.textarea-wrapper:hover .clear-btn,
.textarea-wrapper:focus-within .clear-btn,
.clear-btn:focus {
    opacity: 1;
    visibility: visible;
}

textarea:not(:placeholder-shown) + .clear-btn {
    opacity: 0.7;
    visibility: visible;
}

textarea:focus + .clear-btn {
    opacity: 1;
    visibility: visible;
}

textarea {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
    background: transparent;
    color: var(--text-color);
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 107, 223, 0.2);
}

.char-count {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--card-bg);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
}

.translation-output {
    min-height: 150px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: transparent;
    color: var(--text-color);
    overflow-y: auto;
}

.placeholder {
    color: var(--text-muted);
    font-style: italic;
}

/* Text Header */
.text-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.text-header h2 {
    font-size: 1.0rem;
    color: var(--text-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 107, 223, 0.3);
}

.secondary-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.secondary-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.random-btn {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
}

.random-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.icon-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.translate-button-container {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.translate-btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Loading Spinner */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1rem;
    text-align: center;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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

.hidden {
    display: none !important;
}

/* Notification */
.notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--card-bg);
    color: var(--text-color);
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    border-left: 4px solid var(--success-color);
}

.notification.show {
    opacity: 1;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 1.5rem;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.keyboard-shortcuts {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.shortcut kbd {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    font-family: monospace;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

/* Dark Mode Toggle */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.3rem;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
}

.theme-toggle i {
    font-size: 1.2rem;
    padding: 0.3rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .translator-container {
        padding: 1.5rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .keyboard-shortcuts {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .translate-btn {
        width: 100%;
    }
}

/* Animation for translation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.translation-output {
    animation: fadeIn 0.3s ease-out;
}
