/*
 * HYDRA CREATIVE — COMPONENTS.CSS
 * Shell, Navegação, Cards, Formulários,
 * Gaveta, Modais, Toast, Botões.
 * System Contract V2
 */


/* ═══════════════════════════════════════════
 * 1. APP SHELL
 * ═══════════════════════════════════════════ */


.app-shell {
  display: grid;
  grid-template-columns: 72px 1fr;
  grid-template-rows: 1fr;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-base);
}


.main-content {
  grid-column: 2;
  grid-row: 1;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100dvh;
  padding: var(--space-xl);
  background: var(--bg-base);
}


/* ═══════════════════════════════════════════
 * 2. SIDEBAR DESKTOP
 * ═══════════════════════════════════════════ */


.nav-sidebar {
  grid-column: 1;
  grid-row: 1;
  width: 72px;
  height: 100dvh;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-md) 0;
  gap: var(--space-xs);
  overflow: hidden;
  transition: width var(--transition-normal);
  z-index: var(--z-sidebar);
  position: relative;
}


.nav-sidebar.is-expanded {
  width: 220px;
  align-items: flex-start;
  padding: var(--space-md) var(--space-sm);
}


.nav-sidebar .logo,
.nav-sidebar .logo-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  margin-bottom: var(--space-md);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}


.nav-sidebar .logo-mark::after {
  content: 'H';
  color: #000;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
}


.sidebar-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-sm);
}


.nav-sidebar.is-expanded .sidebar-top {
  flex-direction: row;
  justify-content: space-between;
  padding: 0 var(--space-sm) var(--space-md);
}


.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  margin-top: 0;
  transition: color var(--transition-fast);
}


.sidebar-toggle:hover {
  color: var(--text-main);
}


.nav-sidebar.is-expanded .sidebar-toggle {
  width: 100%;
  justify-content: flex-end;
  padding-right: var(--space-sm);
}


.nav-sidebar .nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
  position: relative;
  flex-shrink: 0;
}


.nav-sidebar .nav-item svg,
.nav-sidebar .nav-item [data-lucide] {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  flex-shrink: 0;
}


.nav-sidebar .nav-item span {
  display: none;
  margin-left: var(--space-sm);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}


.nav-sidebar .nav-item.is-active {
  background: rgba(255, 176, 32, 0.15);
  color: var(--accent-primary);
}


.nav-sidebar .nav-item:not(.is-active):hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}


.nav-sidebar.is-expanded .nav-item {
  width: 100%;
  justify-content: flex-start;
  padding: 0 var(--space-sm);
}


.nav-sidebar.is-expanded .nav-item span {
  display: inline;
}


.nav-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  width: 100%;
}


.nav-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  width: 100%;
}


.nav-sidebar.is-expanded .nav-group,
.nav-sidebar.is-expanded .nav-footer {
  align-items: flex-start;
}


/* ═══════════════════════════════════════════
 * 3. NAV BOTTOM — só existe no mobile
 * ═══════════════════════════════════════════ */


.nav-bottom {
  display: none;
}


/* ═══════════════════════════════════════════
 * 4. HEADER DA PÁGINA
 * ═══════════════════════════════════════════ */


.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
}


.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}


/* ═══════════════════════════════════════════
 * 5. PERFIL / DROPDOWN DE AVATAR
 * ═══════════════════════════════════════════ */


.profile-container {
  position: relative;
}


.avatar-trigger {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition-fast);
}


.avatar-trigger:hover,
.profile-container.is-active .avatar-trigger {
  border-color: var(--accent-primary);
}


.avatar-trigger img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


.dropdown-profile {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 240px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition:
    opacity var(--transition-base),
    transform var(--transition-base);
}


.profile-container.is-active .dropdown-profile {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}


.dropdown-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-sm);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
}


.dropdown-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}


.dropdown-link--danger:hover {
  background: rgba(255, 75, 75, 0.1);
  color: var(--accent-secondary);
}


.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-sm) 0;
}


/* ═══════════════════════════════════════════
 * 6. BADGE DE PLANO
 * ═══════════════════════════════════════════ */


.badge-plan {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--accent-gradient);
  color: var(--text-inverse);
}


/* ═══════════════════════════════════════════
 * 7. CARDS
 * ═══════════════════════════════════════════ */


.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}


.plan-card {
  background: linear-gradient(135deg, #1a1400, #1a0a00);
  border: 1px solid rgba(255, 176, 32, 0.25);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}


.plan-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
}


/* ═══════════════════════════════════════════
 * 8. BARRA DE ARMAZENAMENTO
 * ═══════════════════════════════════════════ */


.storage-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-pill);
  overflow: hidden;
  display: flex;
}


.storage-bar .bar--assets {
  height: 100%;
  width: var(--storage-assets, 0%);
  background: var(--accent-primary);
  transition: width 0.5s ease;
}


.storage-bar .bar--ai {
  height: 100%;
  width: var(--storage-ai, 0%);
  background: #FF7A00;
  transition: width 0.5s ease;
}


.storage-bar .bar--free {
  height: 100%;
  width: var(--storage-free, 0%);
  background: rgba(255, 255, 255, 0.15);
  transition: width 0.5s ease;
}


.storage-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: var(--space-xs);
  color: var(--text-muted);
}


/* ═══════════════════════════════════════════
 * 9. FORMULÁRIOS
 * ═══════════════════════════════════════════ */


.form-control {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition-fast);
  resize: vertical;
}


.form-control:focus {
  border-color: var(--border-focus);
}


.form-control::placeholder {
  color: var(--text-muted);
}


.form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


.tool-section {
  margin-bottom: var(--space-lg);
}


.tool-section:last-child {
  margin-bottom: 0;
}


.tool-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
}


.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}


/* ═══════════════════════════════════════════
 * 10. BOTÕES
 * ═══════════════════════════════════════════ */


.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-body);
  border: none;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    transform var(--transition-fast),
    opacity var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}


.btn:active {
  transform: scale(0.97);
}


.btn-primary,
.btn.btn-primary {
  background: var(--accent-primary);
  color: var(--text-inverse);
}


.btn-primary:hover,
.btn.btn-primary:hover {
  background: #e89e10;
}


.btn-outline,
.btn.btn-outline {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}


.btn-outline:hover,
.btn.btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
}


.btn-danger {
  background: var(--accent-secondary);
  color: #fff;
}


.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}


.btn-icon:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}


.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px;
  border-radius: var(--radius-md);
  background: #fff;
  color: #1a1a1a;
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}


.btn-google img {
  width: 18px;
  height: 18px;
}


.btn-google:hover {
  opacity: 0.9;
}


/* ═══════════════════════════════════════════
 * 11. CHIPS SELETORES
 * ═══════════════════════════════════════════ */


.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
  white-space: nowrap;
}


.chip:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.25);
}


.chip.is-active {
  background: var(--accent-primary);
  color: var(--text-inverse);
  border-color: var(--accent-primary);
}


.format-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
}


.format-chip.is-active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(255, 176, 32, 0.1);
}


/* ═══════════════════════════════════════════
 * 12. TOGGLE (ON/OFF)
 * ═══════════════════════════════════════════ */


.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}


.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}


.slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  transition: background var(--transition-base);
  cursor: pointer;
}


.slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition-base);
}


.switch input:checked + .slider {
  background: var(--accent-primary);
}


.switch input:checked + .slider::before {
  transform: translateX(18px);
}


.toggle-group {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
  margin-bottom: var(--space-lg);
}


.toggle-btn {
  flex: 1;
  padding: 7px 12px;
  border-radius: calc(var(--radius-md) - 2px);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}


.toggle-btn.is-active {
  background: var(--accent-primary);
  color: var(--text-inverse);
}


/* ═══════════════════════════════════════════
 * 13. THUMBNAILS DE ASSETS
 * ═══════════════════════════════════════════ */


.thumb-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
}


.thumb-option {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition-fast);
}


.thumb-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


.thumb-option.is-active {
  border-color: var(--accent-primary);
}


.thumb-option--add {
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: var(--text-muted);
  font-size: 20px;
}


.thumb-option--add:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}


/* ═══════════════════════════════════════════
 * 14. SECTION HEADER
 * ═══════════════════════════════════════════ */


.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}


.section-header .tool-label {
  margin-bottom: 0;
}


/* ═══════════════════════════════════════════
 * 15. DIVIDERS
 * ═══════════════════════════════════════════ */


.divider-v {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
  flex-shrink: 0;
}


/* ═══════════════════════════════════════════
 * 16. OVERLAY
 * ═══════════════════════════════════════════ */


.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-heavy);
  z-index: var(--z-overlay); /* 200 */
}


.modal-overlay.is-active {
  display: block;
}


/* ═══════════════════════════════════════════
 * 17. BOTTOM SHEET (GAVETA)
 * ═══════════════════════════════════════════ */


.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-panel);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border-top: 1px solid rgba(255, 176, 32, 0.15);
  z-index: var(--z-modal); /* 300 — acima do overlay:200 */
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 80dvh;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
}


.bottom-sheet.is-active {
  transform: translateY(0);
  pointer-events: auto;
}


.bottom-sheet-handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-pill);
  margin: 12px auto 8px;
  cursor: pointer;
  flex-shrink: 0;
}


.tool-panel-content {
    padding: var(--space-md) var(--space-lg) var(--space-2xl);
    max-height: calc(80dvh - 28px);
    flex: 1;
    overflow-y: scroll;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Edge */
}

.tool-panel-content::-webkit-scrollbar {
    display: none !important; /* Chrome/Safari */
}

/* EXCEÇÃO: Se estivermos na página de criação, voltamos ao padrão que funciona */
.page-creative .tool-panel-content {
    overflow-y: auto; /* Deixa o navegador gerenciar como preferir */
    scrollbar-width: auto; 
    -ms-overflow-style: auto;
}

.page-creative .tool-panel-content::-webkit-scrollbar {
    display: block !important; /* Reativa se necessário para o script de toque */
}

/* ═══════════════════════════════════════════
 * 18. TOAST / NOTIFICAÇÕES
 * ═══════════════════════════════════════════ */


.toast-container {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  z-index: var(--z-toast);
  pointer-events: none;
}


.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 12px var(--space-md);
  border-radius: var(--radius-md);
  min-width: 260px;
  max-width: 380px;
  font-size: 14px;
  pointer-events: auto;
  animation: toast-in 0.3s ease;
  transition: opacity 0.5s ease;
}


.toast.is-fading {
  opacity: 0;
}


.toast--primary {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}


.toast--success {
  background: #0f2a1a;
  border: 1px solid #1a5c35;
  color: #4ade80;
}


.toast--error {
  background: #2a0f0f;
  border: 1px solid #5c1a1a;
  color: var(--accent-secondary);
}


.toast__close {
  background: none;
  border: none;
  color: inherit;
  font-size: 16px;
  opacity: 0.6;
  cursor: pointer;
  padding: 0 4px;
}


@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}


/* ═══════════════════════════════════════════
 * 19. LOGIN PAGE
 * ═══════════════════════════════════════════ */


.login-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100dvh;
  overflow: hidden;
}


.login-visual {
  position: relative;
  background: var(--bg-panel);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}


.login-visual canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}


.login-visual-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: var(--space-xl);
}


.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  background: var(--bg-base);
  overflow-y: auto;
}


/* ═══════════════════════════════════════════
 * 20. BIBLIOTECA — LAYOUT
 * ═══════════════════════════════════════════ */


.library-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100%;
  overflow: hidden;
  padding: 0;
}


.library-sidebar {
  padding: var(--space-lg);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}


.library-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}


.asset-grid-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  gap: var(--space-md);
  align-items: center;
  flex-shrink: 0;
}


.search-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 var(--space-sm);
}


.search-wrapper input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 14px;
  padding: 10px var(--space-sm);
  outline: none;
  width: 100%;
}


.search-wrapper svg {
  color: var(--text-muted);
  flex-shrink: 0;
}


.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-md);
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
}


.asset-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}


.asset-card.is-selected {
  border-color: var(--accent-primary);
}


.asset-card__thumb {
  aspect-ratio: 1;
  overflow: hidden;
}


.asset-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}


.asset-card:hover .asset-card__thumb img {
  transform: scale(1.04);
}


.asset-card__info {
  padding: var(--space-sm);
}


.asset-card__name {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.asset-card__meta {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}


.asset-card__check-icon {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.7);
  transition:
    opacity var(--transition-fast),
    transform var(--transition-fast);
}


.asset-card.is-selected .asset-card__check-icon {
  opacity: 1;
  transform: scale(1);
}


.asset-card__checkbox {
  display: none;
}


.filter-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}


.filter-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-muted);
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}


.filter-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}


.filter-item.is-active {
  background: rgba(255, 176, 32, 0.1);
  color: var(--accent-primary);
}


.mobile-filter-trigger {
  display: none;
}


/* ═══════════════════════════════════════════
 * 21. PERFIL — LAYOUT
 * ═══════════════════════════════════════════ */


.perfil-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-xl);
  padding: var(--space-xl);
}


.perfil-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}


.perfil-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}


.avatar-upload-section {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}


.avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--accent-primary);
  padding: 2px;
  position: relative;
  flex-shrink: 0;
}


.avatar-preview img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-pill);
  object-fit: cover;
}


.avatar-edit-btn {
  position: absolute;
  bottom: 0;
  right: -4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid var(--bg-base);
  font-size: 12px;
}


/* ═══════════════════════════════════════════
 * 22. UPLOAD / DROP ZONE
 * ═══════════════════════════════════════════ */


.drop-zone {
  margin-top: var(--space-sm);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-muted);
  transition: border-color var(--transition-fast);
  cursor: pointer;
}


.drop-zone:hover {
  border-color: var(--accent-primary);
}


/* ═══════════════════════════════════════════
 * 23. SPIN (LOADER)
 * ═══════════════════════════════════════════ */


.spin {
  animation: spin 0.8s linear infinite;
  display: inline-block;
}


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


/* ═══════════════════════════════════════════
 * 24. NO-SCROLL GUARD
 * ═══════════════════════════════════════════ */


body.no-scroll {
  overflow: hidden;
}


/* ═══════════════════════════════════════════
 * 25. MOBILE — @media ≤ 1024px
 * ═══════════════════════════════════════════ */


@media (max-width: 1024px) {

  /* Shell volta para 2 linhas: conteúdo + nav */
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 64px;
    height: 100dvh;
  }

  /* Sidebar desktop some */
  .nav-sidebar {
    display: none;
  }

  /* Conteúdo ocupa row 1 */
  .main-content {
    grid-column: 1;
    grid-row: 1;
    height: calc(100dvh - 64px);
    padding: var(--space-md);
    overflow-y: auto;
  }

  /* Nav bottom ocupa row 2 — no grid, não fixed */
  .nav-bottom {
    display: flex;
    grid-column: 1;
    grid-row: 2;
    height: 64px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border-subtle);
    align-items: center;
    justify-content: space-around;
    padding: 0 var(--space-sm);
    /* Cria stacking context acima de tudo */
    position: relative;
    z-index: 9999;
    /* Garante que o nav pinte por cima da gaveta fixed */
    isolation: isolate;
  }

  .nav-bottom .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 10px;
    transition: color var(--transition-fast);
    min-width: 48px;
  }

  .nav-bottom .nav-item svg,
  .nav-bottom .nav-item [data-lucide] {
    width: 22px;
    height: 22px;
    stroke: currentColor;
  }

  .nav-bottom .nav-item.is-active {
    color: var(--accent-primary);
  }

.bottom-sheet {
    bottom: 64px; 
    max-height: calc(75dvh - 64px);
    z-index: 95; 
    
    /* A CORREÇÃO MATEMÁTICA: Oculta a gaveta, mas deixa exatos 48px visíveis acima do menu */
    transform: translateY(calc(100% - 48px)); 
    
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-panel);
    border-radius: 20px 20px 0 0;
    border-top: 1px solid rgba(255,176,32,0.2); 
    box-shadow: 0 -4px 32px rgba(0,0,0,0.6);
    
    /* Garante a estrutura flexível para o conteúdo interno rolar corretamente */
    display: flex;
    flex-direction: column;
  }

  .bottom-sheet.is-active {
    transform: translateY(0);
    pointer-events: auto;
  }

.bottom-sheet-handle {
    width: 36px;
    height: 3px;
    background: rgba(255,176,32,0.4);
    border-radius: var(--radius-pill);
    margin: 12px auto 8px;
    position: relative;
    animation: swipe-hint 2.5s 1s ease infinite; /* A animação sutil de volta */
    pointer-events: auto;
  }

  .bottom-sheet-handle::before {
    content: '';
    position: absolute;
    inset: -14px -40px; 
  }

  @keyframes swipe-hint {
    0%, 100% { transform: translateY(0);    opacity: 0.3; }
    50%      { transform: translateY(-4px); opacity: 1;   }
  }

  /* ── Overlay Unificado e Corrigido ── */
  .modal-overlay.is-active {
    /* Atrás da gaveta (95) e do menu (100). Escurece o conteúdo, mas mantém o app navegável */
    z-index: 90; 
  }

  .library-layout,
  .perfil-layout {
    grid-template-columns: 1fr;
  }

  .library-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .mobile-filter-trigger {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .hide-mobile {
    display: none;
  }

  .toast-container {
    bottom: 80px;
    right: var(--space-md);
    left: var(--space-md);
  }

  .toast {
    min-width: unset;
    max-width: 100%;
  }
}


/* ═══════════════════════════════════════════
 * 26. MOBILE — @media ≤ 640px
 * ═══════════════════════════════════════════ */


@media (max-width: 640px) {

  .login-layout {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .login-form-side {
    padding: var(--space-lg);
  }

  .asset-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}
