* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #f4f4f6;
  margin: 0;
  padding: 2rem 1rem;
  color: #1a1a1a;
}

.container {
  max-width: 600px;
  margin: 0 auto;
}

h1 {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

#url-input {
  flex: 1;
  padding: 0.7rem 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
}

button {
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: 8px;
  background: #1a1a1a;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

button:hover {
  background: #333;
}

button:disabled {
  background: #999;
  cursor: not-allowed;
}

.error {
  color: #c0392b;
  margin-top: 1rem;
}

.loading {
  color: #555;
  margin-top: 1rem;
}

/* Phai co !important vi cac rule .preview/.modal-overlay ben duoi cung dung
   display: flex va cung specificity, se ghi de neu khong uu tien. */
.hidden {
  display: none !important;
}

.preview {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  background: #fff;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.preview video {
  width: 200px;
  max-height: 280px;
  object-fit: cover;
  border-radius: 8px;
  background: #000;
}

.preview-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.preview-info h2 {
  font-size: 1.1rem;
  margin: 0;
}

.preview-info p {
  margin: 0;
  color: #666;
}

.preview-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.modal-info {
  max-width: 520px;
}

.info-content {
  max-height: 60vh;
  overflow-y: auto;
}

.info-heading {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #888;
  margin: 1rem 0 0.4rem;
}

.info-heading:first-child {
  margin-top: 0;
}

.info-row {
  display: flex;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9rem;
}

.info-label {
  flex: 0 0 38%;
  color: #666;
}

.info-value {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

button.secondary {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #ccc;
}

button.secondary:hover {
  background: #f0f0f0;
}

.history-section {
  margin-top: 2rem;
}

.history-section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #fff;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.history-info {
  min-width: 0;
}

.history-filename {
  margin: 0;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: #888;
}

.history-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

button.secondary.danger {
  color: #c0392b;
  border-color: #e0a9a2;
}

button.secondary.danger:hover {
  background: #fdecea;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.modal input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.watch-container {
  max-width: 700px;
}

.watch-container .preview {
  flex-direction: column;
}

.watch-container video {
  width: 100%;
  max-height: 70vh;
}

.button-link {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  border-radius: 8px;
  background: #1a1a1a;
  color: #fff;
  font-size: 1rem;
  text-decoration: none;
}

.button-link:hover {
  background: #333;
}
