/* =============================================================================
   CCIAM — Estilos globais do painel administrativo
   Base: Bootstrap 5.3 (via CDN). Este ficheiro contém apenas os ajustes
   e componentes específicos da aplicação, reutilizando ao máximo o Bootstrap.
   ============================================================================= */

/* ----------------------------------------------------------------------------
   1. Variáveis de tema
   ---------------------------------------------------------------------------- */
:root {
  --cc-accent: #1a7f99;
  --cc-accent-600: #166b81;
  --cc-accent-050: #eaf5f8;
  --cc-sidebar-bg: #15202b;
  --cc-sidebar-bg-soft: #1c2a38;
  --cc-sidebar-width: 250px;
  --cc-sidebar-width-collapsed: 72px;
  --cc-header-height: 64px;
  --cc-border: #e6e9ee;
  --cc-body-bg: #f4f6f9;
}

/* ----------------------------------------------------------------------------
   2. Base
   ---------------------------------------------------------------------------- */
body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  background-color: var(--cc-body-bg);
  color: #212529;
  -webkit-font-smoothing: antialiased;
}

/* ----------------------------------------------------------------------------
   3. Layout administrativo (grid)
   ---------------------------------------------------------------------------- */
.admin-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.admin-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0; /* permite que o conteúdo encolha sem overflow horizontal */
}

.main-content {
  flex: 1 1 auto;
  padding: 1.5rem;
  min-width: 0;
}

/* ----------------------------------------------------------------------------
   4. Sidebar (desktop)
   ---------------------------------------------------------------------------- */
.admin-sidebar {
  width: var(--cc-sidebar-width);
  flex-shrink: 0;
  background-color: var(--cc-sidebar-bg);
  color: #cdd6df;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 0.2s ease;
  overflow: hidden;
}

.admin-sidebar-inner {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 0.75rem;
}

/* Estado minimizado */
.admin-layout--collapsed .admin-sidebar {
  width: var(--cc-sidebar-width-collapsed);
}

.admin-layout--collapsed .admin-sidebar .sidebar-brand-text,
.admin-layout--collapsed .admin-sidebar .sidebar-label,
.admin-layout--collapsed .admin-sidebar .sidebar-section,
.admin-layout--collapsed .admin-sidebar .sidebar-caret,
.admin-layout--collapsed .admin-sidebar .sidebar-user-details,
.admin-layout--collapsed .admin-sidebar .sidebar-minimize-text {
  display: none;
}

.admin-layout--collapsed .admin-sidebar .sidebar-brand {
  justify-content: center;
  padding: 0.75rem 0;
}

.admin-layout--collapsed .admin-sidebar .sidebar-link {
  justify-content: center;
  padding: 0.75rem;
}

.admin-layout--collapsed .admin-sidebar .sidebar-link i {
  margin: 0;
}

.admin-layout--collapsed .admin-sidebar .sidebar-submenu {
  display: none !important;
}

/* Logotipo / marca */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
  color: #fff;
  white-space: nowrap;
}

.sidebar-brand img {
  height: 34px;
  width: auto;
}

.sidebar-brand-text {
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
}

.sidebar-brand-text small {
  display: block;
  font-weight: 400;
  color: #8fa0b0;
  font-size: 0.72rem;
}

/* Secções / grupos de menu */
.sidebar-section {
  margin: 1.1rem 0 0.35rem;
  padding: 0 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6f8192;
}

/* Itens de menu */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  color: #cdd6df;
  text-decoration: none;
  font-size: 0.9rem;
  position: relative;
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.sidebar-link i {
  font-size: 1.1rem;
  width: 1.4rem;
  text-align: center;
  flex-shrink: 0;
  color: #8fa0b0;
}

.sidebar-link:hover {
  background-color: var(--cc-sidebar-bg-soft);
  color: #fff;
}

.sidebar-link:hover i {
  color: #fff;
}

.sidebar-link.active {
  background-color: var(--cc-accent);
  color: #fff;
  font-weight: 500;
}

.sidebar-link.active i {
  color: #fff;
}

.sidebar-caret {
  margin-left: auto;
  transition: transform 0.2s ease;
  font-size: 0.75rem;
}

.sidebar-link[aria-expanded="true"] .sidebar-caret {
  transform: rotate(90deg);
}

/* Submenu expansível */
.sidebar-submenu {
  padding-left: 0.9rem;
  margin: 0.15rem 0 0.15rem 0.6rem;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-submenu .sidebar-link {
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  gap: 0.6rem;
}

.sidebar-submenu .sidebar-link i {
  font-size: 0.9rem;
  width: auto;
}

/* Rodapé da sidebar (utilizador + minimizar) */
.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.75rem;
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.25rem;
  margin-bottom: 0.5rem;
  border-radius: 0.5rem;
  color: #cdd6df;
  text-decoration: none;
  white-space: nowrap;
}

.sidebar-user:hover {
  background-color: var(--cc-sidebar-bg-soft);
  color: #fff;
}

.sidebar-user-details strong {
  display: block;
  font-size: 0.85rem;
  color: #fff;
  line-height: 1.2;
}

.sidebar-user-details span {
  font-size: 0.75rem;
  color: #8fa0b0;
}

/* Tooltip da sidebar (só visível ao hover quando minimizada) */
.sidebar-tooltip {
  opacity: 0;
  visibility: hidden;
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #0d1117;
  color: #fff;
  padding: 0.35rem 0.6rem;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  white-space: nowrap;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

.admin-layout--collapsed .sidebar-link:hover .sidebar-tooltip {
  opacity: 1;
  visibility: visible;
}

/* ----------------------------------------------------------------------------
   5. Header administrativo
   ---------------------------------------------------------------------------- */
.admin-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--cc-header-height);
  padding: 0 1.5rem;
  background-color: #fff;
  border-bottom: 1px solid var(--cc-border);
  position: sticky;
  top: 0;
  z-index: 1020;
}

.header-sidebar-toggle {
  display: none;
}

.admin-header .breadcrumb {
  margin: 0;
}

/* ----------------------------------------------------------------------------
   6. Breadcrumb
   ---------------------------------------------------------------------------- */
.breadcrumb {
  font-size: 0.85rem;
}

.breadcrumb-item a {
  color: var(--cc-accent);
  text-decoration: none;
}

.breadcrumb-item a:hover {
  text-decoration: underline;
}

/* ----------------------------------------------------------------------------
   7. Página: título + acções
   ---------------------------------------------------------------------------- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
  color: #1a2430;
}

.page-subtitle {
  color: #64748b;
  font-size: 0.9rem;
  margin: 0.15rem 0 0;
}

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

/* ----------------------------------------------------------------------------
   8. Cards
   ---------------------------------------------------------------------------- */
.card {
  border: 1px solid var(--cc-border);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
}

.card-header {
  background-color: #fff;
  border-bottom: 1px solid var(--cc-border);
  padding: 0.9rem 1.25rem;
}

.card-header-title {
  font-weight: 600;
  font-size: 1rem;
  color: #1a2430;
  margin: 0;
}

/* Card de métrica do dashboard */
.dashboard-card {
  height: 100%;
}

.dashboard-card .card-body {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dashboard-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  background-color: var(--cc-accent-050);
  color: var(--cc-accent);
}

.dashboard-card-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
  color: #1a2430;
}

.dashboard-card-label {
  font-size: 0.8rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 500;
}

.dashboard-card-link {
  font-size: 0.8rem;
  color: var(--cc-accent);
  text-decoration: none;
}

.dashboard-card-link:hover {
  text-decoration: underline;
}

/* ----------------------------------------------------------------------------
   9. Tabelas
   ---------------------------------------------------------------------------- */
.table-card .table {
  margin: 0;
}

.table thead th {
  background-color: #f8fafc;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  border-bottom-width: 1px;
  white-space: nowrap;
  padding: 0.75rem 1.25rem;
}

.table tbody td {
  padding: 0.8rem 1.25rem;
  vertical-align: middle;
  font-size: 0.9rem;
  border-color: var(--cc-border);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table-hover tbody tr:hover {
  background-color: #f8fafc;
}

/* ----------------------------------------------------------------------------
   10. Formulários
   ---------------------------------------------------------------------------- */
.form-label {
  font-weight: 500;
  font-size: 0.875rem;
  color: #334155;
}

.form-control,
.form-select {
  border-color: #d3d9e0;
  border-radius: 0.5rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--cc-accent);
  box-shadow: 0 0 0 0.2rem rgba(26, 127, 153, 0.15);
}

.form-help {
  font-size: 0.8rem;
  color: #64748b;
}

/* ----------------------------------------------------------------------------
   11. Botões
   ---------------------------------------------------------------------------- */
.btn-accent {
  background-color: var(--cc-accent);
  border-color: var(--cc-accent);
  color: #fff;
}

.btn-accent:hover,
.btn-accent:focus {
  background-color: var(--cc-accent-600);
  border-color: var(--cc-accent-600);
  color: #fff;
}

/* ----------------------------------------------------------------------------
   12. Estados de interface
   ---------------------------------------------------------------------------- */
/* Loading */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  color: #64748b;
}

/* Vazio */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  padding: 3rem 1rem;
  color: #64748b;
}

.empty-state-icon {
  font-size: 2.5rem;
  color: #cbd5e1;
}

.empty-state-title {
  font-weight: 600;
  font-size: 1rem;
  color: #334155;
  margin: 0;
}

.empty-state-text {
  font-size: 0.875rem;
  max-width: 24rem;
  margin: 0;
}

/* Erro */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  padding: 3rem 1rem;
  color: #64748b;
}

.error-state-icon {
  font-size: 2.5rem;
  color: #fca5a5;
}

.error-state-title {
  font-weight: 600;
  font-size: 1rem;
  color: #334155;
  margin: 0;
}

/* ----------------------------------------------------------------------------
   13. Avatares
   ---------------------------------------------------------------------------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--cc-accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 0.75rem;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 1.1rem;
}

/* ----------------------------------------------------------------------------
   14. Menu do utilizador / notificações
   ---------------------------------------------------------------------------- */
.dropdown-menu {
  border-color: var(--cc-border);
  border-radius: 0.625rem;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.12);
}

.notification-badge {
  position: absolute;
  top: 0;
  right: 0;
  transform: translate(30%, -30%);
  font-size: 0.6rem;
  padding: 0.15em 0.5em;
}

.notification-menu {
  width: 340px;
  max-width: 90vw;
  padding: 0;
}

.notification-menu-header {
  padding: 0.75rem 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--cc-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notification-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f1f3f6;
}

.notification-item:hover {
  background-color: #f8fafc;
}

.notification-item.unread {
  background-color: var(--cc-accent-050);
}

.notification-item-body {
  flex: 1;
  min-width: 0;
}

.notification-item-title {
  font-weight: 500;
  font-size: 0.85rem;
  color: #1a2430;
  margin: 0;
}

.notification-item-text {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notification-item-time {
  font-size: 0.7rem;
  color: #94a3b8;
  white-space: nowrap;
}

/* ----------------------------------------------------------------------------
   15. Acessibilidade / misc
   ---------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--cc-accent);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* ----------------------------------------------------------------------------
   16. Responsividade
   ---------------------------------------------------------------------------- */
@media (min-width: 992px) {
  .header-sidebar-toggle {
    display: inline-flex;
  }

  .main-content {
    padding: 2rem;
  }
}

@media (max-width: 991.98px) {
  .admin-sidebar {
    display: none;
  }
}

/* Offcanvas (mobile) com o mesmo tema da sidebar */
.offcanvas-admin {
  width: 280px !important;
  max-width: 85vw;
  background-color: var(--cc-sidebar-bg);
  color: #cdd6df;
}

.offcanvas-admin .offcanvas-body {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.offcanvas-admin .sidebar-brand {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.offcanvas-admin .btn-close {
  filter: invert(1);
}

.offcanvas-admin .sidebar-footer {
  margin-top: auto;
}

/* Cabeçalho da página com título e acções (padrão das páginas admin) */
.page-heading {
  margin-bottom: 1.5rem;
}

/* Notificações (Toastify-js) */
.toast-success {
  background: linear-gradient(to right, #00b09b, #96c93d);
}
.toast-info {
  background: linear-gradient(to right, #2196f3, #1976d2);
}
.toast-warning {
  background: linear-gradient(to right, #fbc02d, #f57f17);
}
.toast-error {
  background: linear-gradient(to right, #e53935, #c62828);
}
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */
