@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600;700;800;900&display=swap');

body,
button,
input,
select,
textarea,
h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
a,
label {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* User greeting name layout fix to prevent overlapping */
.user-greeting-name,
h1.storm-display {
  position: relative !important;
  display: block !important;
  line-height: 1.25 !important;
  margin-top: 0.25rem !important;
  margin-bottom: 0.25rem !important;
  clear: both !important;
}

/* --------------------------------------------------------------------------
   DARK THEME SYSTEM TOKENS
   -------------------------------------------------------------------------- */
html[data-theme="dark"],
html:not([data-theme="light"]) {
  --theme-bg: #0c0f14;
  --theme-bg-secondary: #121721;
  --theme-card-bg: #151c28;
  --theme-card-border: rgba(255, 255, 255, 0.08);
  --theme-text-primary: #f8fafc;
  --theme-text-secondary: #94a3b8;
  --theme-header-bg: rgba(12, 15, 20, 0.85);
  --theme-header-border: rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   LIGHT THEME SYSTEM & COMPONENT OVERRIDES
   -------------------------------------------------------------------------- */
html[data-theme="light"] {
  --theme-bg: #f8fafc;
  --theme-bg-secondary: #ffffff;
  --theme-card-bg: #ffffff;
  --theme-card-border: #e2e8f0;
  --theme-text-primary: #0f172a;
  --theme-text-secondary: #475569;
  --theme-header-bg: rgba(255, 255, 255, 0.92);
  --theme-header-border: #e2e8f0;
  color-scheme: light;
}

html[data-theme="light"],
html[data-theme="light"] body {
  background-color: var(--theme-bg) !important;
  color: var(--theme-text-primary) !important;
}

/* --------------------------------------------------------------------------
   LIGHT THEME MOBILE SIDEBAR DRAWER & OVERLAY (.landing-mobile-drawer & aside)
   -------------------------------------------------------------------------- */
html[data-theme="light"] aside.storm-sidebar-glow,
html[data-theme="light"] #admin-sidebar,
html[data-theme="light"] .landing-mobile-drawer {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-left: 1px solid #cbd5e1 !important;
  border-right: 1px solid #cbd5e1 !important;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.15) !important;
}

html[data-theme="light"] .landing-mobile-drawer span,
html[data-theme="light"] .landing-mobile-drawer p,
html[data-theme="light"] .landing-mobile-drawer h3,
html[data-theme="light"] aside.storm-sidebar-glow span,
html[data-theme="light"] aside.storm-sidebar-glow p {
  color: #0f172a !important;
}

html[data-theme="light"] .landing-mobile-drawer a,
html[data-theme="light"] aside.storm-sidebar-glow a {
  color: #1e293b !important;
}

html[data-theme="light"] .landing-mobile-drawer a:hover,
html[data-theme="light"] aside.storm-sidebar-glow a:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .landing-mobile-drawer svg,
html[data-theme="light"] aside.storm-sidebar-glow svg {
  color: #475569 !important;
}

html[data-theme="light"] .landing-mobile-drawer a:hover svg,
html[data-theme="light"] aside.storm-sidebar-glow a:hover svg {
  color: #0f172a !important;
}

html[data-theme="light"] .mobile-drawer-close {
  color: #475569 !important;
}

html[data-theme="light"] .mobile-drawer-close:hover {
  color: #0f172a !important;
}

html[data-theme="light"] .landing-mobile-drawer .border-storm-800,
html[data-theme="light"] aside.storm-sidebar-glow .border-storm-600\/50,
html[data-theme="light"] aside.storm-sidebar-glow .border-storm-700\/40 {
  border-color: #e2e8f0 !important;
}

html[data-theme="light"] .landing-mobile-drawer a[href="/login"] {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] .landing-mobile-drawer a[href="/login"]:hover {
  background-color: #e2e8f0 !important;
}

/* --------------------------------------------------------------------------
   LIGHT THEME LOGIN PAGE OVERRIDES (.login-page, .login-form-panel, .login-showcase)
   -------------------------------------------------------------------------- */
html[data-theme="light"] .login-page {
  --login-border: #cbd5e1;
  --login-border-hover: #94a3b8;
  --login-muted: #64748b;
  --login-surface: #f8fafc;
  background-color: #f8fafc !important;
  color: #0f172a !important;
}

html[data-theme="light"] .login-form-panel {
  background-color: #ffffff !important;
  border-right-color: #cbd5e1 !important;
}

html[data-theme="light"] .login-form-shell h1 {
  color: #0f172a !important;
}

html[data-theme="light"] .login-form-shell p,
html[data-theme="light"] .login-form-shell .text-\[\#8b8b93\],
html[data-theme="light"] .login-form-shell .text-\[\#a1a1aa\] {
  color: #475569 !important;
}

html[data-theme="light"] .login-brand-text {
  color: #0f172a !important;
}

html[data-theme="light"] .login-btn-social {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

html[data-theme="light"] .login-btn-social:hover {
  background-color: #e2e8f0 !important;
  border-color: #94a3b8 !important;
}

html[data-theme="light"] .login-field {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

html[data-theme="light"] .login-field:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}

html[data-theme="light"] .login-btn-primary {
  background-color: #0f172a !important;
  color: #ffffff !important;
  border-color: #0f172a !important;
}

html[data-theme="light"] .login-btn-primary:hover {
  background-color: #1e293b !important;
}

html[data-theme="light"] .login-legal {
  color: #64748b !important;
}

html[data-theme="light"] .login-legal a {
  color: #2563eb !important;
}

html[data-theme="light"] .login-footer-link {
  color: #64748b !important;
}

html[data-theme="light"] .login-footer-link:hover {
  color: #0f172a !important;
}

html[data-theme="light"] .login-showcase {
  background-color: #f1f5f9 !important;
  border-left: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] .login-showcase-grid {
  background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px), linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px) !important;
}

html[data-theme="light"] .login-showcase p,
html[data-theme="light"] .login-showcase .text-\[\#7a7a84\],
html[data-theme="light"] .login-showcase .text-\[\#8b8b93\] {
  color: #475569 !important;
}

html[data-theme="light"] .login-showcase-title {
  color: #0f172a !important;
}

html[data-theme="light"] .login-showcase-accent {
  color: #059669 !important;
}

html[data-theme="light"] .login-stats {
  border-color: #cbd5e1 !important;
}

html[data-theme="light"] .login-stats__value {
  color: #0f172a !important;
}

html[data-theme="light"] .login-stats__label {
  color: #64748b !important;
}

html[data-theme="light"] .login-features__title {
  color: #0f172a !important;
}

html[data-theme="light"] .login-features__desc {
  color: #64748b !important;
}

html[data-theme="light"] .login-quote {
  border-left-color: #059669 !important;
  color: #334155 !important;
}

/* --------------------------------------------------------------------------
   LIGHT THEME POPOVERS & BUTTONS OVERRIDES
   -------------------------------------------------------------------------- */
#sidebar-user-popover,
#user-header-dropdown-menu {
  transform-origin: top right;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s !important;
}

#sidebar-user-popover {
  transform-origin: bottom left !important;
}

#sidebar-user-popover.hidden,
#user-header-dropdown-menu.hidden {
  opacity: 0 !important;
  transform: translateY(-8px) scale(0.95) !important;
  pointer-events: none !important;
  visibility: hidden !important;
  display: block !important;
}

#sidebar-user-popover.hidden {
  transform: translateY(8px) scale(0.95) !important;
}

#sidebar-user-popover:not(.hidden),
#user-header-dropdown-menu:not(.hidden) {
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
  pointer-events: auto !important;
  visibility: visible !important;
  display: block !important;
}

@media screen and (max-width: 1023px) {
  #sidebar-user-popover:not(.hidden) {
    transform-origin: bottom center !important;
  }
}

html[data-theme="light"] #sidebar-user-popover,
html[data-theme="light"] #sidebar-bell-popover,
html[data-theme="light"] #user-header-dropdown-menu {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 14px 45px rgba(0, 0, 0, 0.12) !important;
}

html[data-theme="light"] #sidebar-user-popover p,
html[data-theme="light"] #sidebar-bell-popover p,
html[data-theme="light"] #sidebar-user-popover h3,
html[data-theme="light"] #sidebar-bell-popover h3 {
  color: #0f172a !important;
}

html[data-theme="light"] #sidebar-user-popover .text-storm-400,
html[data-theme="light"] #sidebar-bell-popover .text-storm-400 {
  color: #64748b !important;
}

html[data-theme="light"] #sidebar-user-popover a,
html[data-theme="light"] #popover-nav-links a {
  color: #1e293b !important;
}

html[data-theme="light"] #sidebar-user-popover a:hover,
html[data-theme="light"] #popover-nav-links a:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

html[data-theme="light"] #sidebar-user-popover .border-storm-800\/80,
html[data-theme="light"] #sidebar-bell-popover .border-storm-800\/80,
html[data-theme="light"] #sidebar-bell-popover .border-storm-700\/50 {
  border-color: #e2e8f0 !important;
}

html[data-theme="light"] #sidebar-user-btn,
html[data-theme="light"] #sidebar-bell-btn {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html[data-theme="light"] #sidebar-user-btn:hover,
html[data-theme="light"] #sidebar-bell-btn:hover {
  background-color: #f8fafc !important;
}

/* --------------------------------------------------------------------------
   PREMIUM ROUNDED PAGE HEADER BANNER CARD (Dashboard, Faturas, Apps, Admin)
   -------------------------------------------------------------------------- */
main header,
.page-welcome-card {
  border-radius: 1.5rem !important;
  /* 24px rounded corners */
  padding: 1.5rem 1.75rem !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  background: linear-gradient(135deg, rgba(20, 26, 38, 0.95) 0%, rgba(12, 16, 24, 0.98) 100%) !important;
  box-shadow: 0 12px 35px -10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
  backdrop-filter: blur(16px) !important;
  margin-bottom: 1.75rem !important;
}

html[data-theme="light"] main header,
html[data-theme="light"] .page-welcome-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 12px 35px -10px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

/* Rounded Buttons inside Header Card */
main header button,
main header a button,
main header a[href="/planos"] button {
  border-radius: 0.875rem !important;
  /* 14px rounded corners */
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

main header button:hover,
main header a button:hover {
  transform: translateY(-1px) scale(1.01) !important;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35) !important;
}

/* --------------------------------------------------------------------------
   PREMIUM ROUNDED CARDS & SUMMARY PANELS
   -------------------------------------------------------------------------- */
.storm-panel,
.storm-card,
div[class*="rounded-xl"],
div[class*="rounded-2xl"] {
  border-radius: 1.25rem !important;
  /* 20px ultra smooth corners */
}

/* Panels, cards, and containers in Light Theme */
html[data-theme="light"] .bg-storm-900,
html[data-theme="light"] .bg-storm-950,
html[data-theme="light"] .bg-storm-900\/60,
html[data-theme="light"] .bg-storm-950\/60,
html[data-theme="light"] .storm-panel,
html[data-theme="light"] .storm-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04) !important;
}

html[data-theme="light"] .bg-storm-800,
html[data-theme="light"] .bg-storm-800\/80,
html[data-theme="light"] .bg-storm-800\/60,
html[data-theme="light"] .bg-storm-800\/50,
html[data-theme="light"] .bg-storm-800\/40,
html[data-theme="light"] .bg-storm-800\/25 {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

/* Light Theme Typography */
html[data-theme="light"] .text-storm-50,
html[data-theme="light"] .text-storm-100 {
  color: #0f172a !important;
}

html[data-theme="light"] .text-storm-200,
html[data-theme="light"] .text-storm-300 {
  color: #1e293b !important;
}

html[data-theme="light"] .text-storm-400,
html[data-theme="light"] .text-storm-500 {
  color: #475569 !important;
}

/* Light Theme Header (Top Navigation bar) */
html[data-theme="light"] body>header,
html[data-theme="light"] header.fixed,
html[data-theme="light"] header.sticky {
  background-color: rgba(255, 255, 255, 0.95) !important;
  border-bottom-color: #e2e8f0 !important;
  backdrop-filter: blur(12px);
}

/* Light Theme Borders */
html[data-theme="light"] .border-storm-800,
html[data-theme="light"] .border-storm-700,
html[data-theme="light"] .border-storm-700\/80,
html[data-theme="light"] .border-storm-700\/60,
html[data-theme="light"] .border-storm-700\/50,
html[data-theme="light"] .border-storm-600\/50 {
  border-color: #cbd5e1 !important;
}

/* Light Theme Inputs */
html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="email"],
html[data-theme="light"] input[type="password"],
html[data-theme="light"] input[type="search"],
html[data-theme="light"] select,
html[data-theme="light"] textarea {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
  border-radius: 0.875rem !important;
}

html[data-theme="light"] input::placeholder {
  color: #64748b !important;
}

/* Light Theme Tables */
html[data-theme="light"] table {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

html[data-theme="light"] thead,
html[data-theme="light"] thead tr {
  background-color: #f1f5f9 !important;
}

html[data-theme="light"] th {
  color: #334155 !important;
  border-bottom-color: #cbd5e1 !important;
}

html[data-theme="light"] td {
  color: #0f172a !important;
  border-bottom-color: #e2e8f0 !important;
}

html[data-theme="light"] tbody tr:hover {
  background-color: #f8fafc !important;
}

/* Brand styling inside login */
.login-form-panel__brand span,
.login-form-panel__brand a,
.login-page .login-form-panel__brand span,
html[data-theme="light"] .login-form-panel__brand span {
  color: #ffffff !important;
}

/* Animation utilities */
[style*="opacity: 0"],
[style*="opacity:0"] {
  opacity: 1 !important;
}

[style*="transform: translateY"],
[style*="transform:translateY"] {
  transform: none !important;
}

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

::-webkit-scrollbar-track {
  background: var(--theme-bg);
}

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

@keyframes cleanFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

main,
section,
.login-page,
.login-form-panel {
  animation: cleanFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) ease-out;
}

#toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
  max-width: 420px;
  width: calc(100vw - 2.5rem);
}

.toast-item {
  pointer-events: auto;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}