:root {
  --bg-gradient-start: #2c3e50;
  --bg-gradient-end: #3498db;
  --container-bg: rgba(255, 255, 255, 0.1);
  --container-border: rgba(255, 255, 255, 0.18);
  --text-primary: white;
  --text-secondary: rgba(255, 255, 255, 0.9);
  --text-tertiary: rgba(255, 255, 255, 0.7);
  --text-placeholder: rgba(255, 255, 255, 0.6);
  --input-bg: rgba(255, 255, 255, 0.15);
  --input-bg-focus: rgba(255, 255, 255, 0.2);
  --input-border: rgba(255, 255, 255, 0.3);
  --input-border-focus: rgba(255, 255, 255, 0.5);
  --shadow: rgba(0, 0, 0, 0.3);
}

body.light-mode {
  --bg-gradient-start: #f5f7fa;
  --bg-gradient-end: #c3cfe2;
  --container-bg: rgba(255, 255, 255, 0.9);
  --container-border: rgba(0, 0, 0, 0.1);
  --text-primary: #2c3e50;
  --text-secondary: #34495e;
  --text-tertiary: #7f8c8d;
  --text-placeholder: #95a5a6;
  --input-bg: rgba(255, 255, 255, 0.8);
  --input-bg-focus: rgba(255, 255, 255, 1);
  --input-border: rgba(0, 0, 0, 0.2);
  --input-border-focus: rgba(52, 152, 219, 0.5);
  --shadow: rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  transition: background 0.3s ease;
}

.container {
  background: var(--container-bg);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 550px;
  box-shadow: 0 8px 32px var(--shadow);
  border: 1px solid var(--container-border);
  position: relative;
  transition: all 0.3s ease;
}

.theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: var(--input-bg-focus);
  transform: scale(1.1);
}

.header {
  text-align: center;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.header-icon {
  font-size: 40px;
}

h1 {
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 600;
}

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
}

input {
  width: 100%;
  padding: 14px 16px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: all 0.3s ease;
}

input:focus {
  background: var(--input-bg-focus);
  border-color: var(--input-border-focus);
}

input::placeholder {
  color: var(--text-placeholder);
}

button {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 20px;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.translation-result {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  padding: 16px;
  min-height: 60px;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
}

.translation-result.empty {
  color: var(--text-placeholder);
  font-style: italic;
}

.footer {
  text-align: center;
  margin-top: 20px;
  color: var(--text-tertiary);
  font-size: 12px;
}

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--input-border);
  border-radius: 50%;
  border-top-color: var(--text-primary);
  animation: spin 0.8s linear infinite;
  margin-right: 10px;
  vertical-align: middle;
}

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

.error {
  background: rgba(231, 76, 60, 0.3);
  border: 1px solid rgba(231, 76, 60, 0.5);
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

body.light-mode .error {
  background: rgba(231, 76, 60, 0.1);
  color: #c0392b;
  border-color: rgba(231, 76, 60, 0.3);
}

@media (max-width: 600px) {
  .container {
    padding: 30px 20px;
  }

  h1 {
    font-size: 24px;
  }

  .header-icon {
    font-size: 32px;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
}
