/* ============================================
   RITME GESTÃO — CSS Principal
   Identidade Visual: Vermelho #C0001A
============================================ */

:root {
  --ritme-red: #C0001A;
  --ritme-red-dark: #8B0012;
  --ritme-red-light: #FF1A35;
  --ritme-red-bg: #FFF0F2;
  --sidebar-bg: #1A1A2E;
  --sidebar-hover: #16213E;
  --text-dark: #1A1A2E;
  --text-medium: #555;
  --text-light: #888;
  --border: #E5E7EB;
  --bg-page: #F5F5F8;
  --bg-card: #FFFFFF;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #2563eb;
  --info-bg: #eff6ff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.11);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-page);
  color: var(--text-dark);
  min-height: 100vh;
}

/* ─── SCROLLBAR ───────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* ─── LOGIN ───────────────────────────── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #C0001A 0%, #8B0012 50%, #1A1A2E 100%);
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
}

.login-logo { margin-bottom: 8px; }
.login-logo img { height: 80px; object-fit: contain; }

.login-subtitle {
  color: var(--text-light);
  font-size: 13px;
  margin-bottom: 32px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.login-card h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 24px;
}

.form-group { margin-bottom: 16px; text-align: left; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-medium); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: border-color .2s;
  outline: none;
  background: #fafafa;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--ritme-red);
  background: #fff;
}

.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--ritme-red);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: background .2s;
}
.btn-login:hover { background: var(--ritme-red-dark); }

.login-demo {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-light);
  background: #f9f9f9;
  padding: 10px 14px;
  border-radius: 8px;
}

/* ─── APP LAYOUT ──────────────────────── */
#app { display: none; }
#app.active { display: flex; min-height: 100vh; }

/* ─── SIDEBAR ─────────────────────────── */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width .3s;
}

.sidebar-logo {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logo img.logo-icon {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 50%;
}

.sidebar-logo .brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo img.logo-main {
  height: 28px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.sidebar-logo .brand-sub {
  font-size: 9px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: all .2s;
  border-left: 3px solid transparent;
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.9);
}

.nav-item.active {
  background: rgba(192, 0, 26, 0.18);
  border-left-color: var(--ritme-red);
  color: #fff;
}

.nav-item i { width: 18px; text-align: center; font-size: 14px; }

.nav-badge {
  margin-left: auto;
  background: var(--ritme-red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.5);
  font-size: 12px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ritme-red);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-name { font-size: 13px; color: rgba(255,255,255,0.75); font-weight: 600; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.4); }

.btn-logout {
  margin-top: 10px;
  width: 100%;
  padding: 8px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.5);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all .2s;
}
.btn-logout:hover { background: rgba(192,0,26,0.3); color: #fff; }

/* ─── MAIN CONTENT ────────────────────── */
.main-content {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

.topbar-title { font-size: 18px; font-weight: 700; color: var(--text-dark); }
.topbar-sub { font-size: 12px; color: var(--text-light); margin-top: 2px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.page-content { padding: 24px 28px; flex: 1; }

/* ─── BOTÕES ──────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn i { font-size: 13px; }

.btn-primary { background: var(--ritme-red); color: white; }
.btn-primary:hover { background: var(--ritme-red-dark); }

.btn-secondary { background: white; color: var(--text-dark); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--ritme-red); color: var(--ritme-red); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #b45309; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 7px 9px; }

/* ─── CARDS / STATS ───────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--ritme-red);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-card.green { border-left-color: var(--success); }
.stat-card.orange { border-left-color: var(--warning); }
.stat-card.blue { border-left-color: var(--info); }
.stat-card.red { border-left-color: var(--danger); }

.stat-label { font-size: 12px; color: var(--text-light); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text-dark); margin: 6px 0 2px; }
.stat-sub { font-size: 12px; color: var(--text-light); }

/* ─── TABLE ───────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title { font-size: 15px; font-weight: 700; color: var(--text-dark); }

.card-body { padding: 20px; }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
th {
  background: #F8F9FA;
  padding: 11px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid #F0F1F3;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #FAFBFC; }

/* ─── AVATAR ATLETA ───────────────────── */
.atleta-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: #f0f0f0;
}

.avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ritme-red) 0%, var(--ritme-red-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}

.avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  background: #f0f0f0;
}

.avatar-placeholder-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ritme-red) 0%, var(--ritme-red-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar-xl {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid white;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

.avatar-placeholder-xl {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ritme-red) 0%, var(--ritme-red-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 30px;
  font-weight: 700;
  border: 4px solid white;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

.atleta-info .name { font-weight: 600; color: var(--text-dark); font-size: 13.5px; line-height: 1.3; }
.atleta-info .sub { font-size: 11.5px; color: var(--text-light); }

/* ─── UPLOAD FOTO ─────────────────────── */
.foto-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .2s;
  text-align: center;
  background: #fafafa;
}

.foto-upload-area:hover {
  border-color: var(--ritme-red);
  background: var(--ritme-red-bg);
}

.foto-preview-container {
  position: relative;
  display: inline-block;
}

.foto-preview-container .btn-remove-foto {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.foto-upload-hint { font-size: 12px; color: var(--text-light); }
.foto-upload-hint span { color: var(--ritme-red); font-weight: 600; cursor: pointer; }

input[type="file"] { display: none; }

/* ─── BADGES / STATUS ─────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-gray { background: #f3f4f6; color: #6b7280; }

/* ─── FILTROS ─────────────────────────── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-input {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: border-color .2s;
  background: white;
}
.filter-input:focus { border-color: var(--ritme-red); }

/* ─── MODAL ───────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: modalIn .2s ease;
}

.modal-lg { max-width: 780px; }
.modal-xl { max-width: 960px; }

@keyframes modalIn {
  from { transform: scale(.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 700; }

.btn-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f3f4f6;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.btn-close:hover { background: #e5e7eb; }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── FORMULÁRIOS ─────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-full { grid-column: 1 / -1; }

.form-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ritme-red);
  margin: 20px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--ritme-red-bg);
  grid-column: 1 / -1;
}

textarea.form-group-input {
  resize: vertical;
  min-height: 80px;
}

/* ─── FICHA ATLETA — ABAS ─────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
}
.tab-btn.active { color: var(--ritme-red); border-bottom-color: var(--ritme-red); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── DASHBOARD GRID ──────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.dashboard-grid .full { grid-column: 1 / -1; }

/* ─── CALENDAR ────────────────────────── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day-header {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  padding: 6px 2px;
  text-transform: uppercase;
}
.cal-day {
  min-height: 70px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
  font-size: 12px;
}
.cal-day.other-month { background: #f9fafb; color: #ccc; }
.cal-day.today { border-color: var(--ritme-red); }
.cal-day-num {
  font-weight: 600;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 50%;
  width: 22px;
  text-align: center;
}
.cal-day.today .cal-day-num {
  background: var(--ritme-red);
  color: white;
}
.cal-event {
  background: var(--ritme-red-bg);
  color: var(--ritme-red);
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 3px;
  margin-top: 2px;
  truncate: true;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ─── PERFIL FICHA ────────────────────── */
.ficha-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: linear-gradient(135deg, var(--ritme-red) 0%, var(--ritme-red-dark) 100%);
  border-radius: 12px;
  color: white;
  margin-bottom: 20px;
}
.ficha-header .info h3 { font-size: 18px; font-weight: 700; }
.ficha-header .info p { font-size: 13px; opacity: .8; margin-top: 3px; }
.ficha-badges { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.ficha-badge {
  background: rgba(255,255,255,0.2);
  color: white;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

/* ─── TOAST ───────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #1A1A2E;
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  animation: toastIn .3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 340px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
@keyframes toastIn { from { transform: translateX(100%); opacity:0; } to { transform: translateX(0); opacity:1; } }

/* ─── EMPTY STATE ─────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light);
}
.empty-state i { font-size: 40px; margin-bottom: 12px; color: #ddd; }
.empty-state p { font-size: 14px; }

/* ─── PAGE HEADER ─────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 { font-size: 20px; font-weight: 800; color: var(--text-dark); }
.page-header p { font-size: 13px; color: var(--text-light); margin-top: 3px; }

/* ─── INFO LIST ───────────────────────── */
.info-list { display: flex; flex-direction: column; gap: 10px; }
.info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
}
.info-label {
  color: var(--text-light);
  font-size: 12px;
  font-weight: 600;
  min-width: 130px;
}

/* ─── CHART CONTAINER ─────────────────── */
.chart-container { position: relative; }

/* ─── SECTION DIVIDER ─────────────────── */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ─── PAGINATION ──────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}
.page-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.page-btn.active { background: var(--ritme-red); border-color: var(--ritme-red); color: white; }
.page-btn:hover:not(.active) { border-color: var(--ritme-red); color: var(--ritme-red); }

/* ─── UTILITY ─────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.text-red { color: var(--ritme-red); }
.text-green { color: var(--success); }
.text-orange { color: var(--warning); }
.text-gray { color: var(--text-light); }

/* ─── RESPONSIVO ──────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-logo .brand-text, .nav-item span { display: none; }
  .main-content { margin-left: 60px; }
  .form-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
}
