:root {
  /* Light theme - Soft, warm palette */
  --bg-color: #f8f9fa;
  --text-color: #2d3748;
  --card-bg: #f8f9fa;
  --border-color: #e2e8f0;
  --primary: #5a67d8;
  /* Softer indigo */
  --primary-hover: #4c51bf;
  --primary-active: #434190;
  --secondary: #f7fafc;
  --accent: #9f7aea;
  /* Soft purple accent */
  --success: #48bb78;
  /* Softer green */
  --warning: #ed8936;
  /* Warm orange */
  --error: #f56565;
  /* Soft red */
  --highlight: #ebf4ff;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  --surface-gradient: linear-gradient(to bottom right, #ffffff, #f7fafc);
}

[data-theme="dark"] {
  /* Dark theme - Deep rich palette */
  --bg-color: #0f172a;
  /* Navy blue */
  --text-color: #f8fafc;
  --card-bg: #1e293b;
  /* Dark slate */
  --border-color: #334155;
  --primary: #818cf8;
  /* Lighter indigo */
  --primary-hover: #6366f1;
  --primary-active: #4f46e5;
  --secondary: #1e293b;
  --accent: #f472b6;
  /* Lighter pink */
  --success: #34d399;
  /* Brighter green */
  --warning: #fbbf24;
  /* Brighter amber */
  --error: #f87171;
  /* Soft red */
  --highlight: #3730a3;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.25), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

/* Backgrounds */
body {
  background: var(--surface-gradient);
  background-attachment: fixed;
}

[data-theme="dark"] body {
  background: linear-gradient(135deg, #0f172a 0%, #1a202c 100%);
  background-attachment: fixed;
}

/* Cards */
.card {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.card:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .card {
  background: linear-gradient(145deg, var(--card-bg) 0%, rgba(0, 0, 0, 0.1) 100%);
  border-color: var(--border-color);
}

/* Buttons */
button,
.button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

button::after,
.button::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
  pointer-events: none;
}

button:hover,
.button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

button:active,
.button:active {
  background: var(--primary-active);
  transform: translateY(0);
}

/* Input focus glow */
input:focus,
textarea:focus {
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus {
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.4);
}

/* Add smooth transitions for theme changes */
body,
.card,
button,
input,
textarea {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Improve card styling */
.card {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
}

/* Better button styling */
button,
.button {
  background-color: var(--primary);
  color: white;
  transition: all 0.2s ease;
}

button:hover,
.button:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

button:active,
.button:active {
  background-color: var(--primary-active);
}

/* Improve active nav item styling */
#receive-nav-btn.active,
#send-nav-btn.active {
  background-color: var(--primary);
  color: white;
  box-shadow: inset 0 -2px 0 white;
}

/* Better input fields */
input,
textarea {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--highlight);
}

body {
  transition: background-color 0.3s ease, color 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  line-height: 1.6;
  padding: 20px 0;
}

/* Theme toggle button */
.theme-toggle {
  position: relative;
  width: 50px;
  height: 25px;
  border-radius: 25px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  cursor: pointer;
  overflow: hidden;
}

.theme-toggle::before {
  content: "☀️☽";
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;

}

[data-theme="dark"] .theme-toggle::before {
  transform: rotate(180deg);
}

/* Optional: System preference detection */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #1a1a1a;
    --text-color: #f5f5f5;
    --card-bg: #2d2d2d;
    --border-color: #444444;
  }

  [data-theme="light"] {
    --bg-color: #ffffff;
    --text-color: #333333;
    --card-bg: #f5f5f5;
    --border-color: #e0e0e0;
  }
}


/* Make cards stand out more */
.card {
  background: var(--pico-card-background-color);
  border-radius: var(--pico-border-radius);
  box-shadow: var(--pico-box-shadow);
  padding: var(--pico-block-spacing-vertical) var(--pico-block-spacing-horizontal);
  margin-bottom: var(--pico-block-spacing-vertical);
  border: 1px solid var(--pico-border-color);
}

/* Navbar styles */
nav.container-fluid {
  padding: 1rem;
  margin-bottom: 2rem;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-bottom: none;
  backdrop-filter: blur(8px);
  background-blend-mode: overlay;
}

nav ul {
  margin: 0;
}

nav li strong {
  font-size: 1.25rem;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

nav a {
  color: rgba(255, 255, 255, 0.9) !important;
  transition: all 0.2s ease;
}

nav a:hover {
  color: white !important;
  transform: translateY(-1px);
}

#theme-toggle {
  margin: 0;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

#theme-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* Highlight active nav item */
#receive-nav-btn.active,
#send-nav-btn.active {
  background-color: var(--pico-primary);
  color: white;
}

/* Professional card styles */
.card {
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Improved button styles */
button,
.button {
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

button:hover,
.button:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
}

button.secondary {
  background-color: white;
  color: var(--primary);
  border: 1px solid var(--border-color);
}

button.secondary:hover {
  background-color: var(--secondary);
  border-color: var(--primary-light);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --border-color: #444;
    --text-color: #f0f0f0;
    --text-muted: #aaa;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  }
}

/* Mobile improvements */
@media (max-width: 768px) {
  .container {
    padding: 0 10px;
  }

  header {
    margin-bottom: 1rem;
  }

  .card {
    padding: 1rem;
  }

  .tab-buttons button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .wide-input {
    font-size: 0.9rem;
    padding: 0.5rem;
  }

  .dropzone {
    padding: 1rem;
  }

  .code-display {
    font-size: 1.5rem;
    padding: 0.75rem;
  }
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 15px;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

.hero h1 {
  margin-bottom: 1rem;
  background: linear-gradient(to right, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero {
  text-align: center;
  margin: 2rem 0 3rem;
  padding: 2rem 0;
}

.subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

.footer {
  background-color: var(--card-bg);
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: 3rem;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--primary);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.footer-link:hover {
  color: var(--primary);
}

.footer-copyright {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* Card styles */
.card {
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Tab navigation */
.tab-container {
  margin-bottom: 2rem;
}

.tab-buttons {
  display: flex;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.tab-buttons button {
  background: transparent;
  border: none;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.tab-buttons button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-buttons button .tab-icon {
  font-size: 1.2rem;
}

.tab-buttons button:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* QR code display */
#qrcode-container {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
}

#qrcode {
  padding: 1rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#qrcode-fallback {
  padding: 1rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-size: 1.2rem;
  text-align: center;
  display: none;
}

#peer-id-display {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 500;
  margin: 1rem 0;
  word-break: break-all;
}

/* Connection request */
.verification-code {
  margin: 1rem 0;
  text-align: center;
}

.code-display {
  font-size: 2rem;
  font-weight: bold;
  letter-spacing: 2px;
  background: #f1f3f5;
  padding: 1rem;
  border-radius: 8px;
  display: inline-block;
  margin: 0.5rem 0;
  color: var(--primary-color);
}

/* Scanner */
#scanner-container {
  width: 100%;
  height: 0;
  padding-bottom: 75%;
  position: relative;
  margin: 1rem 0;
  overflow: hidden;
  border-radius: 8px;
  display: none;
}

#scanner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 2px solid var(--primary-color);
  box-sizing: border-box;
  pointer-events: none;
}

/* Send options */
.options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .options {
    grid-template-columns: 1fr 1fr;
  }
}

.option-card {
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  padding: 1.25rem;
  border: 1px solid var(--border-color);
}

/* Wide input for connection code */
.wide-input {
  width: 100%;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0 1rem;
}

/* Tabs */
.tabs {
  display: flex;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Text input */
textarea {
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  min-height: 150px;
  margin-bottom: 1rem;
  transition: var(--transition);
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  margin: 1rem 0;
  transition: border-color 0.2s ease;
}

.dropzone:hover,
.dropzone.active {
  border-color: var(--primary-color);
}

.dropzone .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.dropzone-text {
  margin: 0.5rem 0;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Progress bar */
.progress-container {
  margin: 1.5rem 0;
  position: relative;
}

.progress-bar {
  height: 20px;
  background-color: #e9ecef;
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  display: block;
  height: 100%;
  width: 0%;
  background-color: var(--primary-color);
  transition: width 0.3s ease;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: 500;
  color: var(--text-color);
}

.transfer-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Button groups */
.button-group {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

/* Connection status */
.connection-status {
  text-align: center;
  margin: 1rem 0;
  padding: 0.5rem;
  border-radius: 4px;
  background-color: #e9ecef;
  font-weight: 500;
  color: var(--bg-color);
}

/* Utility classes */
.hidden {
  display: none !important;
}

.error {
  color: var(--error-color);
  padding: 0.5rem;
  margin: 0.5rem 0;
  border-radius: 4px;
  background-color: rgba(240, 62, 62, 0.1);
}

/* File info display */
#selected-file-info,
#file-info-sender,
#file-info-receiver,
#download-file-info,
#complete-file-info {
  margin: 1rem 0;
  padding: 1rem;
  background-color: #f1f3f5;
  border-radius: 8px;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.file-preview-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  object-fit: contain;
  background: white;
  padding: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.file-preview-video {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  background: black;
}

.file-preview-audio {
  width: 100%;
  margin-top: 1rem;
}

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