/* Estilos gerais e de layout já usados nas versões anteriores,
   com adição de estilos para tela de login e gerenciamento de usuários. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1f2937 0, #020617 55%);
  color: #e5e7eb;
  min-height: 100vh;
}

/* ===== LOGIN ===== */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
  padding: 16px;
}

.login-card {
  background: rgba(15,23,42,0.98);
  border-radius: 16px;
  padding: 20px 22px 22px;
  border: 1px solid rgba(148,163,184,0.35);
  box-shadow: 0 20px 50px rgba(15,23,42,0.9);
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 1.4rem;
}

.login-subtitle {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: #9ca3af;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  gap: 4px;
}

.login-form input {
  border-radius: 10px;
  border: 1px solid rgba(55,65,81,0.85);
  background: rgba(15,23,42,0.95);
  color: #e5e7eb;
  padding: 8px 10px;
  outline: none;
}

.login-form input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59,130,246,0.6);
}

.login-error {
  background: rgba(248,113,113,0.12);
  border: 1px solid rgba(248,113,113,0.6);
  color: #fecaca;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.login-footer {
  margin-top: 10px;
  font-size: 0.8rem;
  color: #9ca3af;
  text-align: center;
}

/* ===== APP PRINCIPAL ===== */

.app {
  max-width: 1080px;
  margin: 24px auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.app-header {
  padding: 16px 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(37,99,235,0.25), rgba(14,165,233,0.16));
  border: 1px solid rgba(148,163,184,0.4);
  box-shadow: 0 18px 40px rgba(15,23,42,0.6);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.app-header h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
}

.app-header p {
  margin: 0;
  font-size: 0.95rem;
  color: #cbd5f5;
}

.user-info {
  text-align: right;
  font-size: 0.85rem;
}

.user-name {
  font-weight: 500;
}

.user-role {
  color: #a5b4fc;
  font-size: 0.8rem;
}

.user-actions {
  margin-top: 4px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-link {
  font-size: 0.8rem;
  color: #bfdbfe;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.6);
  background: rgba(15,23,42,0.4);
}

.btn-link:hover {
  background: rgba(30,64,175,0.6);
}

.btn-link-danger {
  color: #fecaca;
  border-color: rgba(248,113,113,0.7);
}

.app-main {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 16px;
}

.controls-card,
.preview-card {
  background: rgba(15,23,42,0.95);
  border-radius: 16px;
  padding: 18px 20px 20px;
  border: 1px solid rgba(148,163,184,0.35);
  box-shadow: 0 18px 50px rgba(15,23,42,0.85);
}

.controls-card h2,
.preview-card h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.status-row,
.info-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.status-label,
.info-label {
  opacity: 0.8;
}

.status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-idle {
  background: rgba(148,163,184,0.2);
  color: #e5e7eb;
}

.status-recording {
  background: rgba(220,38,38,0.18);
  color: #fecaca;
  border: 1px solid rgba(248,113,113,0.7);
}

.status-uploading {
  background: rgba(59,130,246,0.18);
  color: #bfdbfe;
  border: 1px solid rgba(59,130,246,0.7);
}

.status-converting {
  background: rgba(234,179,8,0.16);
  color: #facc15;
  border: 1px solid rgba(250,204,21,0.7);
}

.status-ready {
  background: rgba(34,197,94,0.18);
  color: #bbf7d0;
  border: 1px solid rgba(22,163,74,0.7);
}

.buttons-row {
  display: flex;
  gap: 10px;
  margin: 10px 0 14px;
}

button.btn {
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease, opacity 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #0ea5e9);
  color: #f9fafb;
  box-shadow: 0 10px 25px rgba(37,99,235,0.4);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb, #0284c7);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(37,99,235,0.55);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #f97373);
  color: #fef2f2;
  box-shadow: 0 10px 24px rgba(239,68,68,0.4);
}

.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, #dc2626, #f97373);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(239,68,68,0.55);
}

.btn-success {
  background: linear-gradient(135deg, #22c55e, #4ade80);
  color: #ecfdf5;
  box-shadow: 0 10px 24px rgba(22,163,74,0.4);
}

.btn-success:hover {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(22,163,74,0.55);
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.progress-wrapper {
  margin: 10px 0 4px;
}

.progress-label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 4px;
  opacity: 0.8;
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(30,64,175,0.5);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #22c55e);
  transition: width 0.15s ease-out;
}

.progress-text {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: #9ca3af;
}

.tips {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed rgba(55,65,81,0.9);
}

.tips h2 {
  font-size: 0.95rem;
  margin: 0 0 4px;
  opacity: 0.9;
}

.tips ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.85rem;
  color: #9ca3af;
}

.preview-card video {
  width: 100%;
  max-height: 360px;
  border-radius: 12px;
  background: #020617;
  border: 1px solid rgba(51,65,85,0.9);
}

.app-footer {
  text-align: center;
  font-size: 0.8rem;
  color: #9ca3af;
  padding-bottom: 4px;
}

code {
  font-family: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: rgba(15,23,42,0.9);
  padding: 2px 5px;
  border-radius: 6px;
  border: 1px solid rgba(55,65,81,0.9);
}

.format-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  margin-bottom: 10px;
  font-size: 0.85rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.9;
}

.radio-option input {
  accent-color: #3b82f6;
}

.recordings-container {
  margin-top: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.recordings-empty {
  font-size: 0.85rem;
  color: #9ca3af;
}

.recording-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(55,65,81,0.7);
  font-size: 0.8rem;
  gap: 6px;
}

.recording-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 70%;
}

.recording-name {
  font-weight: 500;
  color: #e5e7eb;
  word-break: break-all;
}

.recording-meta {
  color: #9ca3af;
  font-size: 0.75rem;
}

.recording-actions {
  display: flex;
  gap: 6px;
}

.btn-xs {
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: rgba(31,41,55,0.9);
  color: #e5e7eb;
}

.btn-xs:hover {
  background: rgba(55,65,81,0.95);
}

.btn-xs-danger {
  background: rgba(185,28,28,0.9);
  color: #fee2e2;
}

.btn-xs-danger:hover {
  background: rgba(220,38,38,0.95);
}

/* ===== USERS PAGE ===== */

.users-body {
  background: radial-gradient(circle at top, #1f2937 0, #020617 55%);
  color: #e5e7eb;
}

.users-wrapper {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 16px;
}

.users-header {
  margin-bottom: 16px;
}

.users-header h1 {
  margin: 0 0 6px;
}

.users-header p {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: #9ca3af;
}

.users-main {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr);
  gap: 16px;
}

.users-form-card,
.users-list-card {
  background: rgba(15,23,42,0.97);
  border-radius: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(148,163,184,0.35);
  box-shadow: 0 18px 50px rgba(15,23,42,0.85);
}

.users-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.users-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  gap: 4px;
}

.users-form input,
.users-form select {
  border-radius: 10px;
  border: 1px solid rgba(55,65,81,0.85);
  background: rgba(15,23,42,0.95);
  color: #e5e7eb;
  padding: 8px 10px;
  outline: none;
}

.users-form input:focus,
.users-form select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59,130,246,0.6);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.users-table th,
.users-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(31,41,55,0.9);
}

.users-table th {
  text-align: left;
  font-weight: 600;
  color: #9ca3af;
}

.alert {
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.alert.success {
  background: rgba(22,163,74,0.12);
  border: 1px solid rgba(22,163,74,0.7);
  color: #bbf7d0;
}

.alert.error {
  background: rgba(248,113,113,0.12);
  border: 1px solid rgba(248,113,113,0.7);
  color: #fecaca;
}

@media (max-width: 860px) {
  .app-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .header-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .app {
    margin: 16px auto;
  }

  .users-main {
    grid-template-columns: minmax(0, 1fr);
  }
}


.users-actions { display: flex; gap: 6px; align-items: center; }
.users-actions form { display: inline; margin: 0; }
