/* ============================================
   CALAZANS IMÓVEIS - Admin Panel Stylesheet
   ============================================ */

.admin-body { background: #f0f2f5; font-family: 'Inter', sans-serif; }

/* ============ LOGIN ============ */
.admin-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}
.login-card {
  background: #fff;
  padding: 40px;
  border-radius: var(--radius);
  width: 400px;
  max-width: 90%;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo h1 {
  font-size: 1.4rem;
  color: var(--primary-dark);
  margin-top: 12px;
}
.login-logo p { color: var(--text-light); font-size: 0.9rem; }
.login-error {
  color: #e74c3c;
  font-size: 0.85rem;
  text-align: center;
  margin-top: 12px;
}

/* ============ ADMIN LAYOUT ============ */
.admin-panel {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background: var(--bg-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: var(--transition);
}
.admin-sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-weight: 600;
  font-size: 0.95rem;
}
.admin-nav {
  flex: 1;
  padding: 12px 0;
}
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.6);
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.admin-nav-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.admin-nav-item.active { color: #fff; background: rgba(46,134,193,0.3); border-left: 3px solid var(--primary); }
.admin-sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-sidebar-footer a,
.admin-sidebar-footer button {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.6);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 6px 0;
}
.admin-sidebar-footer a:hover,
.admin-sidebar-footer button:hover { color: #fff; }

/* Main area */
.admin-main {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
}
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.admin-topbar h2 { font-size: 1.2rem; }
.admin-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-light);
}
.admin-user i { font-size: 1.4rem; color: var(--primary); }
.admin-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text);
}

/* Sections */
.admin-section {
  display: none;
  padding: 24px;
}
.admin-section.active { display: block; }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  padding: 24px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}
.stat-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(46,134,193,0.1);
  color: var(--primary);
  font-size: 1.2rem;
}
.stat-card-icon.sale { background: rgba(39,174,96,0.1); color: #27ae60; }
.stat-card-icon.rent { background: rgba(243,156,18,0.1); color: #f39c12; }
.stat-card-icon.managed { background: rgba(142,68,173,0.1); color: #8e44ad; }
.stat-card-icon.contacts { background: rgba(231,76,60,0.1); color: #e74c3c; }
.stat-card-number {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}
.stat-card-label {
  font-size: 0.82rem;
  color: var(--text-light);
}

/* Toolbar */
.section-toolbar {
  margin-bottom: 20px;
  display: flex;
  justify-content: flex-end;
}

/* Table */
.admin-table-wrap {
  background: #fff;
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 12px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:hover td { background: rgba(46,134,193,0.03); }
.admin-table .thumb {
  width: 60px;
  height: 45px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-alt);
}
.admin-table .no-thumb {
  width: 60px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  border-radius: 4px;
  color: var(--text-light);
  font-size: 1.2rem;
}
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-active { background: #d4edda; color: #155724; }
.status-inactive { background: #f8d7da; color: #721c24; }
.status-sold { background: #cce5ff; color: #004085; }
.status-rented { background: #fff3cd; color: #856404; }
.table-actions { display: flex; gap: 6px; }
.table-actions button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-light);
  font-size: 0.85rem;
  transition: var(--transition);
}
.table-actions button:hover { border-color: var(--primary); color: var(--primary); }
.table-actions button.delete:hover { border-color: #e74c3c; color: #e74c3c; }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  padding: 40px 20px;
  overflow-y: auto;
}
.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 800px;
  max-width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.2rem; }
.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  border-radius: 50%;
}
.modal-close:hover { background: var(--bg-alt); color: var(--text); }
.modal-body { padding: 24px; }

/* ============ FORMS ============ */
.form-group {
  margin-bottom: 16px;
  flex: 1;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  transition: var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46,134,193,0.1);
}
.form-row {
  display: flex;
  gap: 16px;
}
.form-row .form-group { margin-bottom: 0; }
.flex-2 { flex: 2 !important; }
.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500 !important;
}
.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

/* ============ IMAGE UPLOAD ============ */
.image-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-light);
  margin-bottom: 20px;
}
.image-upload-area:hover { border-color: var(--primary); color: var(--primary); }
.image-upload-area i { font-size: 2.5rem; margin-bottom: 12px; }
.image-upload-progress { margin-bottom: 20px; }
.progress-bar {
  height: 6px;
  background: var(--bg-alt);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
}
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.image-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 4/3;
  background: var(--bg-alt);
}
.image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-item-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 4px;
}
.image-item-actions button {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  transition: var(--transition);
}
.image-item-actions .cover-btn { background: rgba(255,255,255,0.9); color: var(--text-light); }
.image-item-actions .cover-btn.active { color: var(--accent); }
.image-item-actions .delete-btn { background: rgba(231,76,60,0.9); color: #fff; }
.image-item .cover-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: var(--accent);
  color: var(--primary-dark);
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 700;
}

/* Settings */
.settings-card {
  background: #fff;
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.settings-card h3 {
  font-size: 1.1rem;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-menu-toggle { display: block; }
  .form-row { flex-direction: column; gap: 0; }
  .modal { width: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
