/**
 * EZ-Mobi web components — classes ez-*
 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body.ez-body {
  margin: 0;
  font-family: var(--font-family);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

/* Shell backgrounds (16:9 cover — paridade AuthScreenLayout) */
.ez-auth-shell,
.ez-app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background-image: var(--ez-bg-shell);
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
}

.ez-auth-shell__inner {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-screen) 16px;
}

.ez-auth-card {
  width: 100%;
  max-width: var(--auth-card-max-width);
  background: var(--auth-card-bg);
  border-radius: var(--auth-card-radius);
  padding: var(--auth-card-padding);
  box-shadow: var(--shadow-card);
}

.ez-app-shell__main {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.ez-content-panel {
  flex: 1;
  background: var(--auth-card-bg);
  border-radius: 16px 16px 0 0;
  margin-top: 0;
  padding: var(--spacing-screen) 16px 32px;
  overflow-x: hidden;
}

.ez-logo-coin {
  width: 96px;
  height: 96px;
  border-radius: 22%;
  object-fit: cover;
  background: #fff;
  display: block;
  margin: 0 auto 24px;
  box-shadow: 0 4px 14px rgba(0, 25, 48, 0.12);
}

.ez-logo-coin--compact {
  width: 80px;
  height: 80px;
}

.ez-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0 0 8px;
  text-align: center;
}

.ez-subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
  margin: 0 0 24px;
  text-align: center;
  line-height: 1.5;
}

/* Buttons */
.ez-btn-primary {
  display: inline-block;
  width: auto;
  min-width: 120px;
  height: var(--height-button);
  padding: 0 16px;
  border: none;
  border-radius: var(--radius-button);
  background: var(--color-primary-button);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  line-height: var(--height-button);
  text-decoration: none;
}

.ez-btn-primary:hover {
  filter: brightness(1.08);
}

.ez-btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ez-btn-primary--block {
  display: block;
  width: 100%;
}

.ez-btn-secondary {
  display: block;
  width: 100%;
  height: var(--height-button);
  padding: 0 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  background: #fff;
  color: var(--color-primary);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  line-height: calc(var(--height-button) - 2px);
  text-decoration: none;
}

.ez-link {
  color: var(--color-link);
  text-decoration: none;
  font-size: 14px;
}

.ez-link:hover {
  text-decoration: underline;
}

/* Fields */
.ez-field-group {
  margin-bottom: var(--spacing-field);
}

.ez-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 6px;
}

.ez-field {
  width: 100%;
  height: var(--height-input);
  padding: 0 12px;
  border: 1px solid var(--color-input-on-card-border);
  border-radius: var(--radius-input);
  background: var(--color-input-on-card);
  color: var(--color-text-on-bg);
  font-size: 16px;
  font-family: inherit;
}

.ez-field:focus {
  outline: 2px solid var(--color-link);
  border-color: var(--color-link);
}

.ez-field::placeholder {
  color: var(--color-text-muted-on-bg);
}

.ez-checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 20px;
  font-size: 14px;
}

/* Alerts */
.ez-alert {
  padding: 12px 16px;
  border-radius: var(--radius-input);
  margin-bottom: 16px;
  font-size: 14px;
  max-width: var(--auth-card-max-width);
  width: 100%;
}

.ez-alert--error {
  background: #fde8e8;
  color: var(--color-danger);
  border: 1px solid #f5c6c6;
}

.ez-alert--success {
  background: #e8f8ee;
  color: var(--color-success);
  border: 1px solid #b8e6c8;
}

.ez-alert--info {
  background: #e8f4f8;
  color: var(--color-dialog-info);
  border: 1px solid #b8d4e6;
}

/* Toolbar */
.ez-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--toolbar-height);
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 8px rgba(0, 25, 48, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}

.ez-toolbar__side {
  width: 44px;
  flex-shrink: 0;
}

.ez-toolbar__title {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ez-toolbar__menu-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--color-primary);
}

.ez-toolbar__menu-btn .mdi {
  font-size: 28px;
}

/* Drawer */
.ez-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--color-dialog-backdrop);
  z-index: 200;
}

.ez-drawer-overlay.is-open {
  display: block;
}

.ez-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--drawer-width);
  max-width: 85vw;
  height: 100%;
  background: transparent;
  box-shadow: none;
  z-index: 201;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow: hidden;
  padding: 0;
}

.ez-drawer__panel {
  height: 100%;
  overflow-y: auto;
  padding-bottom: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 4px 0 24px rgba(0, 25, 48, 0.15);
}

.ez-drawer.is-open {
  transform: translateX(0);
}

.ez-drawer__header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--color-border);
}

.ez-drawer__profile-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
  margin: 8px 0 4px;
}

.ez-drawer__profile-meta {
  font-size: 13px;
  color: var(--color-text-muted);
}

.ez-drawer__plan {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--color-icon-muted);
  color: #fff;
  font-size: 13px;
}

.ez-drawer__section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  padding: 16px 16px 8px;
  margin: 0;
}

.ez-drawer__item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 16px;
  color: var(--color-text);
  text-decoration: none;
  font-size: 16px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.ez-drawer__item:hover {
  background: rgba(0, 69, 102, 0.06);
}

.ez-drawer__item.is-active {
  background: rgba(0, 69, 102, 0.08);
  border-left: 3px solid var(--color-primary);
  padding-left: 13px;
  font-weight: 600;
  color: var(--color-primary);
}

.ez-drawer__item .mdi:first-child {
  font-size: 24px;
  color: var(--color-primary);
  flex-shrink: 0;
}

.ez-drawer__item-chevron {
  margin-left: auto;
  color: var(--color-text-muted) !important;
}

.ez-drawer__item-label {
  flex: 1;
}

.ez-drawer__profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 16px 16px;
  padding: 12px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--color-input-on-card-border);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: inherit;
}

.ez-drawer__avatar {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background: rgba(0, 69, 102, 0.12);
  color: var(--color-link);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ez-drawer__profile-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ez-drawer__plan-wrap {
  padding: 0 16px 8px;
  margin: 0;
}

.ez-drawer__logout {
  margin-top: 16px;
}

.ez-drawer__footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: var(--drawer-width);
  max-width: 85vw;
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid var(--color-border);
  z-index: 202;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}

.ez-drawer.is-open + .ez-drawer__footer,
.ez-drawer__footer.is-open {
  transform: translateX(0);
}

.ez-drawer__item--danger {
  color: var(--color-danger);
}

.ez-drawer__item--danger .mdi {
  color: var(--color-danger);
}

.ez-empty__icon .mdi {
  font-size: 48px;
  color: var(--color-icon-muted);
}

/* Cards */
.ez-card {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 25, 48, 0.06);
  border: 1px solid var(--color-border);
}

.ez-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 16px;
}

.ez-card-tile {
  display: block;
  text-decoration: none;
  background: var(--color-primary-button);
  color: #fff;
  border-radius: var(--radius-card);
  padding: 20px;
  text-align: center;
  transition: filter 0.15s;
}

.ez-card-tile:hover {
  filter: brightness(1.1);
  color: #fff;
  text-decoration: none;
}

.ez-card-tile__title {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 8px;
}

.ez-card-tile--disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* Empty state */
.ez-empty {
  text-align: center;
  padding: 48px 24px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ez-empty__icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}

.ez-empty__icon .material-symbols-outlined {
  font-size: 36px;
  color: var(--color-primary);
}

.ez-empty__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0 0 8px;
}

.ez-empty__text {
  font-size: 14px;
  color: var(--color-text-muted);
  margin: 0;
}

/* Footer site */
.ez-site-footer {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid var(--color-border);
}

.ez-site-footer a {
  color: var(--color-link);
}

/* DataTables theme */
.ez-table-theme table.dataTable thead th {
  background: var(--color-primary) !important;
  color: #fff !important;
}

.ez-table-theme table.dataTable tbody tr:hover {
  background: rgba(0, 69, 102, 0.06) !important;
}

/* Dialog */
.ez-dialog-root {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ez-dialog-root.is-open {
  display: flex;
}

.ez-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: var(--color-dialog-backdrop);
}

.ez-dialog-box {
  position: relative;
  background: #fff;
  border-radius: var(--auth-card-radius);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--shadow-card);
}

.ez-dialog-box h2 {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--color-primary);
}

.ez-dialog-box p {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
}

.ez-dialog-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.ez-dialog-actions .ez-btn-primary,
.ez-dialog-actions .ez-btn-secondary {
  flex: 1;
  min-width: 100px;
}

.ez-dialog-btn-success {
  background: var(--color-dialog-success) !important;
}

.ez-dialog-btn-danger {
  background: var(--color-danger) !important;
}

.ez-dialog-btn-info {
  background: var(--color-dialog-info) !important;
}

.ez-dialog-btn-cancel {
  background: var(--color-dialog-cancel-bg) !important;
  color: var(--color-dialog-cancel-text) !important;
  border: none !important;
}

/* Loader */
.ez-loader-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.ez-loader {
  width: 48px;
  height: 48px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary-button);
  border-radius: 50%;
  animation: ez-spin 0.8s linear infinite;
}

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

/* Legacy content inside shell — soften inline styles */
.ez-legacy-content table {
  max-width: 100%;
}

/* Compatibilidade painel legado (home.php tiles) */
.ez-legacy-content .btnhome {
  background-color: var(--color-primary-button) !important;
  border-radius: var(--radius-card) !important;
  box-shadow: var(--shadow-card) !important;
}

.ez-legacy-content .btnhome h3 {
  color: #fff !important;
}

.ez-legacy-content #box {
  background: transparent !important;
}

.ez-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 16px 0;
}

/* Tables */
.ez-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ez-table {
  width: 100%;
  border-collapse: collapse;
}

.ez-table th,
.ez-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}

.ez-table th {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

.ez-table tbody tr:hover {
  background: rgba(0, 69, 102, 0.06);
}

/* Desktop layout (≥1024px) — sidebar persistente */
@media (min-width: 1024px) {
  body.ez-layout--desktop-nav .ez-app-shell__main {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    min-height: 100dvh;
  }

  body.ez-layout--desktop-nav .ez-drawer {
    position: sticky;
    top: 0;
    grid-row: 1 / -1;
    grid-column: 1;
    height: 100vh;
    height: 100dvh;
    transform: none;
    max-width: none;
  }

  body.ez-layout--desktop-nav .ez-drawer.is-open {
    transform: none;
  }

  body.ez-layout--desktop-nav .ez-drawer-overlay {
    display: none !important;
  }

  body.ez-layout--desktop-nav .ez-toolbar {
    grid-column: 2;
    grid-row: 1;
  }

  body.ez-layout--desktop-nav .ez-content-panel,
  body.ez-layout--desktop-nav .ez-map-panel {
    grid-column: 2;
    grid-row: 2;
    max-width: var(--content-max-width);
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    border-radius: 16px;
  }

  body.ez-layout--desktop-nav .ez-toolbar__menu-btn[data-ez-drawer-open] {
    display: none;
  }

  body.ez-layout--desktop-nav .ez-auth-card .ez-btn-primary,
  body.ez-layout--desktop-nav .ez-stack:not(.ez-filter-bar) .ez-btn-primary {
    display: block;
    width: 100%;
  }

  body.ez-layout--desktop-nav .ez-filter-bar .ez-btn-primary {
    display: inline-flex;
    width: auto;
  }

  .ez-table--comfortable th,
  .ez-table--comfortable td {
    padding: 12px 16px;
  }

  .ez-dialog-box {
    max-width: 420px;
  }
}
