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

:root {
    --primary-color: #007AFF;
    --primary-hover: #0056b3;
    --primary-glow: rgba(0, 122, 255, 0.4);
    --background-start: #6DD5FA;
    --background-end: #FF758C;
    --container-bg: rgba(255, 255, 255, 0.3);
    --text-color: #f0f0f0;
    --subtle-text: #d0d0d0;
    --border-color: rgba(255, 255, 255, 0.2);
    --success-color: #34C759;
    --error-color: #FF3B30;
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

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

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

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(-45deg, var(--background-start), var(--background-end), #2980B9, #6DD5FA);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
    color: var(--text-color);
    margin: 0;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

#root {
    width: 100%;
    max-width: 700px;
}

.app-container {
    background: var(--container-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 0 15px var(--primary-glow), var(--shadow);
    padding: 2.5rem;
    transition: all 0.3s ease;
}

.app-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(31, 38, 135, 0.45);
}

h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    text-align: center;
    color: var(--subtle-text);
    margin-bottom: 2.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

input[type="text"], input[type="number"] {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]::placeholder { color: var(--subtle-text); }

input[type="text"]:focus, input[type="number"]:focus, .model-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.model-select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.4-5.4-12.8z%22/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 0.7em top 50%, 0 0;
    background-size: 0.65em auto, 100%;
}

.model-select option {
    background-color: #ffffff;
    color: #333333;
}

.file-input-container {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s, background-color 0.3s, transform 0.3s;
}

.file-input-container:hover {
    border-color: var(--primary-color);
    background-color: rgba(0, 122, 255, 0.1);
    transform: scale(1.02);
}

.file-input-container p {
    margin: 0;
    font-weight: 500;
}

.file-input-container .subtle {
    color: var(--subtle-text);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

button {
    width: 100%;
    padding: 0.85rem;
    border: none;
    border-radius: 8px;
    background-color: var(--primary-color);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s, box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

button:hover:not(:disabled) {
    background-color: var(--primary-hover);
    box-shadow: 0 0 20px var(--primary-glow);
    transform: translateY(-2px);
}

button:active:not(:disabled) {
    transform: scale(0.98) translateY(0);
}

button:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
    opacity: 0.6;
}

.status-bar {
    margin-top: 1.5rem;
    padding: 0.75rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    backdrop-filter: blur(5px);
}

.status-bar.success { background-color: rgba(52, 199, 89, 0.3); color: #ffffff; }
.status-bar.error { background-color: rgba(255, 59, 48, 0.3); color: #ffffff; }
.status-bar.info { background-color: rgba(0, 122, 255, 0.3); color: #ffffff; }

.text-list-container {
    margin-top: 2rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px; /* space for scrollbar */
}

/* Stylish Scrollbar */
.text-list-container::-webkit-scrollbar {
    width: 8px;
}

.text-list-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.text-list-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.text-list-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

.text-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.text-list-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.progress-counter {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    background-color: rgba(0, 122, 255, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
}

.select-all {
    font-size: 0.9rem;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 500;
    background-color: rgba(255,255,255,0.2);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    transition: background-color 0.3s;
}
.select-all:hover {
    background-color: rgba(255,255,255,0.4);
}

.text-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
    animation: slideIn 0.5s ease-out forwards;
}

.text-item.translating {
    background-color: rgba(0, 122, 255, 0.2);
}

.text-item.translated {
    border-left: 4px solid var(--success-color);
    background-color: rgba(52, 199, 89, 0.15);
    animation: shimmer 1s forwards, slideIn 0.5s ease-out forwards;
    background-image: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    background-repeat: no-repeat;
    background-size: 1000px 100%;
}

.text-item-checkbox {
    margin-right: 1rem;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.text-item-content {
    flex-grow: 1;
}

.original-text {
    font-size: 0.95rem;
    color: var(--text-color);
    margin: 0;
}

.translated-text {
    font-size: 0.95rem;
    color: var(--success-color);
    font-weight: 500;
    margin: 0.25rem 0 0 0;
}

.download-button-container {
    margin-top: 2rem;
    text-align: center;
}

.loader {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #fff;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 10px;
}
