/* ===== LAYOUT PRINCIPAL DO PAINEL - VERSÃO RESPONSIVA ===== */
* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

:root {
  /* Espaçamentos responsivos para admin */
  --admin-spacing-xs: clamp(0.25rem, 1vw, 0.5rem);
  --admin-spacing-sm: clamp(0.5rem, 2vw, 1rem);
  --admin-spacing-md: clamp(1rem, 2.5vw, 1.5rem);
  --admin-spacing-lg: clamp(1.5rem, 3vw, 2rem);
  
  /* Tipografia fluida para admin */
  --admin-font-sm: clamp(0.8rem, 1.5vw, 0.9rem);
  --admin-font-base: clamp(0.9rem, 2vw, 1rem);
  --admin-font-lg: clamp(1rem, 2.5vw, 1.2rem);
  --admin-font-xl: clamp(1.2rem, 3vw, 1.5rem);
  --admin-font-2xl: clamp(1.5rem, 4vw, 2rem);
}

.admin-body {
  font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
  background: #f5f7fa;
  color: #333;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
}

.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.admin-sidebar {
  width: clamp(220px, 25vw, 260px);
  background: linear-gradient(180deg, #2b2730 0%, #1a1820 100%);
  color: #fff;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  transition: transform 0.3s ease;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .admin-sidebar {
    width: min(280px, 80vw);
    transform: translateX(-100%);
  }
  
  .admin-sidebar.active {
    transform: translateX(0);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);
  }
}

.sidebar-header {
  padding: clamp(1rem, 3vw, 1.5rem) clamp(1rem, 2.5vw, 1.25rem);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1rem);
  flex-wrap: wrap;
}

.sidebar-header img {
  width: clamp(36px, 6vw, 40px);
  height: clamp(36px, 6vw, 40px);
  border-radius: 8px;
  flex-shrink: 0;
}

.sidebar-header h2 {
  font-size: clamp(1rem, 2.2vw, 1.1rem);
  font-weight: 600;
  color: #FFD300;
  line-height: 1.3;
}

.sidebar-nav {
  padding: 20px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #ddd;
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: #FFD300;
  border-left-color: #FFD300;
}

.nav-item.active {
  background: rgba(255,211,0,0.1);
  color: #FFD300;
  border-left-color: #FFD300;
  font-weight: 600;
}

.nav-item i {
  width: 20px;
  text-align: center;
}

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 16px 20px;
}

.nav-item.logout {
  color: #ff6b6b;
}

.nav-item.logout:hover {
  background: rgba(255,107,107,0.1);
  border-left-color: #ff6b6b;
}

/* ===== CONTEÚDO PRINCIPAL ===== */
.admin-content {
  flex: 1;
  margin-left: clamp(220px, 25vw, 260px);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

@media (max-width: 768px) {
  .admin-content {
    margin-left: 0;
    width: 100%;
  }
}

.admin-topbar {
  background: #fff;
  padding: clamp(0.75rem, 2vw, 1rem) clamp(1rem, 3vw, 1.5rem);
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 1rem;
  flex-wrap: wrap;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  cursor: pointer;
  color: #333;
  padding: 0.5rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: block;
  }
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 1.5vw, 0.75rem);
  color: #666;
  font-size: var(--admin-font-sm);
  flex-wrap: wrap;
}

.topbar-user i {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  color: #ae9031;
}

.admin-main {
  padding: var(--admin-spacing-md);
  flex: 1;
}

/* ===== PAGE HEADER ===== */
.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 1.8rem;
  color: #2b2730;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-header h1 i {
  color: #ae9031;
}

.page-header p {
  color: #666;
  font-size: 1rem;
}

/* ===== DASHBOARD ===== */
.dashboard-header {
  margin-bottom: 32px;
}

.dashboard-header h1 {
  font-size: 2rem;
  color: #2b2730;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-header p {
  color: #666;
  font-size: 1.05rem;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: clamp(1rem, 2.5vw, 1.25rem);
  margin-bottom: clamp(1.5rem, 4vw, 2rem);
}

@media (max-width: 600px) {
  .dashboard-stats {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
}

.stat-icon.church { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-icon.events { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.stat-icon.doctrine { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.stat-icon.contact { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }

.stat-info h3 {
  font-size: 2rem;
  color: #2b2730;
  font-weight: 700;
}

.stat-info p {
  color: #666;
  font-size: 0.95rem;
}

.stat-link {
  color: #ae9031;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.2s;
}

.stat-link:hover {
  gap: 10px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr));
  gap: clamp(1rem, 3vw, 1.5rem);
  margin-bottom: clamp(1.5rem, 4vw, 2rem);
}

@media (max-width: 600px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.dashboard-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
}

.card-header {
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h2 {
  font-size: 1.2rem;
  color: #2b2730;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-edit {
  background: #ae9031;
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-edit:hover {
  background: #FFD300;
  color: #2b2730;
}

.card-body {
  padding: 20px;
}

.recent-list {
  list-style: none;
}

.recent-list li {
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recent-list li:last-child {
  border-bottom: none;
}

.recent-list i {
  color: #ae9031;
  margin-right: 8px;
}

.recent-list strong {
  color: #2b2730;
}

.recent-list span {
  color: #666;
  font-size: 0.9rem;
  margin-left: 28px;
}

.empty-state {
  text-align: center;
  color: #999;
  padding: 20px;
}

.dashboard-actions {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.dashboard-actions h2 {
  font-size: 1.3rem;
  color: #2b2730;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: clamp(0.75rem, 2vw, 1rem);
}

@media (max-width: 500px) {
  .action-buttons {
    grid-template-columns: 1fr;
  }
}

.action-btn {
  padding: 16px 20px;
  border-radius: 8px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  transition: all 0.2s;
  color: #fff;
}

.action-btn i {
  font-size: 1.3rem;
}

.action-btn.primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.action-btn.success { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.action-btn.info { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.action-btn.secondary { background: linear-gradient(135deg, #757f9a 0%, #d7dde8 100%); color: #333; }

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ===== FORMULÁRIOS E CONTEÚDO ===== */
.painel-main {
  max-width: 100%;
  background: #fff;
  border-radius: clamp(8px, 2vw, 12px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: clamp(1rem, 3vw, 2rem);
}

.painel-main h2 {
  color: #2b2730;
  font-size: var(--admin-font-xl);
  margin-bottom: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 600;
  word-wrap: break-word;
}

.painel-main form {
  background: #f9f9f9;
  padding: clamp(1rem, 3vw, 1.5rem);
  border-radius: clamp(8px, 2vw, 12px);
  margin-bottom: clamp(1.5rem, 4vw, 2rem);
  max-width: min(600px, 100%);
}

.form-wide {
  max-width: 100% !important;
}

.painel-main label {
  color: #555;
  font-weight: 600;
  margin-top: 16px;
  display: block;
  font-size: 0.95rem;
}

.painel-main input[type=text],
.painel-main input[type=date],
.painel-main input[type=time],
.painel-main input[type=file],
.painel-main textarea,
.painel-main select {
  width: 100%;
  padding: clamp(0.75rem, 2vw, 1rem);
  border-radius: 8px;
  border: 1.5px solid #ddd;
  background: #fff;
  margin-top: clamp(0.375rem, 1vw, 0.5rem);
  font-size: var(--admin-font-base);
  transition: border .2s, box-shadow .2s;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

.painel-main input[type=text]:focus,
.painel-main input[type=date]:focus,
.painel-main input[type=time]:focus,
.painel-main textarea:focus {
  border-color: #ae9031;
  box-shadow: 0 0 0 3px rgba(174,144,49,0.1);
  outline: none;
}

.painel-main textarea {
  min-height: 100px;
  resize: vertical;
}

.painel-main .input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.painel-main .input-group input[type=text] {
  flex: 1;
}

.painel-main input[type=submit],
.painel-main button {
  background: linear-gradient(135deg, #ae9031 0%, #FFD300 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 20px;
  transition: all 0.2s;
}

.painel-main input[type=submit]:hover,
.painel-main button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(174,144,49,0.3);
}

.painel-main a {
  color: #be2222;
  text-decoration: underline;
}

.painel-main .msg {
  color: #059e33;
  background: #e2f9e1;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 600;
  border-left: 4px solid #059e33;
}

.form-help {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: #e3f2fd;
  border-radius: 8px;
  color: #1976d2;
  font-size: 0.9rem;
  margin-top: 12px;
}

/* ===== LISTAS DE ITENS ===== */
.list-igrejas {
  margin-top: 24px;
}

.igreja-item {
  background: #f9f9f9;
  border-radius: 10px;
  margin-bottom: 16px;
  padding: 16px;
  border-left: 4px solid #ae9031;
  transition: all 0.2s;
}

.igreja-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transform: translateX(4px);
}

.igreja-item strong {
  color: #2b2730;
  font-size: 1.1rem;
  display: block;
  margin-bottom: 8px;
}

.igreja-item .info {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #555;
  margin: 4px 0;
}

.igreja-item .info a {
  color: #2b6cb0;
  text-decoration: underline;
}

.igreja-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.igreja-actions input[type=submit],
.igreja-actions button {
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  color: #fff;
}

.igreja-actions .edit {
  background: #028cc8;
}

.igreja-actions .edit:hover {
  background: #30bbf4;
}

.igreja-actions .remove {
  background: #be2222;
}

.igreja-actions .remove:hover {
  background: #f73a3a;
}

/* ===== ÍCONES ===== */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff3bf;
  margin-right: 8px;
  font-size: 13px;
  color: #ae9031;
}

.fa-facebook { color: #1877f2; }
.fa-instagram { color: #e4405f; }
.fa-globe { color: #2b6cb0; }
.fa-phone { color: #059e33; }

/* ===== PREVIEW SECTIONS ===== */
.preview-section {
  margin-top: 40px;
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  border: 2px solid #f0f0f0;
}

.preview-section h2 {
  color: #2b2730;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
}

.preview-box {
  padding: 20px;
  background: #f9f9f9;
  border-radius: 8px;
  border-left: 4px solid #ae9031;
  line-height: 1.7;
  color: #333;
}

.doutrina-item-edit {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  border: 2px solid #f0f0f0;
}

.doutrina-item-edit h3 {
  color: #ae9031;
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.doutrina-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.doutrina-preview-card {
  text-align: center;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 8px;
}

.doutrina-preview-card i {
  font-size: 2.5rem;
  color: #ae9031;
  margin-bottom: 12px;
}

.doutrina-preview-card h4 {
  color: #2b2730;
  margin-bottom: 8px;
  font-size: 1rem;
}

.doutrina-preview-card p {
  color: #666;
  font-size: 0.9rem;
  line-height: 1.5;
}

.contacto-preview {
  display: grid;
  gap: 20px;
}

.contacto-preview-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: #f9f9f9;
  border-radius: 8px;
}

.contacto-preview-item i {
  font-size: 2rem;
  color: #ae9031;
  min-width: 40px;
}

.contacto-preview-item h4 {
  color: #2b2730;
  margin-bottom: 4px;
}

.contacto-preview-item p {
  color: #666;
  font-size: 0.95rem;
}

/* ===== UPLOAD DE IMAGEM ELEGANTE ===== */
.image-upload-container {
  position: relative;
  margin-top: 12px;
}

.image-upload-wrapper {
  position: relative;
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  background: #fafafa;
  transition: all 0.3s;
  cursor: pointer;
}

.image-upload-wrapper:hover {
  border-color: #ae9031;
  background: #fff9e6;
}

.image-upload-wrapper.dragover {
  border-color: #ae9031;
  background: #fff9e6;
  box-shadow: 0 0 0 4px rgba(174,144,49,0.1);
}

.image-upload-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  cursor: pointer;
  z-index: 2;
}

.image-upload-content {
  position: relative;
  z-index: 1;
}

.image-upload-icon {
  font-size: 3rem;
  color: #ae9031;
  margin-bottom: 12px;
}

.image-upload-text {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.image-upload-hint {
  color: #999;
  font-size: 0.85rem;
}

.image-preview-container {
  margin-top: 16px;
  position: relative;
}

.image-preview-box {
  position: relative;
  display: inline-block;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 2px solid #e5e7eb;
}

.image-preview-box img {
  display: block;
  max-width: 300px;
  max-height: 300px;
  width: auto;
  height: auto;
  object-fit: cover;
}

.image-preview-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(190, 34, 34, 0.9);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
  z-index: 3;
}

.image-preview-remove:hover {
  background: #be2222;
  transform: scale(1.1);
}

.image-current-label {
  color: #666;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}

.image-current-box {
  display: inline-block;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 2px solid #e5e7eb;
  margin-top: 8px;
}

.image-current-box img {
  display: block;
  max-width: 300px;
  max-height: 300px;
  width: auto;
  height: auto;
  object-fit: cover;
}

.image-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e2f9e1;
  color: #059e33;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 12px;
}

/* ===== IMAGEM NA LISTA DE ITENS ===== */
.igreja-item-image,
.evento-item-image {
  width: 100%;
  max-width: 200px;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  margin: 12px 0;
  border: 2px solid #e5e7eb;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.igreja-item-image-container,
.evento-item-image-container {
  margin: 12px 0;
}

/* ===== RESPONSIVIDADE OTIMIZADA ===== */

/* Overlay para fechar sidebar em mobile */
@media (max-width: 768px) {
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }
  
  .admin-sidebar {
    z-index: 1001;
  }
}

/* Tablet */
@media (max-width: 1024px) and (min-width: 769px) {
  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile grande */
@media (max-width: 768px) {
  .page-header h1,
  .dashboard-header h1 {
    font-size: var(--admin-font-xl);
  }
  
  .stat-card {
    padding: clamp(1rem, 3vw, 1.25rem);
  }
  
  .card-header,
  .card-body {
    padding: clamp(0.75rem, 2.5vw, 1rem);
  }
}

/* Mobile médio */
@media (max-width: 480px) {
  .admin-topbar {
    padding: 0.75rem 1rem;
  }
  
  .admin-main {
    padding: 1rem;
  }
  
  .painel-main {
    padding: 1rem;
  }
  
  .painel-main form {
    padding: 1rem;
  }
  
  .topbar-user {
    font-size: 0.85rem;
  }
  
  .filter-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .igreja-actions {
    flex-direction: column;
  }
  
  .igreja-actions input[type=submit],
  .igreja-actions button {
    width: 100%;
  }
}

/* Mobile pequeno */
@media (max-width: 360px) {
  .admin-topbar {
    padding: 0.5rem 0.75rem;
  }
  
  .admin-main {
    padding: 0.75rem;
  }
  
  .sidebar-header {
    padding: 0.75rem;
  }
  
  .nav-item {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
}

/* Otimizações para paisagem em tablets */
@media (min-width: 768px) and (max-height: 600px) and (orientation: landscape) {
  .admin-sidebar {
    width: 200px;
  }
  
  .admin-content {
    margin-left: 200px;
  }
  
  .sidebar-header {
    padding: 0.75rem 1rem;
  }
  
  .sidebar-header h2 {
    font-size: 0.95rem;
  }
}

/* Melhorias para toque */
@media (hover: none) and (pointer: coarse) {
  .nav-item,
  .filter-btn,
  .action-btn,
  button,
  input[type="submit"] {
    min-height: 44px;
    min-width: 44px;
  }
  
  .mobile-menu-toggle {
    min-width: 44px;
    min-height: 44px;
  }
}

/* Overlay para fechar sidebar em mobile - Implementação completa */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Suporte para notch do iPhone (iOS) no admin */
@supports (padding-top: env(safe-area-inset-top)) {
  .admin-body {
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  .admin-topbar {
    padding-left: max(env(safe-area-inset-left), 1rem);
    padding-right: max(env(safe-area-inset-right), 1rem);
  }
}

/* Otimizações para telas ultra pequenas (Galaxy Fold, etc) */
@media (max-width: 320px) {
  :root {
    --admin-font-sm: 0.75rem;
    --admin-font-base: 0.85rem;
    --admin-font-lg: 0.95rem;
    --admin-font-xl: 1.1rem;
  }
  
  .sidebar-header img {
    width: 32px;
    height: 32px;
  }
  
  .sidebar-header h2 {
    font-size: 0.9rem;
  }
  
  .nav-item {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
  }
  
  .stat-card {
    padding: 0.75rem;
  }
  
  .stat-info h3 {
    font-size: 1.5rem;
  }
}

/* Melhorias para tablets em modo paisagem */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
  .admin-sidebar {
    width: 220px;
  }
  
  .admin-content {
    margin-left: 220px;
  }
  
  .dashboard-stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Otimizações para animações em dispositivos com movimento reduzido */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Melhorias para impressão no admin */
@media print {
  .admin-sidebar,
  .admin-topbar,
  .mobile-menu-toggle,
  .sidebar-overlay,
  button,
  .action-buttons,
  .stat-link {
    display: none !important;
  }
  
  .admin-content {
    margin-left: 0;
  }
  
  .admin-body {
    background: white;
  }
  
  .painel-main,
  .dashboard-card,
  .stat-card {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
}

/* Scrollbar personalizada para navegadores webkit */
.admin-sidebar::-webkit-scrollbar {
  width: 6px;
}

.admin-sidebar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.admin-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 211, 0, 0.3);
  border-radius: 3px;
}

.admin-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 211, 0, 0.5);
}

/* Otimizações para performance mobile */
@media (max-width: 768px) {
  * {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }
  
  img {
    -webkit-user-drag: none;
    user-drag: none;
  }
  
  .admin-sidebar {
    will-change: transform;
  }
  
  .sidebar-overlay {
    will-change: opacity;
  }
}

/* Fix para Firefox mobile */
@-moz-document url-prefix() {
  .admin-sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 211, 0, 0.3) rgba(255, 255, 255, 0.05);
  }
}

/* Melhorias para tablets maiores (iPad Pro, etc) */
@media (min-width: 1024px) and (max-width: 1366px) {
  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}
