:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-search: #ffffff;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --border-color: #dfe1e5;
  --hover-bg: #f8f9fa;
  --shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
  --accent: #1a73e8;
}

[data-theme="dark"] {
  --bg-primary: #202124;
  --bg-secondary: #303134;
  --bg-search: #303134;
  --text-primary: #e8eaed;
  --text-secondary: #9aa0a6;
  --border-color: #5f6368;
  --hover-bg: #303134;
  --shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  --accent: #8ab4f8;
}

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

body {
  font-family: "Noto Nastaliq Urdu", serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}

.navbar-btn {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  display: flex;
  gap: 1rem;
  z-index: 1000;
}

/* Fixed Toggle Buttons */
.theme-toggle,
.translator-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 2.75rem;
  height: 2.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.25rem;
}

.theme-toggle {
  left: 1.25rem;
}

.translator-toggle {
  left: 5rem;
}

.theme-toggle:hover,
.translator-toggle:hover {
  background: var(--hover-bg);
  transform: scale(1.1);
  box-shadow: var(--shadow);
}

/* Homepage Layout */
.homepage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.logo {
  width: 100%;
  max-width: 700px;
  margin-bottom: 2rem;
  animation: fadeIn 0.6s ease-in;
}

.logo img {
  width: 100%;
  height: auto;
  display: block;
}

/* Search Container */
.search-container {
  width: 100%;
  max-width: 884px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-search);
  border: 1px solid var(--border-color);
  border-radius: 3rem;
  padding: 0.75rem 1.25rem;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
}

.search-box:hover,
.search-box:focus-within {
  box-shadow: 0 2px 12px rgba(32, 33, 36, 0.35);
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: "Noto Nastaliq Urdu", serif;
  font-size: 1rem;
  color: var(--text-primary);
  direction: rtl;
  padding: 0 0.625rem;
}

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

/* Button Group */
.button-group {
  display: flex;
  width: 100%;
  justify-content: center;
  margin-top: 2rem;
}

.search-btn,
.chat-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-family: "Noto Nastaliq Urdu", serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  width: 35%;
  margin: 1rem;
}

.search-btn:hover {
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
  transform: translateY(-2px);
}

.chat-btn:hover {
  box-shadow: 0 4px 12px rgba(52, 168, 83, 0.3);
  transform: translateY(-2px);
}

.search-btn:active,
.chat-btn:active {
  transform: translateY(0);
}

/* Sidebar */
.sidebar {
  width: 100%;
  max-width: 400px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  height: 100vh;
  position: fixed;
  right: -100%;
  top: 0;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 2px solid var(--border-color);
  z-index: 999;
  overflow-y: auto;
}

.sidebar.open {
  right: 0;
}

.sidebar-header {
  background: var(--bg-primary);
  padding: 1rem 1.25rem;
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1;
}

.sidebar-header:hover {
  background: var(--hover-bg);
}

.sidebar-content {
  padding: 1.5rem;
}

.sidebar-content label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

textarea {
  width: 100%;
  min-height: 120px;
  margin-bottom: 1rem;
  padding: 0.75rem;
  resize: vertical;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 0.5rem;
  font-family: "Noto Nastaliq Urdu", serif;
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.box {
  direction: ltr;
  text-align: left;
}

.box-urdu {
  direction: rtl;
}

.translate-btn,
.copy-btn {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: none;
  cursor: pointer;
  border-radius: 0.5rem;
  font-family: "Noto Nastaliq Urdu", serif;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.translate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.4);
}

.translate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.copy-btn {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.copy-btn:hover {
  background: var(--accent);
  color: white;
  transform: translateY(-2px);
}

.copy-btn.copied {
  background: #34a853;
  color: white;
}

/* Loading State */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.25rem;
  height: 1.25rem;
  margin: -0.625rem 0 0 -0.625rem;
  border: 3px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

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

/* Responsive Breakpoints */
@media (max-width: 768px) {
  .button-group{
    flex-direction: column;
    align-items: center;
  }

  .search-btn,
  .chat-btn {
    width: 90%;
  }

  .theme-toggle,
  .translator-toggle {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.125rem;
    top: 1rem;
  }

  .theme-toggle {
    left: 1rem;
  }

  .translator-toggle {
    left: 4rem;
  }

  .logo {
    max-width: 520px;
    margin-bottom: 1.5rem;
  }

  .search-container {
    max-width: 100%;
  }

  .search-box {
    padding: 0.625rem 1rem;
  }

  .search-input {
    font-size: 0.9375rem;
  }

  .search-btn,
  .chat-btn {
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
  }

  .sidebar {
    max-width: 100%;
  }

  .sidebar-content {
    padding: 1.25rem;
  }

  .sidebar {
    z-index: 1001;
  }
}

@media (max-width: 576px) {
  .logo {
    max-width: 380px;
  }

  .theme-toggle,
  .translator-toggle {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1rem;
  }

  .sidebar-header {
    font-size: 1.125rem;
    padding: 0.875rem 1rem;
  }

  textarea {
    min-height: 100px;
  }

  .sidebar {
    z-index: 1001;
  }
}

@media (max-width: 400px) {
  .sidebar {
    z-index: 1001;
  }

  .homepage {
    padding: 0.75rem;
  }

  .logo {
    max-width: 200px;
  }

  .search-box {
    padding: 0.5rem 0.875rem;
  }
}

/* Usage Guide Section */
.usage-guide {
  margin-top: 3rem;
  padding: 2rem;
  background-color: var(--bg-secondary);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.usage-guide h2 {
  text-align: center;
  font-size: 1.75rem;
  margin-bottom: 2rem;
  color: var(--accent);
}

.guide-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.guide-item {
  padding: 1.5rem;
  background-color: var(--bg-primary);
  border-radius: 0.5rem;
  border-left: 4px solid var(--accent);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.guide-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.guide-item h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
}

.guide-item p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.guide-item code {
  background-color: var(--bg-secondary);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-family: 'Courier New', monospace;
  color: var(--accent);
  word-break: break-word;
}

@media (max-width: 768px) {
  .usage-guide {
    margin-top: 2rem;
    padding: 1.5rem;
  }

  .usage-guide h2 {
    font-size: 1.5rem;
  }

  .guide-content {
    grid-template-columns: 1fr;
  }

  .guide-item {
    padding: 1rem;
  }

  .guide-item h3 {
    font-size: 1.1rem;
  }

  .guide-item p {
    font-size: 0.9rem;
  }
}
