/* =======================
   DESIGN TOKENS (FASE 1)
======================= */
:root {
  --bg-page: #f7f9fb;
  --bg-section: #f0f4f7;
  --bg-card: #ffffff;
  --text-main: #2c3437;
  --text-muted: #596064;
  --primary: #4e45e4;
  --primary-soft: #6760fd;
  --success: #006d4a;
  --danger: #a8364b;
  --outline-soft: rgba(116, 124, 128, 0.18);
  --shadow-soft: 0 10px 24px rgba(44, 52, 55, 0.06);
  --shadow-float: 0 12px 32px rgba(44, 52, 55, 0.08);
  --radius-md: 12px;
}

/* LOGIN PAGE & CONTAINER */
body.login-page {
  background: linear-gradient(135deg, #f7f9fb 0%, #eef2fa 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  background: var(--bg-card);
  padding: 40px 32px;
  margin: auto;
  max-width: 420px;
  width: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-container h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  text-align: center;
}

.login-container .login-subtitle {
  font-size: 0.9rem;
  color: #6b7280;
  text-align: center;
  margin-bottom: 28px;
}

.login-container form {
  width: 100%;
}

.login-container .form-label {
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.login-container .form-control {
  border-color: rgba(172, 179, 183, 0.45);
  border-radius: 10px;
  padding: 0.65rem 0.95rem;
  font-size: 0.95rem;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.login-container .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(78, 69, 228, 0.15);
}

.login-container .alert {
  border-radius: 10px;
  border: 0;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.login-container .btn-login {
  background-image: linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 100%);
  border: 0;
  padding: 0.7rem 1.4rem;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  width: 100%;
  transition: transform 0.18s, box-shadow 0.18s;
}

.login-container .btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(78, 69, 228, 0.28);
}

.login-container .btn-login:active {
  transform: translateY(0);
}

@media (max-width: 600px) {
  .login-container {
    padding: 28px 20px;
    margin: 20px 2vw;
    max-width: 98vw;
    min-width: 0;
    box-sizing: border-box;
  }
  .login-container h2 {
    font-size: 1.4rem;
  }
}
/* =======================
   MODALS (FASE 3 POLISH)
======================= */
.modal-content {
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
  background: var(--bg-card);
}

.modal-header {
  background: linear-gradient(135deg, rgba(78, 69, 228, 0.08) 0%, rgba(103, 96, 253, 0.08) 100%);
  border-bottom: 1px solid rgba(172, 179, 183, 0.18);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 20px 24px;
}

.modal-header .modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-header .btn-close {
  opacity: 0.6;
}

.modal-header .btn-close:hover {
  opacity: 1;
}

.modal-body {
  padding: 24px;
  color: var(--text-main);
}

.modal-body .form-label {
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.modal-body .form-control,
.modal-body .form-select {
  border-color: rgba(172, 179, 183, 0.45);
  border-radius: 10px;
  font-size: 0.95rem;
}

.modal-body .form-control:focus,
.modal-body .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(78, 69, 228, 0.15);
}

.modal-body .alert {
  border-radius: 10px;
  border: 0;
}

.modal-footer {
  border-top: 1px solid rgba(172, 179, 183, 0.18);
  padding: 16px 24px;
  gap: 10px;
}

.modal-footer .btn {
  padding: 0.56rem 1.4rem;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.92rem;
}

.modal-footer .btn-secondary {
  background-color: #e5e7eb;
  border: 0;
  color: #374151;
}

.modal-footer .btn-secondary:hover {
  background-color: #d1d5db;
}

.modal-footer .btn-primary {
  background-image: linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 100%);
  border: 0;
}

.modal-footer .btn-danger {
  background-color: var(--danger);
  border: 0;
}

.modal-footer .btn-danger:hover {
  background-color: #8f2a3b;
}

.modal-backdrop {
  background-color: rgba(0, 0, 0, 0.48);
}

/* =======================
   LICENÇA
======================= */
.licenca-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background-color: #3a3a3a;
  border-radius: 6px;
}

.licenca-text {
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-copy {
  flex-shrink: 0;
}

.admin-shell {
  display: block;
}

.admin-toolbar {
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(172, 179, 183, 0.2);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(6px);
}

.admin-subtitle {
  color: var(--text-muted);
  font-size: 0.94rem;
}

.admin-filter-form {
  gap: 8px;
}

.admin-filter-form .form-control,
.admin-filter-form .form-select {
  border-color: rgba(172, 179, 183, 0.45);
  border-radius: 10px;
  min-height: 40px;
}

.admin-summary {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.admin-table-panel {
  overflow: hidden;
}

.admin-table-wrap {
  max-height: 70vh;
  overflow: auto;
}

.admin-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef3f8;
  color: #4e5966;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.06);
}

.admin-table td {
  border-color: rgba(172, 179, 183, 0.2);
  white-space: nowrap;
}

.admin-table tbody tr:nth-child(odd) {
  background-color: rgba(255, 255, 255, 0.65);
}

.admin-table tbody tr:nth-child(even) {
  background-color: rgba(240, 244, 247, 0.75);
}

.table-actions {
  min-width: 280px;
}

.action-btn {
  margin: 0 6px 6px 0;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
}

.admin-cta {
  border: 0;
  box-shadow: 0 10px 24px rgba(15, 143, 102, 0.22);
}

.licenca-field {
  background-color: #6c757d;
  border: 1px solid rgba(172, 179, 183, 0.25);
}

.licenca-text {
  color: #f6f8fa;
  font-size: 15px;
}

.btn-copy {
  border: 1px solid rgba(172, 179, 183, 0.42);
  background: #ffffff;
}

.btn-copy:hover {
  background: #f4f7fb;
}

/* =======================
   LAYOUT BASE
======================= */
body {
  background:
    radial-gradient(1200px 520px at -10% -30%, rgba(103, 96, 253, 0.12), transparent 55%),
    radial-gradient(900px 420px at 110% 0%, rgba(78, 69, 228, 0.09), transparent 50%),
    var(--bg-page);
  color: var(--text-main);
}


/* Sidebar padrão: fixa à esquerda em telas grandes */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  min-height: 100vh;
  height: 100vh;
  background: linear-gradient(180deg, #20263b 0%, #1a2034 100%);
  color: #d9def0;
  padding-top: 32px;
  z-index: 1050;
  transform: none;
  transition: none;
  box-shadow: 8px 0 26px rgba(19, 26, 40, 0.16);
}

.sidebar .nav-link {
  color: #c3c9df;
  font-weight: 500;
  border-radius: 10px;
  margin: 0 10px 6px;
  padding: 11px 14px;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
  background: rgba(103, 96, 253, 0.22);
  color: #ffffff;
}


/* Conteúdo principal: começa ao lado da sidebar em telas grandes */
.main-content {
  margin-left: 220px;
  width: calc(100% - 220px);
  min-height: 100vh;
  padding: 36px 32px;
  background: transparent;
  box-sizing: border-box;
}

.sidebar .nav-item.mt-4 {
  margin-top: 20px !important;
  padding-top: 12px;
  border-top: 1px solid rgba(217, 222, 240, 0.15);
}

.sidebar .nav-link.text-danger {
  color: #ffc2cb !important;
}

.sidebar .nav-link.text-danger:hover {
  background: rgba(168, 54, 75, 0.22);
  color: #ffe5ea !important;
}

.sidebar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #f1f4ff;
}

.sidebar-subtitle {
  margin-top: -6px;
  margin-bottom: 18px;
  text-align: center;
  font-size: 0.74rem;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: rgba(217, 222, 240, 0.68);
}

.sidebar .nav-link i {
  margin-right: 8px;
  opacity: 0.9;
}

.btn-primary {
  border: 0;
  background-image: linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 100%);
  box-shadow: 0 8px 18px rgba(78, 69, 228, 0.26);
}

.btn-primary:hover,
.btn-primary:focus {
  background-image: linear-gradient(135deg, #453cd9 0%, #5f57f3 100%);
}

.btn-outline-primary {
  color: var(--primary);
  border-color: rgba(78, 69, 228, 0.4);
}

.btn-outline-primary:hover {
  background: rgba(78, 69, 228, 0.1);
  border-color: rgba(78, 69, 228, 0.65);
  color: #332db5;
}

.sidebar-toggle {
  display: none;
}

/* =======================
   BADGES
======================= */
.badge-convertido {
  background: #198754;
}

.badge-nao {
  background: #6c757d;
}

.btn-sm {
  margin: 5px;
}

/* =======================
   RESPONSIVIDADE
======================= */

/* <= 900px */
@media (max-width: 900px) {
  .main-content {
    margin-left: 0;
    padding: 20px 10px 10px 10px;
    padding-top: 60px;
    margin-top: 0;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    z-index: 1050;
    padding-top: 80px;
  }

  .sidebar.open {
    transform: translateX(0);
    padding-top: 70px;
  }

  .sidebar .nav-link {
    font-size: 1.1em;
  }

  .sidebar-toggle {
    display: block;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1100;
    background: #23282d;
    color: #fff;
    border: none;
    font-size: 2em;
    padding: 4px 12px;
    border-radius: 6px;
  }
}

/* <= 768px */
@media (max-width: 768px) {
  .main-content {
    margin-left: 0;
    padding: 16px;
    margin-top: 100px;
  }

  .modal-dialog {
    margin-top: 80px;
  }

  .sidebar {
    min-height: auto;
    padding: 0;
  }

  .admin-toolbar {
    padding: 14px;
  }

  .admin-filter-form {
    width: 100%;
  }

  .admin-filter-form .form-control,
  .admin-filter-form .form-select,
  .admin-filter-form .btn,
  .admin-cta {
    width: 100%;
  }

  .admin-table-wrap {
    max-height: none;
  }

  .table-actions {
    min-width: 220px;
  }

  .action-btn {
    display: inline-block;
    margin-right: 4px;
    margin-bottom: 4px;
  }
}

/* <= 700px */
@media (max-width: 700px) {
  .table-responsive {
    font-size: 0.95em;
  }

  .table thead {
    font-size: 0.98em;
  }

  .btn,
  .form-control {
    font-size: 1em;
  }

  .main-content h2 {
    font-size: 1.3em;
  }

  .action-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.7rem !important;
    margin-right: 8px !important;
    margin-bottom: 8px !important;
    font-size: 0.9rem !important;
    font-weight: 600;
  }
}

/* <= 500px */
@media (max-width: 500px) {
  .table-responsive {
    font-size: 0.85em;
  }

  .btn,
  .form-control {
    font-size: 0.95em;
    margin: 7px 0;
  }

  .main-content h2 {
    font-size: 1.1em;
  }

  .action-btn {
    min-width: 48px;
    min-height: 48px;
    padding: 0.6rem 0.8rem !important;
    margin-right: 6px !important;
    margin-bottom: 6px !important;
    font-size: 0.95rem !important;
  }
}

/* =======================
   ENCURTADOR
======================= */
.short-link-output .input-group .form-control {
  background: #f8f9fa;
  font-family: "Courier New", Courier, monospace;
}

.short-link-output .form-label {
  font-weight: 600;
}

.table td .input-group.input-group-sm .form-control {
  min-width: 180px;
}

.destino-link {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-link-novo {
  background: #e8f7ee !important;
}

.btn-copy-feedback {
  min-width: 84px;
}

.pagination .page-link {
  min-width: 42px;
  text-align: center;
}

.card.dashboard-panel .card-title {
  font-weight: 650;
}

.card.dashboard-panel .form-label {
  font-weight: 600;
  color: #49525c;
}

.card.dashboard-panel .table-responsive {
  border-radius: 10px;
}

.encurtador-table-wrap {
  max-height: 62vh;
  overflow: auto;
}

.encurtador-table-wrap .dashboard-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f7f9fc;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.06);
}

.encurtador-table-wrap .dashboard-table tbody tr:nth-child(odd) {
  background-color: #fbfcfe;
}

.encurtador-table-wrap .dashboard-table tbody tr:nth-child(even) {
  background-color: #f3f6fa;
}

/* =======================
   DASHBOARD
======================= */
.section-title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.section-subtitle {
  color: #5f6771;
  font-size: 0.95rem;
}

.kpi-card {
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  color: #ffffff;
  overflow: hidden;
}

.kpi-card .card-title,
.kpi-card .display-5,
.kpi-card .display-6,
.kpi-card p,
.kpi-card small {
  color: #ffffff !important;
}

.kpi-card .card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.kpi-card .display-5 {
  line-height: 1;
}

.kpi-card.kpi-primary {
  background-color: #4e45e4;
  background-image: linear-gradient(145deg, #4e45e4 0%, #6760fd 100%);
}

.kpi-card.kpi-success {
  background-color: #0f8f66;
  background-image: linear-gradient(145deg, #0f8f66 0%, #0aa273 100%);
}

.kpi-card.kpi-danger {
  background-color: #b5435a;
  background-image: linear-gradient(145deg, #b5435a 0%, #d35e78 100%);
}

.kpi-card.kpi-warning {
  background-color: #c78614;
  background-image: linear-gradient(145deg, #c78614 0%, #e2a02c 100%);
}

.kpi-card.kpi-info {
  background-color: #2e84c6;
  background-image: linear-gradient(145deg, #2e84c6 0%, #4d99d3 100%);
}

.kpi-card.kpi-dark {
  background-color: #334155;
  background-image: linear-gradient(145deg, #334155 0%, #475569 100%);
}

.kpi-card.kpi-secondary {
  background-color: #55667c;
  background-image: linear-gradient(145deg, #55667c 0%, #64748b 100%);
}

.metric-lite-card {
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-soft);
}

.metric-lite-card .card-title {
  font-size: 0.92rem;
  font-weight: 600;
}

.dashboard-panel {
  border: 0;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-soft);
}

.dashboard-table thead th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #53606d;
  border-bottom-width: 0;
}

.dashboard-table td {
  vertical-align: middle;
  border-bottom-color: rgba(172, 179, 183, 0.22);
}

.dashboard-note {
  color: #4a4f57;
  background: #f8f9fb;
}

.dashboard-filter-form .form-label {
  font-weight: 600;
  color: #4d5762;
}

.chart-box {
  position: relative;
  height: 280px;
}

.chart-box-lg {
  height: 340px;
}

.chart-empty {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(172, 179, 183, 0.55);
  border-radius: 10px;
  color: #6a7380;
  background: #f8fbff;
  font-weight: 500;
}

.dashboard-side-widget {
  min-height: 248px;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-action-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  min-height: 92px;
  padding: 12px;
  border-radius: 10px;
  text-decoration: none;
  color: #334155;
  background: #f3f7fc;
  border: 1px solid rgba(172, 179, 183, 0.28);
  transition: all 0.18s ease;
}

.quick-action-item i {
  font-size: 1.1rem;
  color: #4e45e4;
}

.quick-action-item span {
  font-size: 0.85rem;
  font-weight: 600;
}

.quick-action-item:hover {
  transform: translateY(-1px);
  background: #edf3ff;
  border-color: rgba(78, 69, 228, 0.35);
  color: #2f3a4a;
}

/* Fallback selector for cases where action links are rendered without specific class */
.quick-actions-grid > a {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  min-height: 92px;
  padding: 12px;
  border-radius: 10px;
  text-decoration: none;
  color: #334155;
  background: #f3f7fc;
  border: 1px solid rgba(172, 179, 183, 0.28);
}

.quick-actions-grid > a:hover {
  background: #edf3ff;
  border-color: rgba(78, 69, 228, 0.35);
}

.quick-actions-grid > a > i {
  font-size: 1.1rem;
  color: #4e45e4;
}

.quick-actions-grid > a > span {
  font-size: 0.85rem;
  font-weight: 600;
}

.system-log-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.system-log-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  background: #f8fbff;
  border: 1px solid rgba(172, 179, 183, 0.22);
}

.system-log-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4e45e4;
  background: rgba(78, 69, 228, 0.12);
  flex-shrink: 0;
}

.system-log-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #2e3948;
  line-height: 1.3;
}

.system-log-time {
  margin-top: 2px;
  font-size: 0.76rem;
  color: #607082;
}

.system-log-content {
  min-width: 0;
}

.table {
  --bs-table-bg: transparent;
}

.table-hover > tbody > tr:hover > * {
  --bs-table-accent-bg: #eef3f8;
}

.dashboard-panel canvas {
  display: block;
}

@media (max-width: 768px) {
  .kpi-card .display-5 {
    font-size: 2rem;
  }

  .metric-lite-card .display-6 {
    font-size: 1.9rem;
  }

  .chart-box {
    height: 240px;
  }

  .chart-box-lg {
    height: 280px;
  }

  .quick-actions-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-side-widget {
    min-height: 0;
  }
}
