@import "../../css/aya-ui.css";

/* ============================================================
   AYA APP — tema oficial do portal (app)
   Mesma paleta do site: menu #90EE90 | fundo #AFEEEE | texto #000
   Estrutura estilo rede social (X / Facebook / Instagram):
     - sidebar unica a esquerda (padrao portal/index.html)
     - feed central
     - barra inferior no celular
   Funciona por cima do CSS de cada pagina (carregado depois).
   ============================================================ */

:root {
  --aya-menu: #90EE90;
  --aya-fundo: #AFEEEE;
  --aya-texto: #000000;
  --aya-texto-suave: rgba(0, 0, 0, .7);
  --aya-borda: rgba(0, 0, 0, .14);
  --aya-cartao: #ffffff;
  --aya-destaque: #1E7A46;
  --aya-hover: rgba(0, 0, 0, .06);
  --aya-sombra: 0 6px 20px rgba(0, 0, 0, .1);
  --aya-moldura-cor: transparent;
}

html[data-tema="escuro"] {
  --aya-menu: #111111;
  --aya-fundo: #050505;
  --aya-texto: #eaeaea;
  --aya-texto-suave: rgba(234, 234, 234, .7);
  --aya-borda: rgba(255, 255, 255, .12);
  --aya-cartao: #141414;
  --aya-destaque: #FFD700;
  --aya-hover: rgba(255, 255, 255, .07);
  --aya-sombra: 0 6px 20px rgba(0, 0, 0, .5);
}

/* ---------- fundo geral ---------- */
body {
  background-color: var(--aya-fundo-cor, var(--aya-fundo)) !important;
  background-image: var(--aya-fundo-img, none) !important;
  background-size: cover;
  background-attachment: fixed;
  color: var(--aya-texto) !important;
  transition: background-color .25s ease, color .25s ease;
}
h1, h2, h3, h4, h5, h6, p, span, li, label, small, td, th, a { color: inherit; }

/* ---------- cards / botoes / formularios ---------- */
.card, .app-card, .stat-card, section.card {
  background: var(--aya-cartao) !important;
  color: var(--aya-texto) !important;
  border: 1px solid var(--aya-borda) !important;
  border-radius: 16px !important;
  box-shadow: var(--aya-sombra);
}
.form-control, .form-select, input:not([type=checkbox]):not([type=radio]), textarea, select {
  background: #fff !important;
  color: #000 !important;
  border-color: var(--aya-borda) !important;
}
html[data-tema="escuro"] .form-control,
html[data-tema="escuro"] .form-select,
html[data-tema="escuro"] input:not([type=checkbox]):not([type=radio]),
html[data-tema="escuro"] textarea,
html[data-tema="escuro"] select {
  background: #0f0f0f !important;
  color: #eaeaea !important;
  border-color: rgba(255, 255, 255, .16) !important;
}
.btn-primary { background: var(--aya-destaque) !important; border-color: var(--aya-destaque) !important; color: #fff !important; }
html[data-tema="escuro"] .btn-primary { color: #111 !important; }
.modal-content { background: var(--aya-cartao); color: var(--aya-texto); }
html[data-tema="escuro"] .modal-content { background: var(--aya-cartao); color: var(--aya-texto); }

/* ============================================================
   SIDEBAR — unifica todas as familias de markup existentes
   (.sidebar#sidebar | .desktop-sidebar | .side-nav legado |
    .nav-item- legado responsavel) seguindo o modelo do index
   ============================================================ */
.sidebar,
.desktop-sidebar {
  background: var(--aya-menu) !important;
  color: #04220f !important;
  border-right: 1px solid rgba(0, 0, 0, .12) !important;
  width: 268px !important;
  min-width: 268px !important;
}
html[data-tema="escuro"] .sidebar,
html[data-tema="escuro"] .desktop-sidebar { color: #DFFFE7 !important; }

.sidebar .sidebar-brand img,
.desktop-sidebar .sidebar-brand img,
.desktop-sidebar .sidebar-logo,
.sidebar .brand-logo {
  width: 40px !important;
  height: 40px !important;
  border-radius: 12px;
  object-fit: contain;
  background: transparent;
}

/* itens de menu — todas as variantes de markup */
.sidebar .sidebar-menu > a,
.sidebar .sidebar-link,
.sidebar .side-link,
.desktop-sidebar .sidebar-link,
.desktop-sidebar .sidebar-item,
.desktop-sidebar .nav-item-aya,
.sidebar .nav-item-aya {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin: 2px 10px;
  border-radius: 999px;
  color: inherit !important;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s ease;
}
.sidebar .sidebar-menu > a:hover,
.sidebar .sidebar-link:hover, .sidebar .side-link:hover,
.desktop-sidebar .sidebar-link:hover, .desktop-sidebar .sidebar-item:hover,
.desktop-sidebar .nav-item-aya:hover, .sidebar .nav-item-aya:hover {
  background: rgba(0, 0, 0, .1);
}
html[data-tema="escuro"] .sidebar .sidebar-menu > a:hover,
html[data-tema="escuro"] .sidebar .sidebar-link:hover,
html[data-tema="escuro"] .desktop-sidebar .sidebar-link:hover,
html[data-tema="escuro"] .desktop-sidebar .sidebar-item:hover {
  background: rgba(255, 255, 255, .12);
}

.sidebar .active, .sidebar a.active,
.desktop-sidebar .active, .desktop-sidebar .sidebar-link.active,
.desktop-sidebar .sidebar-item.active, .desktop-sidebar .nav-item-aya.active,
.sidebar .side-link.active, .sidebar .nav-item-aya.active {
  background: rgba(0, 0, 0, .16) !important;
  font-weight: 800;
}

.sidebar .sidebar-section,
.sidebar .nav-section-title,
.sidebar .sidebar-section-title,
.desktop-sidebar .sidebar-section,
.desktop-sidebar .sidebar-section-title,
.desktop-sidebar .nav-section-title {
  color: rgba(0, 0, 0, .55);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: .7rem;
  padding: 16px 22px 4px;
  margin: 0;
}
html[data-tema="escuro"] .sidebar .sidebar-section,
html[data-tema="escuro"] .sidebar .nav-section-title,
html[data-tema="escuro"] .desktop-sidebar .sidebar-section,
html[data-tema="escuro"] .desktop-sidebar .sidebar-section-title { color: rgba(223, 255, 231, .6); }

.sidebar-footer, .sidebar-bottom, .side-bottom {
  border-top: 1px solid rgba(0, 0, 0, .12);
  color: inherit;
}

/* avatares do sidebar */
.sidebar-avatar, .side-profile { background: rgba(255, 255, 255, .5); }
html[data-tema="escuro"] .sidebar-avatar, html[data-tema="escuro"] .side-profile {
  background: rgba(255, 255, 255, .12);
  color: #EFFFF4;
}

/* ---------- topbar ---------- */
.topbar, .app-header, header.app-header, .top-header, .mobile-header {
  background: var(--aya-menu) !important;
  color: #04220f !important;
  border-bottom: 1px solid rgba(0, 0, 0, .12) !important;
  backdrop-filter: none;
}
html[data-tema="escuro"] .topbar, html[data-tema="escuro"] .app-header,
html[data-tema="escuro"] header.app-header, html[data-tema="escuro"] .top-header,
html[data-tema="escuro"] .mobile-header { color: #DFFFE7 !important; }
.topbar h1, .topbar h4, .topbar h5, .topbar small,
.topbar-actions button, .page-title, .page-title * { color: inherit !important; }
.topbar-icon-button, .icon-btn, .back-btn { color: inherit !important; }

.profile-button {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  border: 1px solid rgba(255, 215, 0, .23);
  overflow: hidden;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
  background: rgba(0, 0, 0, .18) !important;
  color: #04220f !important;
}
.profile-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
html[data-tema="escuro"] .profile-button { background: rgba(255, 255, 255, .16) !important; color: #EFFFF4 !important; }

/* ---------- feed central centralizado e limpo ---------- */
.main-content, .app-shell, main.app, .app-layout { background: transparent !important; }

.app-content, .page-container, .app-main, .content-grid, main.main > div.content,
.settings-layout, .chat-window {
  max-width: 720px;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* rails laterais extras viram opcao (somente telas grandes) */
.social-sidebar, .chat-info { border-left: 1px solid var(--aya-borda); }
@media (max-width: 1279px) {
  .social-sidebar { display: none !important; }
}

/* ============================================================
   MOBILE — vira app de verdade: sem nada na lateral,
   barra inferior fixa + conteudo full width
   ============================================================ */
@media (max-width: 1023.98px) {
  .sidebar, .desktop-sidebar { display: none !important; }
  .sidebar.aberta, .sidebar.open, .sidebar.ativa, .sidebar.show,
  .desktop-sidebar.aberta, .desktop-sidebar.open, .desktop-sidebar.show,
  body.com-sidebar .sidebar, body.menu-aberto .sidebar, body.sidebar-open .sidebar {
    display: flex !important;
    z-index: 1060;
    box-shadow: 12px 0 40px rgba(0, 0, 0, .25);
  }
  .main-content, .app-shell { margin-left: 0 !important; }
  .bottom-navigation, .mobile-bottom-nav, .mobile-nav, .bottom-nav, .nav-bottom {
    display: none !important; /* mobilenav.js assume a barra padrao */
  }
}

/* ============================================================
    IPAD LANDSCAPE / TABLETS WIDE — 1024px a 1194px
    Sidebar mais estreita, conteudo ocupa mais espaco,
    touch targets generosos (>= 44px)
    ============================================================ */
@media (min-width: 1024px) and (max-width: 1194px) {
  .sidebar, .desktop-sidebar {
    width: 220px !important;
    min-width: 220px !important;
  }
  #ayaSide {
    width: 220px !important;
    min-width: 220px !important;
  }
  .main-content, .app-shell { margin-left: 220px !important; }
  html.aya-side-on body { padding-left: 220px !important; }
  html.aya-side-on .aya-botoes-flutuantes { left: 232px !important; }
  .app-content, .page-container, .app-main, .content-grid, main.main > div.content,
  .settings-layout, .chat-window {
    max-width: 580px;
  }
  .sidebar .sidebar-menu > a,
  .sidebar .sidebar-link,
  .sidebar .side-link,
  .desktop-sidebar .sidebar-link,
  .desktop-sidebar .sidebar-item,
  .desktop-sidebar .nav-item-aya,
  .sidebar .nav-item-aya {
    padding: 12px 16px;
    min-height: 44px;
    font-size: .9rem;
  }
}

/* barra inferior padrao (injetada por /js/mobilenav.js) */
#ayaBottomNav {
  background: var(--aya-menu) !important;
  border-top: 1px solid rgba(0, 0, 0, .15) !important;
  padding-bottom: env(safe-area-inset-bottom, 0) !important;
}
html[data-tema="escuro"] #ayaBottomNav { border-top-color: rgba(255, 255, 255, .2) !important; }
#ayaBottomNav a, #ayaBottomNav .aya-nav-item { color: #04220f !important; }
html[data-tema="escuro"] #ayaBottomNav a,
html[data-tema="escuro"] #ayaBottomNav .aya-nav-item { color: #DFFFE7 !important; }
#ayaBottomNav .ativo, #ayaBottomNav .active { font-weight: 800; }

/* botoes flutuantes sobem acima da barra inferior */
@media (max-width: 991.98px) {
  .aya-botoes-flutuantes { bottom: 88px !important; }
}
