/**
 * Deceased Finder - Frontend Stylesheet
 * Strictly matching clean light UI specifications
 *
 * @package Deceased_Finder
 */

/* Design Tokens */
:root {
  --df-bg-wrapper: #ffffff;
  --df-tab-active: #6d5218;
  --df-tab-active-hover: #594212;
  --df-tab-inactive: #eef3fa;
  --df-tab-inactive-hover: #e2eaf5;
  --df-text-dark: #1e293b;
  --df-text-muted: #64748b;
  --df-badge-live: #b91c1c;
  --df-input-bg: #f2f5fb;
  --df-input-focus: #3b82f6;
  --df-btn-black: #0f172a;
  --df-btn-black-hover: #000000;
  --df-card-border: #e2e8f0;
  --df-radius-wrapper: 20px;
  --df-radius-field: 14px;
  --df-font: inherit, 'iranyekan', 'IRANYekan', 'IRANYekanX', 'iranyekanweb', 'IRANSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Tahoma, sans-serif;
  --df-transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Scoped Wrapper */
.df-root-wrapper {
  font-family: var(--df-font);
  direction: rtl;
  text-align: right;
  background: var(--df-bg-wrapper);
  border: 1px solid var(--df-card-border);
  border-radius: var(--df-radius-wrapper);
  padding: 24px;
  margin: 24px auto;
  max-width: 1140px;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
  color: var(--df-text-dark);
  line-height: 1.6;
}

.df-root-wrapper *,
.df-modal-overlay * {
  box-sizing: border-box;
  font-family: var(--df-font);
}

/* ==========================================================================
   Navigation Tabs
   ========================================================================== */
.df-root-wrapper .df-tabs-header {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.df-root-wrapper .df-tab-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: var(--df-radius-field);
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: var(--df-tab-inactive);
  color: var(--df-text-dark);
  transition: var(--df-transition);
  user-select: none;
}

.df-root-wrapper .df-tab-item:hover {
  background: var(--df-tab-inactive-hover);
}

/* Tab 1: Active Golden-Brown / Olive */
.df-root-wrapper .df-tab-item.active {
  background: var(--df-tab-active);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(109, 82, 24, 0.25);
}

.df-root-wrapper .df-tab-item.active:hover {
  background: var(--df-tab-active-hover);
}

.df-root-wrapper .df-tab-icon {
  font-size: 1.15rem;
}

/* Tab 2: Live Badge ("زنده") */
.df-root-wrapper .df-badge-live {
  background: var(--df-badge-live);
  color: #ffffff;
  padding: 3px 10px;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: -0.2px;
  display: inline-flex;
  align-items: center;
  position: relative;
  box-shadow: 0 2px 6px rgba(185, 28, 28, 0.3);
}

.df-root-wrapper .df-badge-live::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #ffffff;
  border-radius: 50%;
  margin-right: 5px;
  animation: dfPulseLive 1.5s infinite;
}

@keyframes dfPulseLive {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* ==========================================================================
   Search Form Surface & Fields
   ========================================================================== */
.df-root-wrapper .df-card-surface {
  background: #ffffff;
}

.df-root-wrapper .df-search-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 14px;
  align-items: flex-end;
}

.df-root-wrapper .df-input-box {
  display: flex;
  flex-direction: column;
}

.df-root-wrapper .df-input-box label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--df-text-dark);
  margin-bottom: 6px;
  user-select: none;
}

.df-root-wrapper .df-field-inner {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--df-input-bg);
  border: 1px solid transparent;
  border-radius: var(--df-radius-field);
  padding: 0 14px 0 14px;
  padding-inline-start: 40px;
  padding-inline-end: 14px;
  height: 52px;
  transition: var(--df-transition);
}

.df-root-wrapper .df-field-inner:focus-within {
  background: #ffffff;
  border-color: var(--df-tab-active);
  box-shadow: 0 0 0 3px rgba(109, 82, 24, 0.15);
}

.df-root-wrapper .df-field-inner .df-input-icon {
  position: absolute;
  right: 14px;
  inset-inline-start: 14px;
  inset-inline-end: auto;
  color: var(--df-text-muted);
  font-size: 1.1rem;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.df-root-wrapper .df-field-inner input,
.df-root-wrapper .df-field-inner input[type="text"] {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--df-text-dark);
  padding: 0;
  margin: 0;
  box-shadow: none;
  line-height: normal;
}

.df-root-wrapper .df-field-inner input::placeholder {
  color: #94a3b8;
  font-size: 0.88rem;
}

/* Submit Button: Pitch Black with Rounded Corners */
.df-root-wrapper .df-btn-box {
  display: flex;
}

.df-root-wrapper .df-btn-submit {
  height: 52px;
  padding: 0 28px;
  background: var(--df-btn-black);
  color: #ffffff;
  border: none;
  border-radius: var(--df-radius-field);
  font-size: 0.96rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: var(--df-transition);
  white-space: nowrap;
}

.df-root-wrapper .df-btn-submit:hover {
  background: var(--df-btn-black-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.df-root-wrapper .df-btn-submit:active {
  transform: translateY(0);
}

.df-root-wrapper .df-btn-icon {
  font-size: 1.15rem;
}

/* ==========================================================================
   Results & Feedback Containers
   ========================================================================== */
.df-root-wrapper .df-results-wrapper {
  margin-top: 24px;
}

.df-root-wrapper .df-message-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--df-radius-field);
  margin-top: 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 0.92rem;
  color: var(--df-text-dark);
}

.df-root-wrapper .df-message-card.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.df-root-wrapper .df-message-card.info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.df-root-wrapper .df-message-icon {
  font-size: 1.4rem;
}

/* ==========================================================================
   Skeleton Shimmer Loading
   ========================================================================== */
.df-root-wrapper .df-skeleton-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.df-root-wrapper .df-skeleton-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--df-radius-field);
  padding: 20px;
}

.df-root-wrapper .df-skeleton-line {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: dfShimmer 1.4s infinite;
  border-radius: 8px;
  margin-bottom: 12px;
}

.df-root-wrapper .df-skeleton-line.title {
  height: 20px;
  width: 65%;
}

.df-root-wrapper .df-skeleton-line.subtitle {
  height: 14px;
  width: 45%;
}

.df-root-wrapper .df-skeleton-line.btn {
  height: 42px;
  width: 100%;
  margin-top: 14px;
  margin-bottom: 0;
}

.df-root-wrapper .df-skeleton-pills {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.df-root-wrapper .df-skeleton-pill {
  flex: 1;
  height: 38px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: dfShimmer 1.4s infinite;
  border-radius: 8px;
}

@keyframes dfShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==========================================================================
   Deceased Cards Grid
   ========================================================================== */
.df-root-wrapper .df-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.df-root-wrapper .df-result-card {
  background: #ffffff;
  border: 1px solid var(--df-card-border);
  border-radius: var(--df-radius-field);
  padding: 20px;
  transition: var(--df-transition);
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.df-root-wrapper .df-result-card:hover {
  transform: translateY(-3px);
  border-color: #cbd5e1;
  box-shadow: 0 12px 24px -5px rgba(0, 0, 0, 0.08);
}

.df-root-wrapper .df-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.df-root-wrapper .df-card-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--df-text-muted);
}

.df-root-wrapper .df-card-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--df-text-dark);
  margin: 0 0 3px;
}

.df-root-wrapper .df-card-meta {
  font-size: 0.85rem;
  color: var(--df-text-muted);
}

/* Grave Coordinates Badges Box */
.df-root-wrapper .df-coord-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 16px;
  text-align: center;
}

.df-root-wrapper .df-coord-col {
  display: flex;
  flex-direction: column;
}

.df-root-wrapper .df-coord-label {
  font-size: 0.72rem;
  color: var(--df-text-muted);
  font-weight: 600;
}

.df-root-wrapper .df-coord-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--df-tab-active);
  margin-top: 2px;
}

/* Route Navigation Button */
.df-root-wrapper .df-btn-route {
  width: 100%;
  height: 44px;
  background: #ffffff;
  color: var(--df-btn-black);
  border: 1px solid var(--df-card-border);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--df-transition);
  margin-top: auto;
}

.df-root-wrapper .df-btn-route:hover {
  background: var(--df-tab-active);
  color: #ffffff;
  border-color: var(--df-tab-active);
  box-shadow: 0 4px 12px rgba(109, 82, 24, 0.2);
}

/* ==========================================================================
   Tab 2: Schedule Timeline Styles
   ========================================================================== */
.df-root-wrapper .df-schedule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.df-root-wrapper .df-schedule-heading {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--df-text-dark);
  margin: 0 0 4px;
}

.df-root-wrapper .df-schedule-sub {
  font-size: 0.88rem;
  color: var(--df-text-muted);
  margin: 0;
}

.df-root-wrapper .df-btn-refresh-schedule {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: var(--df-text-dark);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--df-transition);
}

.df-root-wrapper .df-btn-refresh-schedule:hover {
  background: #e2e8f0;
}

.df-root-wrapper .df-schedule-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  margin-bottom: 12px;
  transition: var(--df-transition);
  flex-wrap: wrap;
  gap: 12px;
}

.df-root-wrapper .df-schedule-item:hover {
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.04);
}

.df-root-wrapper .df-sched-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.df-root-wrapper .df-sched-time {
  background: #e2e8f0;
  color: var(--df-text-dark);
  font-weight: 800;
  font-size: 0.88rem;
  padding: 6px 14px;
  border-radius: 8px;
  white-space: nowrap;
}

.df-root-wrapper .df-sched-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--df-text-dark);
}

.df-root-wrapper .df-sched-place {
  font-size: 0.82rem;
  color: var(--df-text-muted);
  margin-top: 3px;
}

.df-root-wrapper .df-sched-status {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}

.df-root-wrapper .df-sched-status.done {
  background: #f1f5f9;
  color: #64748b;
}

.df-root-wrapper .df-sched-status.active {
  background: #fee2e2;
  color: #b91c1c;
}

.df-root-wrapper .df-sched-status.pending {
  background: #eff6ff;
  color: #2563eb;
}

/* ==========================================================================
   Routing Modal
   ========================================================================== */
.df-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  direction: rtl;
}

.df-modal-dialog {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  position: relative;
  border: 1px solid #e2e8f0;
}

.df-modal-close-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: var(--df-transition);
}

.df-modal-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.df-modal-body {
  padding: 28px 24px;
}

.df-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.df-modal-pin {
  font-size: 2rem;
}

.df-modal-deceased-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--df-text-dark);
  margin: 0 0 4px;
}

.df-modal-grave-info {
  font-size: 0.9rem;
  color: var(--df-text-muted);
  margin: 0;
}

/* Schematic Grave Matrix */
.df-schematic-wrapper {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 20px;
  text-align: center;
}

.df-schematic-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--df-text-dark);
  margin-bottom: 12px;
}

.df-schematic-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.df-schematic-cell {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 8px 4px;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
}

.df-schematic-cell.target {
  background: var(--df-tab-active);
  color: #ffffff;
  border-color: var(--df-tab-active);
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(109, 82, 24, 0.35);
}

.df-schematic-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 0.78rem;
  color: #64748b;
}

.df-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.df-legend-box {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
}

.df-legend-box.target {
  background: var(--df-tab-active);
  border-color: var(--df-tab-active);
}

.df-btn-external-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  background: var(--df-btn-black);
  color: #ffffff !important;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  transition: var(--df-transition);
}

.df-btn-external-nav:hover {
  background: #000000;
  transform: translateY(-1px);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 900px) {
  .df-root-wrapper .df-search-form {
    grid-template-columns: 1fr 1fr;
  }
  .df-root-wrapper .df-btn-box {
    grid-column: span 2;
  }
  .df-root-wrapper .df-btn-submit {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .df-root-wrapper {
    padding: 16px;
    border-radius: 16px;
  }
  .df-root-wrapper .df-tabs-header {
    flex-direction: column;
    gap: 8px;
  }
  .df-root-wrapper .df-tab-item {
    width: 100%;
    justify-content: center;
  }
  .df-root-wrapper .df-search-form {
    grid-template-columns: 1fr;
  }
  .df-root-wrapper .df-btn-box {
    grid-column: span 1;
  }
  .df-root-wrapper .df-cards-grid {
    grid-template-columns: 1fr;
  }
}
