@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #252736;
  --secondary: #58b5ba;
  --white: #ffffff;
  --bg: #fafafa;
  --border: #e5e7eb;
  --text-muted: #6b7280;
  --tag-bg: rgba(88, 181, 186, 0.12);
  --tag-text: #3a8f93;
  --hover-row: rgba(88, 181, 186, 0.04);
}

html, body {
  font-family: 'Inter', sans-serif;
  color: var(--primary);
  background: var(--white);
  font-size: 14px;
  line-height: 1.5;
}

/* ── LOGIN PAGE (GLASSMORPHISM) ──────────────────────── */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  /* El usuario guardara la imagen como bg-login.jpg en la carpeta public */
  background: var(--primary) url('/bg-login.jpg') no-repeat center center;
  background-size: cover;
  position: relative;
}

/* Opcional: una capa sutil de oscurecimiento si el fondo es muy brillante */
.login-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(37, 39, 54, 0.3); /* Usa el primary color con transparencia */
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
  color: #fff;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.25);
}

.login-card h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.login-card p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  margin-bottom: 32px;
  font-weight: 300;
}

.form-group {
  margin-bottom: 24px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: #ffffff;
  outline: none;
  transition: all 0.2s ease;
}

.form-group input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.form-group input:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(88, 181, 186, 0.2);
}

.btn-primary {
  width: 100%;
  padding: 14px 0;
  background: var(--secondary);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
  box-shadow: 0 4px 15px rgba(88, 181, 186, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(88, 181, 186, 0.4);
}



.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-error {
  color: #c0392b;
  font-size: 13px;
  margin-top: 16px;
  display: none;
}

/* ── DASHBOARD LAYOUT ──────────────────────────────── */
.dashboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-left h1 {
  font-size: 16px;
  font-weight: 600;
}

.topbar-left .project-badge {
  background: var(--primary);
  color: var(--white);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-right .user-label {
  font-size: 13px;
  color: var(--text-muted);
}

.btn-logout {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-logout:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ── SUMMARY CARDS ─────────────────────────────────── */
.summary-bar {
  display: flex;
  gap: 16px;
  padding: 24px 32px 0;
  flex-wrap: wrap;
}

.summary-card {
  flex: 1;
  min-width: 140px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
}

.summary-card .label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.summary-card .value {
  font-size: 24px;
  font-weight: 600;
}

.summary-card .value.accent {
  color: var(--secondary);
}

/* ── TOOLBAR (search + filters) ────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 32px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--primary);
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--secondary);
}

.filter-select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--primary);
  background: var(--white);
  outline: none;
  cursor: pointer;
  min-width: 140px;
}

.filter-select:focus {
  border-color: var(--secondary);
}

.btn-toggle,
.btn-refresh {
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.btn-toggle:hover,
.btn-refresh:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-refresh.loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ── STATUS BAR ────────────────────────────────────── */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.auto-refresh-label {
  opacity: 0.6;
}

/* ── COLLAPSE TOGGLE ───────────────────────────────── */
.collapse-toggle {
  display: inline-block;
  width: 16px;
  cursor: pointer;
  user-select: none;
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.15s;
  text-align: center;
  margin-right: 4px;
}

.collapse-toggle.collapsed {
  transform: rotate(-90deg);
}

.issues-table tbody tr.row-hidden {
  display: none;
}

/* ── ISSUES TABLE ──────────────────────────────────── */
.table-wrapper {
  padding: 0 32px 32px;
  overflow-x: auto;
}

.issues-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.issues-table thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.issues-table thead th:hover {
  color: var(--primary);
}

.issues-table thead th.sorted-asc::after {
  content: ' ↑';
}

.issues-table thead th.sorted-desc::after {
  content: ' ↓';
}

.issues-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.issues-table tbody tr:hover {
  background: var(--hover-row);
}

.issues-table td {
  padding: 10px 12px;
  vertical-align: top;
}

.issues-table td.id-cell {
  font-weight: 500;
  white-space: nowrap;
  color: var(--secondary);
}

.issues-table td.summary-cell {
  max-width: 320px;
}

.issues-table td.date-cell {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 12px;
}

/* ── STATE BADGES ──────────────────────────────────── */
.state-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.state-badge.open {
  background: rgba(88, 181, 186, 0.12);
  color: #3a8f93;
}

.state-badge.in-progress {
  background: rgba(37, 39, 54, 0.10);
  color: var(--primary);
}

.state-badge.done {
  background: rgba(88, 181, 186, 0.25);
  color: #2a7a7e;
}

.state-badge.default {
  background: var(--bg);
  color: var(--text-muted);
}

/* ── TAGS ──────────────────────────────────────────── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  background: var(--tag-bg);
  color: var(--tag-text);
  white-space: nowrap;
}

/* ── SUBTASK HIERARCHY ─────────────────────────────── */
.issues-table tbody tr.parent-task td {
  font-weight: 500;
}

.issues-table tbody tr.subtask td {
  font-size: 12px;
}

.issues-table tbody tr.subtask td.id-cell {
  color: var(--text-muted);
}

.issues-table tbody tr.depth-1 td.summary-cell {
  padding-left: 28px;
}

.issues-table tbody tr.depth-2 td.summary-cell {
  padding-left: 44px;
}

.issues-table tbody tr.depth-3 td.summary-cell {
  padding-left: 60px;
}

.subtask-indicator {
  color: var(--border);
  font-size: 12px;
  margin-right: 4px;
}

/* ── SPRINT ROW ────────────────────────────────────── */
.issues-table tbody tr.sprint-row {
  border-left: 3px solid var(--secondary);
}

.issues-table tbody tr.sprint-row td:first-child {
  padding-left: 9px; /* compensate the 3px border */
}

/* ── LOADING / EMPTY STATES ────────────────────────── */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
  color: var(--text-muted);
  gap: 12px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--secondary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 80px 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── RESPONSIVE ────────────────────────────────────── */
@media (max-width: 768px) {
  .topbar { padding: 12px 16px; }
  .summary-bar { padding: 16px 16px 0; }
  .toolbar { padding: 16px; }
  .table-wrapper { padding: 0 16px 16px; }

  .summary-card { min-width: 100px; }
  .summary-card .value { font-size: 20px; }
}

@media (max-width: 480px) {
  .topbar-left h1 { font-size: 14px; }
  .summary-bar { flex-direction: column; }
}
