/* MK Digital Admin — Mobile Layout padronizado com FitPulse AI (SOMENTE MOBILE <= 1024px; Desktop 100% intacto)
   Suporte completo a Tema Escuro (data-theme="dark") e Tema Claro (data-theme="light") */

.adm-mobile-only,
.adm-mobile-push-btn,
.adm-mobile-install-box,
.adm-bottom-nav-mobile {
  display: none !important;
}

@media (max-width: 1024px) {
  html, body {
    overflow-x: clip !important;
  }

  .layout, .main-wrap {
    background: transparent !important;
  }

  /* ==================== TEMA ESCURO (padrão FitPulse AI) ==================== */
  html:not([data-theme="light"]),
  html:not([data-theme="light"]) body {
    background-color: #090B0E !important;
    background-image:
      radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.13) 0%, transparent 40%),
      radial-gradient(circle at 85% 20%, rgba(16, 185, 129, 0.08) 0%, transparent 42%),
      linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px) !important;
    background-size: 100% 100%, 100% 100%, 44px 44px, 44px 44px !important;
    color: #F1F5F9 !important;
  }

  html:not([data-theme="light"]) .topbar {
    background: rgba(9, 11, 14, 0.92) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35) !important;
  }

  html:not([data-theme="light"]) .topbar .page-title {
    color: #FFFFFF !important;
  }

  html:not([data-theme="light"]) .menu-btn,
  html:not([data-theme="light"]) .adm-mobile-push-btn {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: #F1F5F9 !important;
  }

  html:not([data-theme="light"]) .sidebar {
    background: #0D1117 !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
  }

  html:not([data-theme="light"]) .card,
  html:not([data-theme="light"]) .kpi-card,
  html:not([data-theme="light"]) .stat-card,
  html:not([data-theme="light"]) .app-card,
  html:not([data-theme="light"]) .panel,
  html:not([data-theme="light"]) .chart-card,
  html:not([data-theme="light"]) .table-card,
  html:not([data-theme="light"]) .service-card,
  html:not([data-theme="light"]) .login-card {
    background: rgba(19, 24, 32, 0.84) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35) !important;
  }

  html:not([data-theme="light"]) input,
  html:not([data-theme="light"]) select,
  html:not([data-theme="light"]) textarea {
    background: rgba(9, 11, 14, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #F1F5F9 !important;
  }

  html:not([data-theme="light"]) .adm-bottom-nav-mobile {
    background: rgba(11, 14, 19, 0.94) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.45) !important;
  }

  html:not([data-theme="light"]) .adm-bottom-nav-item {
    color: #94A3B8;
  }

  html:not([data-theme="light"]) .adm-bottom-nav-item.active {
    color: #818CF8;
  }

  /* ==================== TEMA CLARO COMPLETO ==================== */
  html[data-theme="light"],
  html[data-theme="light"] body {
    background-color: #F4F7FB !important;
    background-image:
      radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
      radial-gradient(circle at 85% 20%, rgba(16, 185, 129, 0.06) 0%, transparent 42%),
      linear-gradient(rgba(15, 23, 42, 0.025) 1px, transparent 1px),
      linear-gradient(90deg, rgba(15, 23, 42, 0.025) 1px, transparent 1px) !important;
    background-size: 100% 100%, 100% 100%, 44px 44px, 44px 44px !important;
    color: #0F172A !important;
  }

  html[data-theme="light"] .topbar {
    background: rgba(255, 255, 255, 0.92) !important;
    border-bottom: 1px solid #E2E8F0 !important;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06) !important;
  }

  html[data-theme="light"] .topbar .page-title {
    color: #0F172A !important;
  }

  html[data-theme="light"] .menu-btn,
  html[data-theme="light"] .adm-mobile-push-btn,
  html[data-theme="light"] .btn-icon {
    background: #F1F5F9 !important;
    border: 1px solid #CBD5E1 !important;
    color: #0F172A !important;
  }

  html[data-theme="light"] .sidebar {
    background: #FFFFFF !important;
    border-right: 1px solid #E2E8F0 !important;
    color: #0F172A !important;
  }

  html[data-theme="light"] .card,
  html[data-theme="light"] .kpi-card,
  html[data-theme="light"] .stat-card,
  html[data-theme="light"] .app-card,
  html[data-theme="light"] .panel,
  html[data-theme="light"] .chart-card,
  html[data-theme="light"] .table-card,
  html[data-theme="light"] .service-card,
  html[data-theme="light"] .login-card {
    background: rgba(255, 255, 255, 0.94) !important;
    border: 1px solid #E2E8F0 !important;
    box-shadow: 0 6px 22px rgba(15, 23, 42, 0.06) !important;
    color: #0F172A !important;
  }

  html[data-theme="light"] input,
  html[data-theme="light"] select,
  html[data-theme="light"] textarea {
    background: #FFFFFF !important;
    border: 1px solid #CBD5E1 !important;
    color: #0F172A !important;
  }

  html[data-theme="light"] .adm-mobile-install-box {
    background: rgba(99, 102, 241, 0.07) !important;
    border: 1px solid rgba(99, 102, 241, 0.24) !important;
  }

  html[data-theme="light"] .adm-mobile-install-title {
    color: #3730A3 !important;
  }

  html[data-theme="light"] .adm-install-btn:not(.android) {
    background: #FFFFFF !important;
    border: 1px solid #CBD5E1 !important;
    color: #0F172A !important;
  }

  html[data-theme="light"] .adm-bottom-nav-mobile {
    background: rgba(255, 255, 255, 0.95) !important;
    border-top: 1px solid #E2E8F0 !important;
    box-shadow: 0 -6px 22px rgba(15, 23, 42, 0.08) !important;
  }

  html[data-theme="light"] .adm-bottom-nav-item {
    color: #64748B;
  }

  html[data-theme="light"] .adm-bottom-nav-item.active {
    color: #4F46E5;
  }

  /* ==================== ESTRUTURA COMPARTILHADA MOBILE ==================== */
  .topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 40 !important;
    min-height: 56px !important;
    padding: 8px 14px !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
  }

  .topbar .page-title {
    font-size: 15.5px !important;
    font-weight: 700 !important;
  }

  .topbar .page-subtitle {
    display: none !important;
  }

  .menu-btn {
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
  }

  .adm-mobile-push-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    transition: all 0.2s ease !important;
  }

  /* Sino verde em ambos os temas quando ativo */
  html .adm-mobile-push-btn.is-push-active {
    background: #10B981 !important;
    border-color: #34D399 !important;
    color: #FFFFFF !important;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.55) !important;
  }

  .content {
    padding: 16px 14px calc(88px + env(safe-area-inset-bottom, 0px)) 14px !important;
  }

  .card,
  .kpi-card,
  .stat-card,
  .app-card,
  .panel,
  .chart-card,
  .table-card,
  .service-card,
  .login-card {
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-radius: 16px !important;
  }

  input, select, textarea {
    font-size: 16px !important;
    border-radius: 12px !important;
  }

  .adm-mobile-install-box {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.10);
    border: 1px solid rgba(99, 102, 241, 0.28);
  }

  .adm-mobile-install-title {
    font-size: 11.5px;
    font-weight: 700;
    color: #c7d2fe;
    text-align: center;
  }

  .adm-mobile-install-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .adm-install-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 8px;
    border-radius: 10px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.85);
    color: #f1f5f9;
  }

  .adm-install-btn.android {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border-color: transparent;
    color: #ffffff;
  }

  .adm-bottom-nav-mobile {
    display: block !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 45 !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  }

  .adm-bottom-nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: 64px;
    max-width: 540px;
    margin: 0 auto;
  }

  .adm-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
  }

  .adm-bottom-nav-item svg {
    width: 20px;
    height: 20px;
  }
}
