/* ==========================================================================
   MS INSTALADORA - PAINEL ADMINISTRATIVO & MODAL DE GESTÃO (ADMIN.CSS)
   ========================================================================== */

.admin-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 7, 12, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.admin-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.admin-modal-window {
  background: #0f1422;
  border: 1px solid rgba(0, 102, 255, 0.35);
  border-radius: 20px;
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(0, 102, 255, 0.2);
  overflow: hidden;
  position: relative;
}

/* Auth / Login Box — Premium Design */
.admin-auth-box {
  padding: 52px 44px 44px;
  max-width: 460px;
  margin: 0 auto;
  text-align: center;
  animation: adminFadeSlideIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes adminFadeSlideIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes lockPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 102, 255, 0.35); }
  50%      { transform: scale(1.08); box-shadow: 0 0 20px 6px rgba(0, 102, 255, 0.15); }
}

.auth-header {
  margin-bottom: 32px;
}

/* Ícone de cadeado animado grande */
.auth-lock-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0, 102, 255, 0.2), rgba(0, 200, 255, 0.1));
  border: 2px solid rgba(0, 102, 255, 0.35);
  color: var(--blue-cyan, #00aaff);
  font-size: 1.7rem;
  animation: lockPulse 2.5s ease-in-out infinite;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(0, 102, 255, 0.18), rgba(0, 200, 255, 0.08));
  color: var(--blue-cyan, #00aaff);
  padding: 7px 18px;
  border-radius: 24px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 18px;
  border: 1px solid rgba(0, 102, 255, 0.3);
  backdrop-filter: blur(4px);
}

.auth-header h2 {
  font-size: 1.85rem;
  margin-bottom: 10px;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff, #c8d8f8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-header p {
  font-size: 0.9rem;
  color: var(--text-muted, #8899bb);
  line-height: 1.55;
  max-width: 380px;
  margin: 0 auto;
}

.admin-form .form-group {
  text-align: left;
  margin-bottom: 22px;
}

.admin-form .form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted, #8899bb);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #ffffff;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.25s ease;
  outline: none;
}

.input-with-icon input[type="password"] {
  padding-right: 50px;
}

.input-with-icon input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.input-with-icon input:focus {
  border-color: var(--blue-cyan, #00aaff);
  background: rgba(0, 102, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.12), 0 4px 16px rgba(0, 0, 0, 0.2);
}

.btn-toggle-pwd {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted, #8899bb);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-toggle-pwd:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.auth-forgot-link {
  text-align: right;
  margin-top: -10px;
  margin-bottom: 20px;
}

.auth-forgot-link a {
  color: var(--blue-cyan, #00aaff);
  font-size: 0.82rem;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.auth-forgot-link a:hover {
  text-decoration: underline;
  opacity: 0.85;
}

.input-hint {
  display: block;
  font-size: 0.76rem;
  color: var(--text-dim, #556688);
  margin-top: 6px;
}

.auth-info-msg {
  display: none;
  background: rgba(0, 102, 255, 0.12);
  border: 1px solid rgba(0, 102, 255, 0.35);
  color: #a8d5ff;
  font-size: 0.84rem;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  text-align: left;
  line-height: 1.45;
  animation: adminFadeSlideIn 0.3s ease;
}

.auth-error-msg {
  display: none;
  background: rgba(229, 57, 53, 0.12);
  border: 1px solid rgba(229, 57, 53, 0.35);
  color: #ff6b6b;
  font-size: 0.84rem;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  text-align: left;
  animation: shakeError 0.4s ease;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: stretch;
  gap: 14px;
  margin-top: 28px;
}

/* ---- Botões Premium do Modal ---- */
.btn-primary {
  flex: 1.5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  color: #ffffff;
  background: linear-gradient(135deg, #0066ff, #0088ff);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 4px 15px rgba(0, 102, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 102, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  background: linear-gradient(135deg, #0077ff, #0099ff);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.3);
}

.btn-secondary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted, #8899bb);
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
}

/* Dashboard Window */
.admin-dashboard {
  display: flex;
  flex-direction: column;
  height: 85vh;
  max-height: 85vh;
}

.admin-dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: #090c14;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.admin-dash-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-logo-img {
  height: 38px;
  width: auto;
  border-radius: 4px;
}

.admin-dash-brand h3 {
  font-size: 1.15rem;
  line-height: 1.2;
}

.admin-badge-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: #2ed573;
  font-weight: 600;
}

.admin-badge-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--blue-cyan, #00aaff);
  background: rgba(0, 102, 255, 0.12);
  border: 1px solid rgba(0, 102, 255, 0.25);
  padding: 2px 10px;
  border-radius: 4px;
  font-weight: 500;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  transition: var(--transition);
}

.cloud-status-badge.online {
  background: rgba(46, 213, 115, 0.15);
  color: #2ed573;
  border: 1px solid rgba(46, 213, 115, 0.3);
}

.cloud-status-badge.offline {
  background: rgba(255, 107, 0, 0.12);
  color: var(--orange-light);
  border: 1px solid rgba(255, 107, 0, 0.25);
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-dash-logout {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-dash-logout:hover {
  background: rgba(229, 57, 53, 0.15);
  color: #ff5252;
  border-color: rgba(229, 57, 53, 0.3);
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
}

.btn-close-modal:hover {
  color: #ffffff;
}

/* Navegação por Abas */
.admin-nav-tabs {
  display: flex;
  background: #0d121e;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 16px;
  gap: 8px;
  overflow-x: auto;
  flex-shrink: 0;
}

.admin-tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 14px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}

.admin-tab-btn:hover {
  color: var(--text-white);
}

.admin-tab-btn.active {
  color: var(--blue-cyan);
  border-bottom-color: var(--blue-electric);
  background: rgba(0, 102, 255, 0.06);
}

/* Corpo das Abas */
.admin-tab-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}

.tab-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 14px;
}

.tab-pane-header h4 {
  font-size: 1.3rem;
}

.tab-pane-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Grid de Promoções no Admin */
.admin-promos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.admin-promo-card {
  background: #090c14;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.admin-promo-card.featured-border {
  border-color: var(--border-orange);
}

.admin-promo-card-img-wrap {
  position: relative;
  background: #0d121c;
  padding: 12px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-promo-thumb {
  max-height: 100px;
  width: auto;
  object-fit: contain;
}

.badge-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}

.badge-tag.hot { background: var(--red-promo); color: #fff; }
.badge-tag.best { background: var(--orange-accent); color: #fff; }
.badge-tag.promo { background: var(--blue-electric); color: #fff; }

.badge-install {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(255, 107, 0, 0.9);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.admin-promo-card-info {
  padding: 14px;
  flex-grow: 1;
}

.brand-sub {
  font-size: 0.74rem;
  color: var(--orange-light);
  font-weight: 700;
  text-transform: uppercase;
}

.admin-promo-card-info h5 {
  font-size: 0.98rem;
  margin: 4px 0 8px;
  line-height: 1.3;
}

.admin-price-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.price-promo {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  font-family: var(--font-heading);
}

.price-old {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-decoration: line-through;
}

.cycle-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.admin-card-actions {
  display: flex;
  border-top: 1px solid var(--border-subtle);
}

.btn-icon-action {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-icon-action:hover {
  background: rgba(0, 102, 255, 0.1);
  color: var(--blue-cyan);
}

.btn-icon-action.btn-danger:hover {
  background: rgba(229, 57, 53, 0.15);
  color: #ff5252;
}

/* Formulário de Edição de Promoção */
.promo-form-wrapper {
  background: #090c14;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 24px;
}

.form-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.82rem;
}

.promo-form-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.checkbox-group {
  margin: 10px 0 16px;
}

.custom-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  cursor: pointer;
}

.custom-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--orange-accent);
}

/* Uploader de Imagem */
.image-uploader-box {
  background: #0f1422;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
}

.uploader-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 14px;
}

.image-preview-area {
  width: 100%;
  height: 180px;
  background: #090c14;
  border: 1px dashed var(--border-blue);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  padding: 10px;
  overflow: hidden;
}

.image-preview-area img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.btn-upload-file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: rgba(0, 102, 255, 0.15);
  border: 1px solid var(--border-blue);
  color: var(--blue-cyan);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-upload-file:hover {
  background: var(--blue-electric);
  color: #ffffff;
}

.upload-status-text {
  display: block;
  font-size: 0.76rem;
  margin-top: 6px;
}

.status-success { color: #2ed573; }
.status-error { color: #ff5252; }

.preset-thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.preset-btn {
  background: #090c14;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.preset-btn:hover {
  border-color: var(--blue-cyan);
}

.preset-btn img {
  height: 44px;
  object-fit: contain;
}

.preset-btn span {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.form-full-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 18px;
}

/* Gestão de Cidades */
.cities-management-box {
  background: #090c14;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 24px;
}

.add-city-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.add-city-bar input {
  flex-grow: 1;
}

.cities-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.city-tag-item {
  background: #0f1422;
  border: 1px solid var(--border-subtle);
  padding: 8px 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}

.city-tag-item button {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.95rem;
}

.city-tag-item button:hover {
  color: #ff5252;
}

/* Configurações e Backup */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.settings-card {
  background: #090c14;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 24px;
}

.settings-card h5 {
  font-size: 1.15rem;
  margin-bottom: 12px;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
}

.backup-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 24px 0;
}

.reset-danger-zone h6 {
  font-size: 0.95rem;
  color: #ff5252;
  margin-bottom: 6px;
}

.reset-danger-zone p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.btn-danger-outline {
  background: none;
  border: 1px solid rgba(229, 57, 53, 0.4);
  color: #ff5252;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger-outline:hover {
  background: rgba(229, 57, 53, 0.15);
}

.feedback-msg {
  font-size: 0.84rem;
  margin-top: 8px;
  display: block;
}

.feedback-msg.success { color: #2ed573; }
.feedback-msg.error { color: #ff5252; }
