/* --- Variables & Reset --- */
:root {
  --bg-body: #f3f4f6;
  --bg-card: #ffffff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-light: #e0e7ff;
  --success: #10b981;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* --- App Wrapper --- */
.app-wrapper {
  width: 100%;
  max-width: 1000px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: #f0fdf4;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid #bbf7d0;
}

.dot {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* --- Layout Body --- */
.app-body {
  display: flex;
  min-height: 500px;
}

/* --- Sidebar --- */
.sidebar {
  width: 280px;
  background: #fafafa;
  border-right: 1px solid var(--border);
  padding: 25px;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.sidebar-header h2 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.badge {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 10px;
}

.peer-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.peer-list li {
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.peer-list li::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.peer-list li:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.peer-list li.selected {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.empty-state {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.85rem;
  cursor: default !important;
  border: none !important;
  background: transparent !important;
  justify-content: center;
}
.empty-state::before { display: none; }

/* --- Content Area --- */
.content {
  flex: 1;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- Drop Zone --- */
.drop-zone {
  border: 2px dashed #d1d5db;
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  background: #f9fafb;
  transition: all 0.2s ease;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
}

.drop-zone-content svg {
  color: var(--accent);
}

.drop-zone-content p {
  font-size: 0.95rem;
}

.drop-zone-content strong {
  color: var(--accent);
}

.file-hint {
  font-size: 0.75rem;
  color: #9ca3af;
}

/* --- Action Bar --- */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  padding: 15px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.selected-info {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.btn-send {
  padding: 12px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-send:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-send:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

/* --- Transfers Section --- */
.transfers-section h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 15px;
}

.transfers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 250px;
  overflow-y: auto;
}

.received-file, .progress-item {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 15px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.received-file a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.received-file a:hover { text-decoration: underline; }

/* --- ANIMATED PROGRESS BAR --- */
.progress-wrapper {
  flex-grow: 1;
  margin: 0 15px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  border-radius: 4px;
  /* THE MAGIC: Smooth animated transition */
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .app-body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 15px 20px;
    max-height: 200px;
    overflow-y: auto;
  }

  .peer-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .peer-list li {
    flex: 1 1 auto;
    justify-content: center;
  }

  .content {
    padding: 20px;
  }

  .action-bar {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .btn-send {
    width: 100%;
  }

  .drop-zone {
    padding: 30px 15px;
  }
}