/**
 * Painel Administrativo — Samilly Lash Studio
 * Estilos UX/UI Premium, Responsivos e Otimizados para Celular e Desktop
 */

:root {
  --admin-gold: #C99A3D;
  --admin-gold-light: #E0B970;
  --admin-gold-dark: #8C5A20;
  --admin-bg: #F7EFE7;
  --admin-surface: #FFFFFF;
  --admin-card-bg: #FFFFFF;
  --admin-border: rgba(201, 154, 61, 0.25);
  --admin-border-strong: rgba(201, 154, 61, 0.5);
  --admin-text: #241B16;
  --admin-text-muted: #6B5546;
  --admin-text-title: #3A2312;
  --admin-success: #1E824C;
  --admin-warning: #D9822B;
  --admin-danger: #C0392B;
  --font-title: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow-sm: 0 2px 8px rgba(74, 44, 26, 0.05);
  --shadow-md: 0 8px 24px rgba(74, 44, 26, 0.08);
  --shadow-lg: 0 16px 40px rgba(74, 44, 26, 0.12);
  --transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.admin-body {
  font-family: var(--font-body);
  background-color: var(--admin-bg);
  color: var(--admin-text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ==========================================================================
   TELA DE LOGIN
   ========================================================================== */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: radial-gradient(circle at 50% 20%, #FFFBF5 0%, #F5EAE0 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--admin-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--admin-border);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  text-align: center;
}

.brand-monogram {
  width: 54px;
  height: 54px;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--admin-gold-light), var(--admin-gold-dark));
  color: #fff;
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(201, 154, 61, 0.35);
}

.brand-monogram.sm {
  width: 38px;
  height: 38px;
  font-size: 1.15rem;
}

.brand-title {
  font-family: var(--font-title);
  font-size: 1.55rem;
  letter-spacing: 0.12em;
  color: var(--admin-text-title);
  margin-bottom: 2px;
}

.brand-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--admin-gold-dark);
}

.login-intro {
  margin: 1.5rem 0 1.25rem;
}

.login-intro h2 {
  font-family: var(--font-title);
  font-size: 1.35rem;
  color: var(--admin-text-title);
  margin-bottom: 4px;
}

.login-intro p {
  font-size: 0.85rem;
  color: var(--admin-text-muted);
}

.login-alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  text-align: left;
}

.login-alert.error {
  background: #FDEDEC;
  color: #C0392B;
  border: 1px solid #FADBD8;
}

.login-alert.success {
  background: #EAFAF1;
  color: #1E824C;
  border: 1px solid #D5F5E3;
}

.login-footer {
  margin-top: 1.5rem;
  font-size: 0.85rem;
}

.back-to-site-link {
  color: var(--admin-gold-dark);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}

.back-to-site-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: 260px;
  background: #2F1B10;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  transition: transform var(--transition);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

@media (max-width: 991px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }
}

.sidebar-header {
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  line-height: 1.1;
}

.sidebar-sub {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--admin-gold-light);
}

.sidebar-close-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.25rem;
  cursor: pointer;
  display: none;
}

@media (max-width: 991px) {
  .sidebar-close-btn {
    display: block;
  }
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
}

.nav-item:hover {
  background: rgba(201, 154, 61, 0.15);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(135deg, var(--admin-gold-light), var(--admin-gold));
  color: #2F1B10;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(201, 154, 61, 0.35);
}

.badge-count {
  margin-left: auto;
  background: #E74C3C;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-btn-site {
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--admin-gold-light);
  padding: 0.6rem;
  text-align: center;
  border-radius: var(--radius-sm);
  background: rgba(201, 154, 61, 0.12);
  transition: all var(--transition);
}

.sidebar-btn-site:hover {
  background: var(--admin-gold);
  color: #2F1B10;
}

.sidebar-btn-logout {
  width: 100%;
  padding: 0.6rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
}

.sidebar-btn-logout:hover {
  background: #C0392B;
  border-color: #C0392B;
  color: #fff;
}

/* App Main */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: 260px;
}

@media (max-width: 991px) {
  .app-main {
    margin-left: 0;
  }
}

.app-topbar {
  height: 64px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-menu-toggle {
  background: transparent;
  border: none;
  color: var(--admin-text-title);
  cursor: pointer;
  display: none;
  padding: 6px;
}

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

.topbar-page-title {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--admin-text-title);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--admin-gold-light), var(--admin-gold-dark));
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(201, 154, 61, 0.3);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--admin-text-title);
  line-height: 1.1;
}

.user-role {
  font-size: 0.72rem;
  color: var(--admin-text-muted);
}

/* App Content */
.app-content {
  padding: 1.5rem;
  flex: 1;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   COMPONENTES UI & CARDS
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--admin-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--admin-border);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon.gold { background: rgba(201, 154, 61, 0.15); color: var(--admin-gold-dark); }
.kpi-icon.orange { background: rgba(230, 126, 34, 0.15); color: #D35400; }
.kpi-icon.green { background: rgba(39, 174, 96, 0.15); color: #27AE60; }
.kpi-icon.brown { background: rgba(74, 44, 26, 0.15); color: #4A2C1A; }

.kpi-info {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-family: var(--font-title);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--admin-text-title);
  line-height: 1.2;
}

.panel-card {
  background: var(--admin-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--admin-border);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--admin-border);
}

.panel-card-header h2,
.panel-card-header h3 {
  font-family: var(--font-title);
  color: var(--admin-text-title);
  margin: 0;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.panel-subtitle {
  font-size: 0.88rem;
  color: var(--admin-text-muted);
  margin-top: 2px;
}

/* Tabelas Responsivas */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}

.data-table th {
  background: #FBF6EF;
  color: var(--admin-text-title);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--admin-border);
}

.data-table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid rgba(201, 154, 61, 0.12);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: #FFFDFB;
}

/* Badges de Status */
.status-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.status-badge.solicitado { background: #FEF5E7; color: #D35400; border: 1px solid #FAD7A0; }
.status-badge.confirmado { background: #EAFAF1; color: #27AE60; border: 1px solid #A9DFBF; }
.status-badge.concluido { background: #EBF5FB; color: #2980B9; border: 1px solid #AED6F1; }
.status-badge.cancelado { background: #FDEDEC; color: #C0392B; border: 1px solid #F5B7B1; }

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-gold {
  background: linear-gradient(135deg, var(--admin-gold-light), var(--admin-gold));
  color: #2F1B10;
  border-color: var(--admin-gold);
  box-shadow: 0 4px 12px rgba(201, 154, 61, 0.3);
}

.btn-gold:hover {
  background: linear-gradient(135deg, #E6C280, var(--admin-gold-light));
  transform: translateY(-1px);
}

.btn-secondary {
  background: #FFFFFF;
  color: var(--admin-text);
  border-color: var(--admin-border-strong);
}

.btn-outline {
  background: transparent;
  color: var(--admin-gold-dark);
  border-color: var(--admin-border-strong);
}

.btn-outline:hover {
  background: rgba(201, 154, 61, 0.1);
}

.btn-block {
  width: 100%;
}

.btn-wa-action {
  background: #25D366;
  color: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.btn-wa-action:hover {
  background: #1EBE5D;
}

/* Formulários */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 1rem;
  text-align: left;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--admin-text-title);
}

.form-control {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--admin-border-strong);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  color: var(--admin-text);
  transition: border-color var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--admin-gold);
  box-shadow: 0 0 0 3px rgba(201, 154, 61, 0.15);
}

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

.form-group-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 1rem 0;
}

/* Grid de Serviços */
.services-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.service-admin-card {
  background: var(--admin-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--admin-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.service-card-cover {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: #F3E5D3;
}

.service-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.service-card-body h4 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  color: var(--admin-text-title);
  margin-bottom: 4px;
}

.service-card-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.5rem 0 1rem;
}

.service-card-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--admin-gold-dark);
}

.service-card-duration {
  font-size: 0.82rem;
  color: var(--admin-text-muted);
}

.service-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* Upload Dropzone R2 */
.upload-dropzone {
  border: 2px dashed var(--admin-border-strong);
  border-radius: var(--radius-md);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: #FAF5EE;
  cursor: pointer;
  transition: all var(--transition);
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--admin-gold);
  background: #FFFDFB;
}

.upload-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--admin-text-title);
  margin: 0.75rem 0 0.25rem;
}

.upload-sub {
  font-size: 0.82rem;
  color: var(--admin-text-muted);
  margin-bottom: 1rem;
}

.r2-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1rem;
}

.r2-media-item {
  position: relative;
  aspect-ratio: 1/1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--admin-border);
  box-shadow: var(--shadow-sm);
}

.r2-media-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.r2-media-copy-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(47, 27, 16, 0.85);
  color: #fff;
  border: none;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}

/* Modais */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(47, 27, 16, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--admin-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--admin-border);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--admin-border);
}

.modal-header h3 {
  font-family: var(--font-title);
  font-size: 1.35rem;
  color: var(--admin-text-title);
  margin: 0;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: var(--admin-text-muted);
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--admin-border);
}
