/* Admin Portal Stylesheet - Anakku Group CMS */
:root {
  --admin-deep: #143f30;
  --admin-green: #1b6546;
  --admin-green-light: #248159;
  --admin-accent: #2e8b57;
  --admin-ink: #183b2e;
  --admin-text: #1d2b24;
  --admin-muted: #5e7266;
  --admin-border: #dbe4dc;
  --admin-border-light: #edf2ed;
  --admin-bg: #f5f8f5;
  --admin-card: #ffffff;
  --admin-sidebar: #0f3024;
  --admin-sidebar-hover: #194636;
  --admin-sidebar-active: #1e523f;
  --admin-coral: #c04e33;
  --admin-blue: #2b66a2;
  --admin-purple: #6443a0;
  --admin-gold: #9b620e;
  --admin-shadow: 0 4px 20px rgba(20, 63, 48, 0.07);
  --admin-shadow-lg: 0 12px 35px rgba(20, 63, 48, 0.12);
  --admin-radius: 12px;
}

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

body {
  font-family: "Plus Jakarta Sans", "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--admin-bg);
  color: var(--admin-text);
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* =========================================================
   LOGIN SCREEN
   ========================================================= */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #0e2e22 0%, #164634 50%, #1c5740 100%);
  position: relative;
  overflow: hidden;
}

.login-wrap::before {
  content: "";
  position: absolute;
  top: -20%;
  right: -10%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(62, 175, 124, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  position: relative;
  z-index: 10;
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-logo {
  max-width: 160px;
  height: auto;
  margin: 0 auto 16px;
  display: block;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e8f3ed;
  color: var(--admin-green);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.login-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--admin-deep);
  margin-bottom: 6px;
}

.login-header p {
  color: var(--admin-muted);
  font-size: 13px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-hint {
  margin-top: 24px;
  padding: 14px;
  background: #f7faf7;
  border: 1px dashed #bdd4c1;
  border-radius: 10px;
  font-size: 12px;
  color: #3b5f4c;
}

.login-hint strong {
  display: block;
  margin-bottom: 4px;
  color: var(--admin-deep);
}

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

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background-color: var(--admin-sidebar);
  color: #d1e2d7;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: transform 0.25s ease;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

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

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

.sidebar-brand img {
  height: 32px;
  width: auto;
  filter: brightness(0) invert(1);
}

.sidebar-brand-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8ed6af;
}

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

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #6f9682;
  padding: 12px 10px 6px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: #b7cebf;
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.sidebar-nav-item:hover {
  background-color: var(--admin-sidebar-hover);
  color: #ffffff;
}

.sidebar-nav-item.active {
  background-color: var(--admin-green);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(27, 101, 70, 0.35);
}

.sidebar-nav-item svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  flex-shrink: 0;
}

.sidebar-badge {
  margin-left: auto;
  background: #399c6e;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
}

.sidebar-badge.alert {
  background: #d4593e;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #0b251c;
}

.admin-profile-snippet {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #256348;
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.admin-info {
  flex: 1;
  min-width: 0;
}

.admin-name {
  font-weight: 700;
  font-size: 12.5px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-role {
  font-size: 11px;
  color: #8bb59d;
}

.logout-btn {
  background: transparent;
  border: none;
  color: #a4c4b0;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ff8570;
}

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

/* Top Navbar */
.admin-navbar {
  height: 68px;
  background: #ffffff;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-toggle-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  color: var(--admin-deep);
}

.navbar-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--admin-deep);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.db-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #eaf5ee;
  border: 1px solid #b7dcbf;
  color: #1a6442;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ebd72;
  box-shadow: 0 0 0 2px rgba(46, 189, 114, 0.25);
}

.view-site-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--admin-border);
  color: var(--admin-green);
  font-weight: 700;
  font-size: 12.5px;
  transition: all 0.2s ease;
}

.view-site-btn:hover {
  background: #edf5ed;
  border-color: var(--admin-green);
}

/* Content Area */
.admin-content {
  padding: 30px 28px 60px;
  flex: 1;
}

/* Tab Content Visibility */
.admin-view-panel {
  display: none;
}

.admin-view-panel.active {
  display: block;
}

/* Header Sections */
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 20px;
  flex-wrap: wrap;
}

.panel-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--admin-deep);
  letter-spacing: -0.02em;
}

.panel-subtitle {
  color: var(--admin-muted);
  font-size: 13.5px;
  margin-top: 4px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Metric Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--admin-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--admin-shadow-lg);
}

.metric-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.metric-icon-box.green { background: #eaf5ee; color: var(--admin-green); }
.metric-icon-box.coral { background: #feebe7; color: var(--admin-coral); }
.metric-icon-box.blue { background: #e9f2fa; color: var(--admin-blue); }
.metric-icon-box.purple { background: #f2edf8; color: var(--admin-purple); }
.metric-icon-box.gold { background: #fdf5e7; color: var(--admin-gold); }

.metric-data h4 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--admin-muted);
  margin-bottom: 4px;
}

.metric-data .metric-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--admin-deep);
  line-height: 1.1;
}

/* Card Wrappers */
.admin-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  box-shadow: var(--admin-shadow);
  overflow: hidden;
  margin-bottom: 24px;
}

.admin-card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-card-header h3 {
  font-size: 16px;
  font-weight: 750;
  color: var(--admin-deep);
}

.admin-card-body {
  padding: 22px;
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 13px;
  font-weight: 700;
  color: var(--admin-ink);
}

.form-group .form-help {
  font-size: 11.5px;
  color: var(--admin-muted);
}

.form-control,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--admin-ink);
  font-size: 13.5px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--admin-green);
  box-shadow: 0 0 0 3px rgba(27, 101, 70, 0.15);
}

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

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--admin-green);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--admin-green-light);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  border-color: var(--admin-border);
  color: var(--admin-deep);
}

.btn-secondary:hover {
  background: #edf3ee;
  border-color: #b7cebf;
}

.btn-danger {
  background: #fff3f0;
  border-color: #f7c3ba;
  color: var(--admin-coral);
}

.btn-danger:hover {
  background: #fcdbd5;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn svg {
  width: 15px;
  height: 15px;
  min-width: 15px;
  min-height: 15px;
  stroke-width: 2;
  stroke: currentColor;
  fill: none;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.btn-icon {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 8px !important;
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease;
  line-height: 1;
}

.btn-icon svg {
  width: 15px !important;
  height: 15px !important;
  min-width: 15px !important;
  min-height: 15px !important;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  display: block;
}

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.admin-table th {
  padding: 13px 18px;
  background: #f8faf8;
  color: var(--admin-muted);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--admin-border);
  white-space: nowrap;
}

.admin-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--admin-border-light);
  color: var(--admin-text);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: #f9fbf9;
}

.admin-table-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  justify-content: flex-end;
}

/* Distinct Action Buttons Colors for Table Rows */
/* 1. View / Preview Action (Emerald Green) */
.admin-table-actions .btn-action-view,
.admin-table-actions a.btn-icon {
  background: #ecfdf5 !important;
  border: 1px solid #a7f3d0 !important;
  color: #047857 !important;
}

.admin-table-actions .btn-action-view:hover,
.admin-table-actions a.btn-icon:hover {
  background: #047857 !important;
  border-color: #047857 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(4, 120, 87, 0.25);
}

/* 2. Edit Action (Sky Blue) */
.admin-table-actions .btn-action-edit,
.admin-table-actions button.btn-secondary.btn-icon {
  background: #f0f9ff !important;
  border: 1px solid #bae6fd !important;
  color: #0284c7 !important;
}

.admin-table-actions .btn-action-edit:hover,
.admin-table-actions button.btn-secondary.btn-icon:hover {
  background: #0284c7 !important;
  border-color: #0284c7 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

/* 3. Delete Action (Crimson Red) */
.admin-table-actions .btn-action-delete,
.admin-table-actions .btn-danger.btn-icon {
  background: #fef2f2 !important;
  border: 1px solid #fecaca !important;
  color: #dc2626 !important;
}

.admin-table-actions .btn-action-delete:hover,
.admin-table-actions .btn-danger.btn-icon:hover {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-green { background: #eaf5ee; color: #1a6845; }
.badge-coral { background: #fdeee9; color: #b74427; }
.badge-blue { background: #eaf2fb; color: #215c96; }
.badge-purple { background: #f2eefa; color: #583896; }
.badge-gold { background: #fef6e8; color: #8c570b; }
.badge-gray { background: #edf0ee; color: #5d6e64; }

/* Sub-tabs within Modules */
.sub-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--admin-border);
  margin-bottom: 20px;
  overflow-x: auto;
}

.sub-tab-btn {
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: var(--admin-muted);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
  white-space: nowrap;
}

.sub-tab-btn:hover {
  color: var(--admin-deep);
}

.sub-tab-btn.active {
  color: var(--admin-green);
}

.sub-tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2.5px;
  background: var(--admin-green);
  border-radius: 2px 2px 0 0;
}

/* Search and Filters Bar */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  min-width: 260px;
  flex: 1;
}

.search-input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  stroke: var(--admin-muted);
  pointer-events: none;
}

.search-input-wrap input {
  padding-left: 36px;
}

/* Live Preview Card */
.preview-card-box {
  border: 1px solid #c9dccb;
  background: #f4f8f4;
  border-radius: 14px;
  padding: 24px;
  margin-top: 18px;
}

.preview-quote {
  font-size: 18px;
  font-style: italic;
  color: var(--admin-deep);
  line-height: 1.5;
  margin-bottom: 12px;
}

.preview-author {
  font-weight: 750;
  color: var(--admin-ink);
  font-size: 14px;
}

.preview-role {
  color: var(--admin-muted);
  font-size: 12px;
}

/* Modal Dialog */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 46, 34, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-modal-backdrop.open {
  display: flex;
}

.admin-modal {
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--admin-deep);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--admin-muted);
  font-size: 20px;
  cursor: pointer;
  border-radius: 6px;
  padding: 4px;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: #fbfdfb;
}

/* Image Upload Preview */
.photo-uploader {
  border: 2px dashed #b8cbbb;
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  background: #f8faf8;
  transition: border-color 0.2s;
}

.photo-uploader:hover {
  border-color: var(--admin-green);
  background: #edf5ed;
}

.photo-preview-box {
  width: 90px;
  height: 90px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--admin-border);
  margin: 10px auto 0;
  display: none;
}

.photo-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Toast Notifications */
.admin-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--admin-deep);
  color: #ffffff;
  padding: 14px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }

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

  .admin-main {
    margin-left: 0;
  }

  .mobile-toggle-btn {
    display: flex;
  }
}

@media (max-width: 600px) {
  .admin-content {
    padding: 20px 16px;
  }

  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-navbar {
    padding: 0 16px;
  }

  .db-status-pill span:not(.status-dot) {
    display: none;
  }
}
