:root {
  --primary-color: #fa7a30;
  --primary-light: #f85321;
  --surface-color: #383838;
  --background-color: #292929;
  --text-color: #ffffff;
  --secondary-text: #979797;
  --border-color: #535353;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  background-color: var(--surface-color);
  box-shadow: var(--shadow);
  padding: 1rem;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  color: var(--text-color);
  font-size: 1.8rem;
  margin: 0;
}

.p2p{
  color:var(--primary-light);
}

main {
  flex: 1;
  padding: 1rem;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

.container {
  background-color: var(--surface-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 2rem;
}

.tab-container {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  position: relative;
  font-weight: 500;
  color: var(--secondary-text);
}

#file-name{
  display: flex;
  word-wrap: break-word;
  word-break: break-all;
}
.tab.active {
  color: var(--primary-color);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary-color);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.file-input-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 1rem;
}

.file-input {
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

button{
  display: flex;
  justify-content: center;
  align-items: center;
}

.file-input-button {
  display: block;
  width: 100%;
  padding: 2.5rem 1rem;
  text-align: center;
  background-color: var(--background-color);
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}


.file-input-button:hover {
  border-color: var(--primary-light);
}

.file-input-icon {
  display: block;
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--secondary-text);
}

.selected-file {
  margin-top: 1rem;
  padding: 0.75rem;
  background-color: var(--background-color);
  border-radius: 4px;
  display: none;
}

.selected-file.active {
  display: block;
}

.link-input-container {
  display: flex;
  width: 100%;
  gap: 0.5rem;
}

input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  background-color: var(--background-color);
}

button {
  background-color: var(--primary-color);
  color: var(--surface-color);
  border: none;
  border-radius: 4px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: var(--primary-light);
}

button:disabled {
  background-color: var(--border-color);
  cursor: not-allowed;
}

.icon-button {
  padding: .5em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon {
  font-size: 1.2rem;
}

.result {
  margin-top: 1.5rem;
  padding: 1rem;
  background-color: var(--background-color);
  border-radius: 4px;
  display: none;
}

.result.active {
  display: block;
}

.copy-link {
  display: flex;
  margin-top: 1rem;
}

.copy-link input {
  flex: 1;
  margin-right: 0.5rem;
}

.copy-button {
  white-space: nowrap;
}

.qrcode-container {
  margin-top: 1.5rem;
  text-align: center;
}

#qrcode {
  display: inline-block;
  padding: 0;
  /* background-color: var(--secondary-text); */
  border-radius: 4px;
  padding: 0;
}

.scanner-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 600px;
  margin-bottom: 1rem;
  color: white;
}

.video-container {
  width: 100%;
  max-width: 600px;
  position: relative;
}

.video-container.scanner {
  aspect-ratio: 1/1;
  overflow: hidden;
  border-radius: 8px;
}

#scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.5);
  border: 2px solid var(--primary-color);
  border-radius: 8px;
}

.scanner-controls {
  margin-top: 1.5rem;
}

.file-preview-container {
  margin-top: 1.5rem;
  width: 100%;
}

.preview-item {
  width: 100%;
  display: none;
  margin-bottom: 1.5rem;
}

video, audio, iframe {
  width: 100%;
  max-height: 60vh;
  background-color: black;
  border-radius: 4px;
}

#image-preview {
  max-width: 100%;
  max-height: 60vh;
  margin: 0 auto;
  display: block;
  border-radius: 4px;
}

#pdf-preview {
  height: 70vh;
  border: none;
}

#text-preview {
  padding: 1rem;
  background-color: white;
  border-radius: 4px;
  overflow-x: auto;
  white-space: pre-wrap;
  max-height: 60vh;
  overflow-y: auto;
}

#other-container {
  text-align: center;
  padding: 2rem;
  background-color: white;
  border-radius: 4px;
}

.file-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.download-container {
  margin-top: 1.5rem;
  text-align: center;
}

.download-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
}

.status {
  margin-top: 1rem;
  color: var(--secondary-text);
}

.peers-info {
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--secondary-text);
}

.info-box {
  margin-top: 1.5rem;
  padding: 1rem;
  background-color: var(--background-color);
  border-radius: 4px;
  border-left: 4px solid var(--primary-color);
}

.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(94, 53, 177, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s linear infinite;
  margin-right: 0.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
  
  .tab {
    padding: 0.75rem 1rem;
  }

  header{
    padding-top: calc(0.5em + env(safe-area-inset-top));;
  }
}