/* Reset and global settings */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  overflow-x: hidden;
  background-color: var(--bg-color);
  color: var(--text-color);
}

:root {
  --bg-color: #f4f4f4;
  --text-color: #111;
  --container-bg: rgba(255, 255, 255, 0.3);
  --box-color: #333;
  --heading-color: #2c3e50;
}

[data-theme="dark"] {
  --bg-color: #121212;
  --text-color: #eee;
  --container-bg: rgba(0, 0, 0, 0.3);
  --box-color: #ddd;
  --heading-color: #81ecec;
}

/* Smooth theme transitions */
body, .container, .result-box {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Theme background image */
.background img {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: -1;
  filter: blur(8px);
  transition: opacity 0.3s ease;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
}

.project-title {
  font-size: 2rem;
  font-weight: bold;
  background: linear-gradient(to right, #3498db, #8e44ad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

[data-theme="dark"] .project-title {
  background: linear-gradient(to right, #00cec9, #fd79a8);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

/* Optimize theme toggle */
.theme-toggle {
  font-size: 2.5rem;
  background: none;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease;
  will-change: transform;
}

.theme-toggle:active {
  transform: scale(0.9);
}

/* Main container */
.container {
  max-width: 600px;
  margin: 2rem auto;
  padding: 2rem;
  background: var(--container-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background-clip: padding-box;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
}

/* File & Text Input Styles */
.input-options {
  display: flex;
  justify-content: space-around;
  margin-bottom: 1rem;
}

.input-section {
  margin: 1rem 0;
  transition: all 0.3s ease;
}

#fileInput {
  width: 100%;
  padding: 0.5rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  background: rgba(255, 255, 255, 0.1);
}

#textBox {
  width: calc(100% - 2cm);
  margin-left: 1cm;
  margin-right: 1cm;
  height: 200px;
  padding: 1rem;
  border-radius: 10px;
  resize: none;
  border: 1px solid #aaa;
  font-size: 1rem;
  background-color: rgba(255,255,255,0.1);
  color: var(--text-color);
}

/* Submit button */
.submit-btn {
  display: block;
  margin: 1rem auto;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  border: none;
  background-color: #0984e3;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.submit-btn:hover, .submit-btn:active {
  background-color: #74b9ff;
  transform: scale(0.98);
}

/* Result box */
.result-box {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
  background-color: rgba(0, 0, 0, 0.1);
  color: var(--text-color);
  text-align: center;
  font-weight: bold;
}

/* Utility */
.hidden {
  display: none;
}
.result-container {
    margin-top: 20px;
    padding: 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(5px);
    font-size: 1rem;
    color: inherit;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}
.loader {
    border: 6px solid rgba(255,255,255,0.1);
    border-top: 6px solid #00e5ff;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: spin 1s linear infinite;
    margin-top: 10px;
}

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

/* Fast click for all interactive elements */
button, input, label, .theme-toggle {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  user-select: none;
  -webkit-user-select: none;
}

/* Radio button labels for better touch targets */
.input-options label {
  display: inline-block;
  padding: 0.5rem 1rem;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s ease;
  border-radius: 5px;
}

.input-options label:active {
  background: rgba(0,0,0,0.1);
}
