/* ============================================================
   MOSTAQER — HOME DASHBOARD STYLES
   css/home.css
   ============================================================ */

/* ── Container ── */
.hd-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ── Hero: Greeting + Clock ── */
.hd-hero {
  background: linear-gradient(135deg, #FFF8E1 0%, #FFF3CD 50%, #FFECB3 100%);
  border: 2px solid #F5D779;
  border-radius: 18px;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.hd-hero::before {
  content: '';
  position: absolute;
  top: -30px;
  left: -30px;
  width: 120px;
  height: 120px;
  background: rgba(196, 154, 0, 0.06);
  border-radius: 50%;
}

.hd-hero-content {
  flex: 1;
  min-width: 0;
}

.hd-greeting {
  font-size: 1.6rem;
  font-weight: 800;
  color: #4A3900;
  line-height: 1.4;
  margin-bottom: .3rem;
}

.hd-user-name {
  color: #C49A00;
}

.hd-wave {
  display: inline-block;
  animation: hdWave 2s ease-in-out infinite;
  transform-origin: 70% 70%;
}

@keyframes hdWave {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(14deg); }
  30% { transform: rotate(-8deg); }
  40% { transform: rotate(14deg); }
  50% { transform: rotate(-4deg); }
  60% { transform: rotate(10deg); }
  70% { transform: rotate(0deg); }
}

.hd-clock {
  font-size: .95rem;
  color: #7A6520;
  font-weight: 500;
  font-feature-settings: 'tnum';
  direction: rtl;
}

.hd-hero-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(196, 154, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #C49A00;
  flex-shrink: 0;
  margin-right: 1rem;
}

/* ── KPI Cards Grid ── */
.hd-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .85rem;
  margin-bottom: 1.5rem;
}

.hd-kpi {
  background: #fff;
  border-radius: 14px;
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  gap: .85rem;
  border: 1.5px solid #F0ECE3;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.hd-kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
}

.hd-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.hd-kpi-body {
  min-width: 0;
}

.hd-kpi-val {
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1.2;
  color: #1A1A2E;
}

.hd-kpi-label {
  font-size: .78rem;
  color: #6B7280;
  font-weight: 500;
  margin-top: 2px;
}

/* KPI color variants */
.hd-kpi--total .hd-kpi-icon { background: #EDE9FE; color: #7C3AED; }
.hd-kpi--total { border-color: #E0D4FC; }

.hd-kpi--completed .hd-kpi-icon { background: #D1FAE5; color: #059669; }
.hd-kpi--completed { border-color: #A7F3D0; }

.hd-kpi--waiting .hd-kpi-icon { background: #FEF3C7; color: #D97706; }
.hd-kpi--waiting { border-color: #FDE68A; }

.hd-kpi--notarrived .hd-kpi-icon { background: #DBEAFE; color: #2563EB; }
.hd-kpi--notarrived { border-color: #BFDBFE; }

.hd-kpi--drafts .hd-kpi-icon { background: #FEE2E2; color: #DC2626; }
.hd-kpi--drafts { border-color: #FECACA; }

.hd-kpi--plans .hd-kpi-icon { background: #CCFBF1; color: #0D9488; }
.hd-kpi--plans { border-color: #99F6E4; }

/* ── Alerts ── */
.hd-alerts {
  margin-bottom: 1.25rem;
}

.hd-alert {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: #FFFBEB;
  border: 1.5px solid #FDE68A;
  border-radius: 12px;
  padding: .85rem 1.1rem;
  margin-bottom: .5rem;
  transition: all .2s;
}

.hd-alert:hover {
  border-color: #F59E0B;
  background: #FFF8DC;
}

.hd-alert-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.hd-alert-text {
  flex: 1;
  font-size: .85rem;
  color: #4A3900;
  line-height: 1.5;
}

.hd-alert-btn {
  background: #F59E0B;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .4rem .9rem;
  font-size: .78rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s;
}

.hd-alert-btn:hover {
  background: #D97706;
}

/* ═══════════════════════════════════════
   UNIFIED DRAFTS SECTION (v2.0)
   ═══════════════════════════════════════ */
.hd-drafts-section {
  background: linear-gradient(135deg, #FFFBEB 0%, #FFF8E1 100%);
  border: 1.5px solid #FDE68A;
  border-radius: 14px;
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
}
.hd-drafts-header {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .88rem;
  font-weight: 700;
  color: #92400E;
  margin-bottom: .75rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid #FDE68A;
}
.hd-drafts-header i {
  color: #F59E0B;
}
.hd-drafts-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #F59E0B;
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: 0 .35rem;
  margin-right: auto;
}
.hd-drafts-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.hd-draft-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: #fff;
  border: 1px solid #F5DEB340;
  border-radius: 10px;
  padding: .65rem .85rem;
  transition: all .2s;
}
.hd-draft-card:hover {
  border-color: #F59E0B;
  box-shadow: 0 2px 8px rgba(245,158,11,.12);
}
.hd-draft-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hd-draft-body {
  flex: 1;
  min-width: 0;
}
.hd-draft-title {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  flex-wrap: wrap;
}
.hd-draft-type {
  font-weight: 700;
  font-size: .78rem;
}
.hd-draft-sep {
  color: #D1D5DB;
  font-size: .7rem;
}
.hd-draft-title strong {
  color: #1C1917;
  font-size: .85rem;
}
.hd-draft-progress {
  font-size: .72rem;
  color: #78716C;
  margin-top: .15rem;
}
.hd-draft-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
}
.hd-draft-resume {
  background: #F59E0B;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .38rem .75rem;
  font-size: .76rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .3rem;
  transition: background .2s;
}
.hd-draft-resume:hover {
  background: #D97706;
}
.hd-draft-delete {
  background: #FEE2E2;
  color: #EF4444;
  border: 1px solid #FECACA;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.hd-draft-delete:hover {
  background: #FCA5A5;
  border-color: #EF4444;
}

@media (max-width: 480px) {
  .hd-draft-card {
    flex-wrap: wrap;
    gap: .5rem;
  }
  .hd-draft-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ── Section ── */
.hd-section {
  margin-bottom: 1.5rem;
}

.hd-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .85rem;
}

.hd-section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1A1A2E;
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
}

.hd-section-title i {
  color: #C49A00;
  font-size: .95rem;
}

.hd-refresh-btn {
  background: none;
  border: 1.5px solid #E5E7EB;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6B7280;
  font-size: .85rem;
  transition: all .2s;
}

.hd-refresh-btn:hover {
  background: #F9FAFB;
  border-color: #C49A00;
  color: #C49A00;
}

/* ── Appointments Table ── */
.hd-appointments-wrap {
  background: #fff;
  border-radius: 14px;
  border: 1.5px solid #F0ECE3;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.hd-apt-table {
  width: 100%;
  border-collapse: collapse;
}

.hd-apt-table th {
  background: #FBF8F1;
  padding: .7rem .85rem;
  text-align: right;
  font-size: .78rem;
  font-weight: 700;
  color: #7A6520;
  border-bottom: 1.5px solid #F0ECE3;
  white-space: nowrap;
}

.hd-apt-table td {
  padding: .75rem .85rem;
  font-size: .85rem;
  color: #374151;
  border-bottom: 1px solid #F5F3EE;
  vertical-align: middle;
}

.hd-apt-row:last-child td {
  border-bottom: none;
}

.hd-apt-row:hover {
  background: #FEFCF5;
}

.hd-apt-time {
  font-weight: 700;
  color: #1A1A2E;
  font-feature-settings: 'tnum';
  white-space: nowrap;
  min-width: 70px;
}

.hd-apt-name-main {
  font-weight: 700;
  color: #1A1A2E;
  margin-bottom: 2px;
}

.hd-apt-file {
  font-size: .72rem;
  color: #9CA3AF;
  font-weight: 500;
}

.hd-apt-visit {
  color: #6B7280;
  font-size: .82rem;
}

/* Status badges */
.hd-status {
  display: inline-block;
  padding: .25rem .6rem;
  border-radius: 8px;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}

.hd-status--completed {
  background: #D1FAE5;
  color: #065F46;
}

.hd-status--waiting {
  background: #FEF3C7;
  color: #92400E;
}

.hd-status--scheduled {
  background: #DBEAFE;
  color: #1E40AF;
}

.hd-status--cancelled {
  background: #FEE2E2;
  color: #991B1B;
}

/* Action buttons */
.hd-apt-actions {
  display: flex;
  gap: .4rem;
}

.hd-apt-action {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #E5E7EB;
  background: #fff;
  color: #6B7280;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .75rem;
  transition: all .2s;
}

.hd-apt-action:hover {
  border-color: #C49A00;
  color: #C49A00;
  background: #FFFBEB;
}

/* Empty state */
.hd-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #9CA3AF;
}

.hd-empty i {
  font-size: 2.5rem;
  color: #10B981;
  margin-bottom: .75rem;
  display: block;
}

.hd-empty p {
  font-size: .95rem;
  font-weight: 600;
  color: #6B7280;
  margin: 0;
}

/* Loading */
.hd-loading {
  text-align: center;
  padding: 2rem;
  color: #9CA3AF;
}

.hd-loading i {
  font-size: 1.5rem;
  margin-bottom: .5rem;
  display: block;
}

.hd-loading span {
  font-size: .82rem;
}

/* ── Quick Actions ── */
.hd-quick-actions {
  margin-bottom: 1.5rem;
}

.hd-quick-actions .hd-section-title {
  margin-bottom: .85rem;
}

.hd-qa-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
}

.hd-qa-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: 1rem .5rem;
  border-radius: 14px;
  border: 1.5px solid #F0ECE3;
  background: #fff;
  cursor: pointer;
  transition: all .25s;
  font-family: inherit;
  box-shadow: 0 2px 6px rgba(0,0,0,.03);
}

.hd-qa-btn i {
  font-size: 1.4rem;
}

.hd-qa-btn span {
  font-size: .78rem;
  font-weight: 700;
  color: #374151;
}

.hd-qa-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
}

.hd-qa-btn--appointments { border-color: #FDE68A; }
.hd-qa-btn--appointments i { color: #D97706; }
.hd-qa-btn--appointments:hover { background: #FFFBEB; border-color: #F59E0B; }

.hd-qa-btn--waiting { border-color: #FDE68A; }
.hd-qa-btn--waiting i { color: #F59E0B; }
.hd-qa-btn--waiting:hover { background: #FFFBEB; border-color: #F59E0B; }

.hd-qa-btn--history { border-color: #C7D2FE; }
.hd-qa-btn--history i { color: #4F46E5; }
.hd-qa-btn--history:hover { background: #EEF2FF; border-color: #6366F1; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .hd-container {
    padding: 1rem .75rem;
  }
  .hd-hero {
    padding: 1.1rem 1.25rem;
    flex-direction: row;
  }
  .hd-greeting {
    font-size: 1.25rem;
  }
  .hd-clock {
    font-size: .82rem;
  }
  .hd-hero-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 1.2rem;
    margin-right: .75rem;
  }
  .hd-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .65rem;
  }
  .hd-kpi {
    padding: .85rem .9rem;
  }
  .hd-kpi-val {
    font-size: 1.3rem;
  }
  .hd-qa-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .6rem;
  }

  /* Appointments table scroll */
  .hd-appointments-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .hd-apt-table {
    min-width: 520px;
  }
}

@media (max-width: 480px) {
  .hd-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hd-greeting {
    font-size: 1.1rem;
  }
  .hd-hero {
    padding: 1rem;
  }
  .hd-hero-icon {
    display: none;
  }
}
