/* ==========================================================================
   ZLINK - Poolad Sazeh Ultra-Minimal Project Showcase & Admin Dashboard
   Theme: Matte Charcoal Grey (#222222) with Sticky Modal Close Controls
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;700;800&display=swap');

:root {
  /* Matte Grey Palette (#222222) */
  --bg-dark-grey: #222222;
  --bg-surface-grey: #2a2a2a;
  --border-subtle: rgba(255, 255, 255, 0.1);

  /* Deep Rich Crimson Red */
  --red-primary: #d6001c;
  --red-hover: #b30017;

  /* Typography */
  --text-primary: #f8fafc;
  --text-muted: #b0b0b0;
  --text-dim: #888888;

  --transition-smooth: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  direction: rtl;
  background-color: var(--bg-dark-grey);
  color: var(--text-primary);
  min-height: 100%;
}

/* Body with clearance for bottom buttons & safe area */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 2rem;
  padding-left: 1rem;
  padding-right: 1rem;
  padding-bottom: calc(150px + env(safe-area-inset-bottom, 24px));
  position: relative;
  background-color: var(--bg-dark-grey);
  background-image: radial-gradient(circle at 50% 0%, #2c2c2c 0%, var(--bg-dark-grey) 75%);
  background-attachment: fixed;
}

/* ==========================================================================
   PUBLIC SINGLE PAGE - ULTRA MINIMAL LAYOUT
   ========================================================================== */
.minimal-container {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header layout: Text on the right, Logo centered */
.minimal-header-nav {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 1.75rem;
  padding: 0 0.5rem;
}

.brand-text-right {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  text-align: right;
  letter-spacing: -0.5px;
}

/* COMPANY LOGO */
.company-logo-center {
  width: 92px;
  height: 92px;
  object-fit: contain;
  margin: 0 auto;
  filter: none !important;
  animation: logoEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1) both, logoFloat 3.5s ease-in-out 0.8s infinite alternate;
}

.company-logo-center:hover {
  transform: scale(1.08);
}

@keyframes logoEntrance {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(-15px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes logoFloat {
  0% {
    transform: translateY(0px);
  }
  100% {
    transform: translateY(-5px);
  }
}

.header-empty-left {
  /* Balances grid layout */
}

/* Project Name */
.minimal-project-title {
  width: 100%;
  font-size: 1.3rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 1.2rem;
  text-align: center;
  line-height: 1.4;
}

/* Project Hero Image */
.minimal-image-box {
  width: 100%;
  height: 240px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--bg-surface-grey);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

.minimal-image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Project Description */
.minimal-desc {
  font-size: 0.93rem;
  line-height: 1.8;
  color: var(--text-muted);
  text-align: justify;
  margin-bottom: 1.75rem;
  width: 100%;
  padding: 0 0.25rem;
}

/* ==========================================================================
   REDESIGNED HIGH-END ACTION BUTTONS (Fixed Bottom & Mobile Protected)
   ========================================================================== */
.fixed-bottom-wrapper {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 99999;
  padding-top: 1rem;
  padding-left: 1.2rem;
  padding-right: 1.2rem;
  padding-bottom: max(1.2rem, calc(0.8rem + env(safe-area-inset-bottom, 20px)));
  background: linear-gradient(to top, #222222 85%, rgba(34, 34, 34, 0) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
}

.minimal-buttons-group {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  pointer-events: auto;
  animation: minimalEntrance 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

@keyframes minimalEntrance {
  0% {
    opacity: 0;
    transform: translateY(32px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem;
  border-radius: 12px;
  text-decoration: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-smooth);
}

.btn-primary-insta {
  background: linear-gradient(135deg, #d6001c 0%, #9e0014 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(214, 0, 28, 0.35);
}

.btn-primary-insta:hover {
  background: linear-gradient(135deg, #ea001f 0%, #b30017 100%);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(214, 0, 28, 0.5);
}

.btn-secondary-web {
  background: rgba(38, 44, 56, 0.9);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn-secondary-web:hover {
  background: rgba(48, 55, 70, 0.95);
  border-color: rgba(214, 0, 28, 0.6);
  color: #ffffff;
  transform: translateY(-2px);
}

.btn-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.btn-icon-box svg {
  width: 20px !important;
  height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
  fill: currentColor;
}

.btn-text {
  flex: 1;
  text-align: right;
  padding-right: 0.8rem;
  letter-spacing: -0.2px;
}

.btn-arrow {
  font-size: 1.1rem;
  opacity: 0.7;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.action-btn:hover .btn-arrow {
  opacity: 1;
  transform: translateX(-4px);
}

/* ==========================================================================
   REDESIGNED ADMIN DASHBOARD HEADER BAR (.admin-header-bar)
   ========================================================================== */
.admin-container {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
}

.admin-header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  background: var(--bg-surface-grey);
  border: 1px solid var(--border-subtle);
  padding: 1.25rem 1.5rem;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.admin-header-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 260px;
}

.admin-logo-img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  flex-shrink: 0;
}

.admin-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-main-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.3;
}

.admin-badge {
  background: var(--red-primary);
  color: #ffffff;
  font-size: 0.72rem;
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.admin-sub-title {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-admin-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  background: linear-gradient(135deg, #d6001c 0%, #9e0014 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(214, 0, 28, 0.35);
  transition: all var(--transition-smooth);
  white-space: nowrap;
}

.btn-admin-primary:hover {
  background: linear-gradient(135deg, #ea001f 0%, #b30017 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(214, 0, 28, 0.5);
}

.btn-admin-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-radius: 9px;
  text-decoration: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all var(--transition-smooth);
  white-space: nowrap;
}

.btn-admin-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  transform: translateY(-2px);
}

/* LOCAL FILE UPLOADER STYLING */
.file-upload-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: #181b22;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  text-align: center;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition-smooth);
}

.file-upload-box:hover {
  border-color: var(--red-primary);
}

.btn-file-select {
  padding: 0.65rem 1.2rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.btn-file-select:hover {
  background: var(--red-primary);
  border-color: var(--red-hover);
}

.file-name-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-all;
}

/* ANALYTICS SUMMARY BAR & CARDS */
.analytics-summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-surface-grey);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-left: 4px solid var(--red-primary);
}

.stat-icon {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

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

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.project-admin-card {
  background: var(--bg-surface-grey);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.pac-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pac-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  background: #1a1a1a;
}

.pac-info {
  flex: 1;
}

.pac-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.pac-id {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: monospace;
  direction: ltr;
  text-align: right;
}

.pac-monitoring-box {
  background: rgba(15, 18, 24, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.monitoring-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
}

.monitoring-label {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.monitoring-val {
  font-weight: 700;
  color: var(--text-primary);
}

.pac-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-admin-action {
  flex: 1;
  padding: 0.55rem 0.5rem;
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  box-shadow: none;
}

.btn-qr-gen {
  background: var(--red-primary);
  color: #fff;
}

.btn-qr-gen:hover {
  background: var(--red-hover);
}

.btn-edit {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-edit:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-delete {
  background: rgba(255, 50, 50, 0.18);
  color: #ff6b6b;
}

.btn-delete:hover {
  background: rgba(255, 50, 50, 0.35);
}

/* ==========================================================================
   MODAL DIALOG & STICKY HEADER SCROLLABLE CONTAINER
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  overflow-y: auto;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.admin-modal-box {
  background: var(--bg-surface-grey);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.5rem;
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  margin: auto;
}

.modal-header {
  position: sticky;
  top: -1.5rem;
  background: var(--bg-surface-grey);
  z-index: 20;
  padding-top: 0.5rem;
  padding-bottom: 0.8rem;
  margin-top: -0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.close-modal-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  transition: all var(--transition-smooth);
}

.close-modal-btn:hover {
  background: var(--red-primary);
  border-color: var(--red-hover);
  transform: scale(1.1);
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.form-input, .form-textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  background: #1a1a1a;
  border: 1px solid var(--border-subtle);
  color: #fff;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--red-primary);
}

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

.qr-display-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem;
  background: #ffffff;
  border-radius: 12px;
  border: 3px solid var(--red-primary);
  margin: 1rem 0;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-surface-grey);
  border: 1px solid var(--red-primary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 30px;
  font-size: 0.88rem;
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Mobile responsive adjustments */
@media (max-width: 600px) {
  .admin-header-bar {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.1rem;
  }

  .admin-header-actions {
    width: 100%;
  }

  .btn-admin-primary, .btn-admin-secondary {
    flex: 1;
    justify-content: center;
  }

  .admin-modal-box {
    max-height: 90vh;
    padding: 1.2rem;
  }
}
