/* ─── Family Pharmacy – Custom Stylesheet ─────────────────────────────── */

/* Variables */
:root {
  --fp-green-dark:   #155a2e;
  --fp-green:        #1a7a3e;
  --fp-green-mid:    #239651;
  --fp-green-light:  #d4edda;
  --fp-accent:       #ff6b35;
  --fp-text:         #1e2d25;
  --fp-muted:        #6c7b72;
  --fp-bg:           #f4faf6;
  --fp-card-shadow:  0 4px 24px rgba(26,122,62,.10);
  --fp-radius:       14px;
}

/* ─── Base ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', 'Segoe UI', Arial, sans-serif;
  background: var(--fp-bg);
  color: var(--fp-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Navbar ──────────────────────────────────────────────────────────── */
.fp-navbar {
  background: linear-gradient(135deg, var(--fp-green-dark) 0%, var(--fp-green-mid) 100%);
  padding: .75rem 0;
}
.fp-navbar .navbar-brand { font-size: 1.3rem; letter-spacing: .3px; }
.brand-icon { font-size: 1.5rem; }
.fp-navbar .nav-link { font-weight: 500; font-size: .95rem; transition: opacity .2s; }
.fp-navbar .nav-link:hover { opacity: .85; }
.lang-toggle { font-size: .88rem; }
.lang-menu { min-width: 160px; }
.fp-btn-primary { background: var(--fp-accent) !important; border-color: var(--fp-accent) !important; }
.fp-btn-primary:hover { opacity: .9; }

/* ─── Hero ────────────────────────────────────────────────────────────── */
.fp-hero {
  background: linear-gradient(135deg, var(--fp-green-dark) 0%, var(--fp-green) 60%, var(--fp-green-mid) 100%);
  color: #fff;
  padding: 5rem 0 4rem;
  position: relative;
  overflow: hidden;
}
.fp-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='30' r='28' fill='none' stroke='rgba(255,255,255,.05)' stroke-width='2'/%3E%3C/svg%3E") repeat;
  pointer-events: none;
}
.fp-hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; line-height: 1.2; }
.fp-hero p  { font-size: 1.1rem; opacity: .9; max-width: 540px; }
.fp-hero .btn-hero-primary {
  background: var(--fp-accent);
  border: none;
  color: #fff;
  padding: .8rem 2.2rem;
  border-radius: 50px;
  font-size: 1.05rem;
  font-weight: 700;
  transition: transform .2s, box-shadow .2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.fp-hero .btn-hero-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255,107,53,.4);
}
.fp-hero .btn-hero-secondary {
  background: rgba(255,255,255,.15);
  border: 2px solid rgba(255,255,255,.5);
  color: #fff;
  padding: .75rem 1.8rem;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  transition: background .2s;
  text-decoration: none;
}
.fp-hero .btn-hero-secondary:hover { background: rgba(255,255,255,.25); }
.hero-pill-img {
  font-size: 9rem;
  line-height: 1;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,.3));
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-16px); }
}

/* ─── Feature cards ───────────────────────────────────────────────────── */
.fp-features { padding: 4rem 0; }
.feature-card {
  background: #fff;
  border-radius: var(--fp-radius);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: var(--fp-card-shadow);
  border: 1px solid rgba(26,122,62,.08);
  transition: transform .25s, box-shadow .25s;
  height: 100%;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: 0 8px 32px rgba(26,122,62,.15); }
.feature-icon { font-size: 2.8rem; margin-bottom: 1rem; }
.feature-card h4 { color: var(--fp-green); font-weight: 700; }
.feature-card p  { color: var(--fp-muted); font-size: .95rem; margin: 0; }

/* ─── Auth cards ──────────────────────────────────────────────────────── */
.fp-auth-page {
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--fp-bg);
}
.fp-card {
  background: #fff;
  border-radius: var(--fp-radius);
  box-shadow: var(--fp-card-shadow);
  border: 1px solid rgba(26,122,62,.1);
  overflow: hidden;
}
.fp-card-header {
  background: linear-gradient(135deg, var(--fp-green-dark), var(--fp-green-mid));
  color: #fff;
  padding: 2rem 2.5rem 1.5rem;
  text-align: center;
}
.fp-card-header .icon { font-size: 2.8rem; margin-bottom: .5rem; }
.fp-card-header h2 { margin: 0; font-weight: 800; font-size: 1.6rem; }
.fp-card-header p  { margin: .4rem 0 0; opacity: .85; font-size: .92rem; }
.fp-card-body { padding: 2rem 2.5rem; }

/* ─── Form controls ───────────────────────────────────────────────────── */
.fp-form-label { font-weight: 600; color: var(--fp-text); font-size: .92rem; margin-bottom: .35rem; }
.fp-form-control {
  border: 1.5px solid #d0ddd5;
  border-radius: 10px;
  padding: .65rem 1rem;
  font-family: 'Cairo', sans-serif;
  font-size: .95rem;
  transition: border-color .2s, box-shadow .2s;
}
.fp-form-control:focus {
  border-color: var(--fp-green-mid);
  box-shadow: 0 0 0 3px rgba(35,150,81,.15);
  outline: none;
}
.fp-form-control.is-invalid { border-color: #dc3545; }
textarea.fp-form-control { resize: vertical; min-height: 90px; }

/* ─── Buttons ─────────────────────────────────────────────────────────── */
.btn-fp-primary {
  background: linear-gradient(135deg, var(--fp-green), var(--fp-green-mid));
  border: none;
  color: #fff;
  border-radius: 10px;
  padding: .65rem 1.6rem;
  font-weight: 700;
  font-family: 'Cairo', sans-serif;
  font-size: .95rem;
  transition: opacity .2s, transform .15s, box-shadow .2s;
}
.btn-fp-primary:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(26,122,62,.3); color: #fff; }
.btn-fp-danger  { background: linear-gradient(135deg, #c82333, #e74c3c); border: none; color: #fff; border-radius: 10px; padding: .65rem 1.6rem; font-weight: 700; font-family: 'Cairo', sans-serif; }
.btn-fp-danger:hover { opacity: .9; color: #fff; }
.btn-fp-outline { background: transparent; border: 1.5px solid var(--fp-green); color: var(--fp-green); border-radius: 10px; padding: .6rem 1.4rem; font-weight: 600; font-family: 'Cairo', sans-serif; }
.btn-fp-outline:hover { background: var(--fp-green); color: #fff; }

/* ─── Dashboard ───────────────────────────────────────────────────────── */
.fp-dashboard { padding: 2rem 0 4rem; }
.fp-page-title {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--fp-green-dark);
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* Stat cards */
.stat-card {
  background: #fff;
  border-radius: var(--fp-radius);
  padding: 1.4rem 1.6rem;
  box-shadow: var(--fp-card-shadow);
  border-left: 5px solid var(--fp-green);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform .2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card.danger  { border-left-color: #dc3545; }
.stat-card.warning { border-left-color: #fd7e14; }
.stat-card.info    { border-left-color: #0d6efd; }
.stat-icon { font-size: 2rem; }
.stat-value { font-size: 1.9rem; font-weight: 800; line-height: 1; color: var(--fp-green-dark); }
.stat-label { font-size: .82rem; color: var(--fp-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

/* ─── Medicine table ──────────────────────────────────────────────────── */
.medicine-table-wrap {
  background: #fff;
  border-radius: var(--fp-radius);
  box-shadow: var(--fp-card-shadow);
  overflow: hidden;
  border: 1px solid rgba(26,122,62,.08);
}
.medicine-table-wrap .table { margin: 0; }
.medicine-table-wrap .table thead th {
  background: var(--fp-green-dark);
  color: #fff;
  font-weight: 700;
  font-size: .88rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  border: none;
  padding: .9rem 1rem;
  white-space: nowrap;
}
.medicine-table-wrap .table tbody tr { transition: background .15s; }
.medicine-table-wrap .table tbody tr:hover { background: rgba(26,122,62,.04); }
.medicine-table-wrap .table tbody td { padding: .8rem 1rem; vertical-align: middle; font-size: .93rem; border-color: #eef4f0; }

.medicine-name   { font-weight: 700; color: var(--fp-green-dark); font-size: 1rem; }
.medicine-patient { font-size: .88rem; color: var(--fp-muted); }

/* Expiry badges */
.badge-expiry { display: inline-flex; align-items: center; gap: .3rem; padding: .4rem .75rem; border-radius: 50px; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.badge-expiry.expired  { background: #fee2e2; color: #991b1b; }
.badge-expiry.critical { background: #fee2e2; color: #991b1b; }
.badge-expiry.warning  { background: #fff3cd; color: #854d0e; }
.badge-expiry.ok       { background: #d1fae5; color: #065f46; }
.badge-expiry.today    { background: #fee2e2; color: #991b1b; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity:1 } 50% { opacity:.6 } }

/* ─── Add/Edit form page ──────────────────────────────────────────────── */
.fp-form-page { padding: 2rem 0 4rem; }
.fp-form-section {
  background: #fff;
  border-radius: var(--fp-radius);
  box-shadow: var(--fp-card-shadow);
  border: 1px solid rgba(26,122,62,.1);
  overflow: hidden;
}
.fp-form-section-header {
  background: linear-gradient(135deg, var(--fp-green-dark), var(--fp-green));
  color: #fff;
  padding: 1.2rem 1.8rem;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.fp-form-section-body { padding: 1.6rem 1.8rem; }

/* ─── Search bar ──────────────────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-wrap .search-icon {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  color: var(--fp-muted);
  font-size: 1rem;
  pointer-events: none;
}
.rtl-body .search-wrap .search-icon { right: 1rem; left: auto; }
html:not([dir="rtl"]) .search-wrap .search-icon { left: 1rem; }
.search-wrap input { padding-left: 2.5rem; }
.rtl-body .search-wrap input { padding-right: 2.5rem; padding-left: 1rem; }

/* ─── Footer ──────────────────────────────────────────────────────────── */
.fp-footer {
  background: var(--fp-green-dark);
  color: rgba(255,255,255,.7);
  margin-top: auto;
}
.fp-footer p { margin: 0; }

/* ─── Verify/info pages ───────────────────────────────────────────────── */
.fp-info-page {
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.fp-info-card {
  background: #fff;
  border-radius: var(--fp-radius);
  box-shadow: var(--fp-card-shadow);
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 480px;
  width: 100%;
}
.fp-info-card .info-icon { font-size: 4rem; margin-bottom: 1rem; }
.fp-info-card h2 { font-weight: 800; color: var(--fp-green-dark); }
.fp-info-card p  { color: var(--fp-muted); font-size: .97rem; }

/* ─── Delete confirm page ─────────────────────────────────────────────── */
.delete-confirm-card {
  background: #fff;
  border-radius: var(--fp-radius);
  box-shadow: var(--fp-card-shadow);
  border-top: 5px solid #dc3545;
  padding: 2.5rem;
  max-width: 500px;
}

/* ─── Responsive tweaks ───────────────────────────────────────────────── */
@media (max-width: 767px) {
  .fp-hero { padding: 3rem 0 2.5rem; }
  .fp-card-body { padding: 1.5rem; }
  .fp-card-header { padding: 1.5rem; }
  .medicine-table-wrap { overflow-x: auto; }
  .stat-card { padding: 1rem; }
}

/* ─── RTL adjustments ─────────────────────────────────────────────────── */
[dir="rtl"] .stat-card { border-left: none; border-right: 5px solid var(--fp-green); }
[dir="rtl"] .stat-card.danger  { border-right-color: #dc3545; }
[dir="rtl"] .stat-card.warning { border-right-color: #fd7e14; }
[dir="rtl"] .stat-card.info    { border-right-color: #0d6efd; }

/* Dev mode notice */
.dev-notice {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  padding: .75rem 1rem;
  font-size: .88rem;
  margin-top: 1rem;
}
.dev-notice code { word-break: break-all; display: block; margin-top: .4rem; font-size: .85rem; color: #495057; }
