/* ========== ReceLog WP - Styles ========== */
/* All classes prefixed with receLog- to avoid WP theme conflicts */

:root {
  --receLog-primary: #1565C0;
  --receLog-primary-dark: #0D47A1;
  --receLog-primary-light: #42A5F5;
  --receLog-accent: #25D366;
  --receLog-danger: #D32F2F;
  --receLog-bg: #F4F6F9;
  --receLog-card: #FFFFFF;
  --receLog-text: #212121;
  --receLog-text-light: #757575;
  --receLog-border: #E0E0E0;
  --receLog-shadow: 0 2px 12px rgba(0,0,0,0.08);
  --receLog-radius: 10px;
}

.receLog-wp-app,
.receLog-wp-login-wrapper {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--receLog-bg);
  color: var(--receLog-text);
  line-height: 1.5;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 0;
}

/* ========== LOGIN ========== */
.receLog-wp-login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}
.receLog-login-card {
  background: var(--receLog-card);
  border-radius: 16px;
  padding: 48px 40px;
  width: 420px;
  max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  text-align: center;
}
.receLog-login-card .receLog-logo-icon {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--receLog-primary), var(--receLog-primary-light));
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
  font-size: 40px; color: #fff;
}
.receLog-login-card h1 { font-size: 24px; margin-bottom: 8px; color: var(--receLog-primary-dark); }
.receLog-login-card p { color: var(--receLog-text-light); margin-bottom: 28px; font-size: 14px; }
.receLog-login-card .login-username,
.receLog-login-card .login-password { margin-bottom: 16px; text-align: left; }
.receLog-login-card .login-username label,
.receLog-login-card .login-password label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.receLog-login-card input[type="text"],
.receLog-login-card input[type="password"] {
  width: 100%; padding: 14px 16px;
  border: 2px solid var(--receLog-border);
  border-radius: 8px; font-size: 15px;
  outline: none; transition: border-color 0.3s;
}
.receLog-login-card input[type="text"]:focus,
.receLog-login-card input[type="password"]:focus { border-color: var(--receLog-primary); }
.receLog-login-card .login-submit .button-primary {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, var(--receLog-primary), var(--receLog-primary-light));
  color: #fff; border: none; border-radius: 8px;
  font-size: 16px; font-weight: 600;
  cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
}
.receLog-login-card .login-submit .button-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(21,101,192,0.4); }
.receLog-login-card .login-remember { margin-top: 10px; font-size: 13px; }

/* ========== TOP NAV ========== */
.receLog-topbar {
  background: var(--receLog-card);
  border-bottom: 1px solid var(--receLog-border);
  padding: 12px 32px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  border-radius: var(--receLog-radius);
  margin-bottom: 20px;
}
.receLog-brand {
  display: flex; align-items: center; gap: 12px;
  font-size: 20px; font-weight: 700; color: var(--receLog-primary-dark);
}
.receLog-icon-box {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--receLog-primary), var(--receLog-primary-light));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px;
}
.receLog-user-info { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.receLog-user-badge {
  background: var(--receLog-bg); padding: 6px 14px;
  border-radius: 20px; font-size: 13px;
  display: flex; align-items: center; gap: 6px;
}
.receLog-role-tag {
  background: var(--receLog-primary); color: #fff;
  padding: 2px 8px; border-radius: 10px; font-size: 11px;
}

/* ========== BUTTONS ========== */
.receLog-btn {
  padding: 12px 24px;
  border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.25s;
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none;
}
.receLog-btn-primary { background: var(--receLog-primary); color: #fff; }
.receLog-btn-primary:hover { background: var(--receLog-primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(21,101,192,0.3); }
.receLog-btn-success { background: var(--receLog-accent); color: #fff; }
.receLog-btn-success:hover { background: #1EB954; transform: translateY(-1px); }
.receLog-btn-danger { background: var(--receLog-danger); color: #fff; }
.receLog-btn-danger:hover { background: #B71C1C; }
.receLog-btn-outline { background: none; border: 2px solid var(--receLog-primary); color: var(--receLog-primary); }
.receLog-btn-outline:hover { background: var(--receLog-primary); color: #fff; }
.receLog-btn-logout { background: none; border: 2px solid var(--receLog-danger); color: var(--receLog-danger); padding: 6px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.2s; text-decoration: none; }
.receLog-btn-logout:hover { background: var(--receLog-danger); color: #fff; }
.receLog-btn-admin-pw { background: none; border: 2px solid var(--receLog-primary); color: var(--receLog-primary); padding: 6px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.2s; }
.receLog-btn-admin-pw:hover { background: var(--receLog-primary); color: #fff; }
.receLog-btn-sm { padding: 6px 12px; font-size: 12px; }
.receLog-btn-group { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

/* ========== TABS ========== */
.receLog-tabs {
  display: flex; gap: 4px;
  background: var(--receLog-card);
  border-radius: var(--receLog-radius);
  padding: 4px;
  box-shadow: var(--receLog-shadow);
  margin-bottom: 28px;
  overflow-x: auto;
}
.receLog-tab-btn {
  flex: 1; padding: 12px 20px;
  background: none; border: none;
  border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600;
  color: var(--receLog-text-light);
  transition: all 0.25s;
  white-space: nowrap;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.receLog-tab-btn:hover { background: var(--receLog-bg); color: var(--receLog-text); }
.receLog-tab-btn.active {
  background: var(--receLog-primary); color: #fff;
  box-shadow: 0 2px 8px rgba(21,101,192,0.3);
}
.receLog-tab-panel { display: none; }
.receLog-tab-panel.active { display: block; animation: receLogFadeIn 0.3s; }
@keyframes receLogFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ========== CARDS ========== */
.receLog-card {
  background: var(--receLog-card);
  border-radius: var(--receLog-radius);
  box-shadow: var(--receLog-shadow);
  padding: 28px;
  margin-bottom: 24px;
}
.receLog-card-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--receLog-bg);
}
.receLog-card-header h2 { font-size: 18px; color: var(--receLog-primary-dark); margin-right: 12px; }
.receLog-card-header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ========== FORM ========== */
.receLog-form-group { margin-bottom: 20px; }
.receLog-form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; color: var(--receLog-text); }
.receLog-required { color: var(--receLog-danger); }
.receLog-form-control {
  width: 100%; padding: 12px 14px;
  border: 2px solid var(--receLog-border);
  border-radius: 8px; font-size: 15px;
  transition: border-color 0.3s, box-shadow 0.3s;
  outline: none; font-family: inherit;
}
.receLog-form-control:focus { border-color: var(--receLog-primary); box-shadow: 0 0 0 3px rgba(21,101,192,0.1); }
textarea.receLog-form-control { resize: vertical; min-height: 120px; }
select.receLog-form-control { appearance: auto; }
.receLog-char-counter { text-align: right; font-size: 12px; color: var(--receLog-text-light); margin-top: 4px; }
.receLog-char-counter.warn { color: #F57C00; }
.receLog-char-counter.limit { color: var(--receLog-danger); font-weight: 700; }
.receLog-form-row { display: flex; gap: 16px; }
.receLog-form-row .receLog-form-group { flex: 1; }

/* ========== FORMAT SELECTOR ========== */
.receLog-format-selector { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.receLog-format-option {
  flex: 1; min-width: 200px;
  border: 2px solid var(--receLog-border);
  border-radius: var(--receLog-radius);
  padding: 20px; text-align: center;
  cursor: pointer; transition: all 0.3s;
  background: var(--receLog-card);
}
.receLog-format-option:hover { border-color: var(--receLog-primary-light); }
.receLog-format-option.selected { border-color: var(--receLog-primary); background: #E3F2FD; }
.receLog-format-option .receLog-format-icon { font-size: 32px; margin-bottom: 8px; }
.receLog-format-option h3 { font-size: 16px; margin-bottom: 4px; }
.receLog-format-option p { font-size: 12px; color: var(--receLog-text-light); }

/* ========== DATA TABLE ========== */
.receLog-data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.receLog-data-table th, .receLog-data-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--receLog-border); }
.receLog-data-table th { background: var(--receLog-bg); font-weight: 600; color: var(--receLog-text-light); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.receLog-data-table tr:hover td { background: #FAFAFA; }
.receLog-role-badge { padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.receLog-role-admin { background: #E3F2FD; color: var(--receLog-primary); }
.receLog-role-doctor { background: #E8F5E9; color: #2E7D32; }
.receLog-role-assistant { background: #FFF3E0; color: #E65100; }
.receLog-btn-icon {
  width: 34px; height: 34px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; border: none; cursor: pointer;
  transition: all 0.2s; font-size: 16px;
}
.receLog-btn-icon.edit { background: #E3F2FD; color: var(--receLog-primary); }
.receLog-btn-icon.edit:hover { background: var(--receLog-primary); color: #fff; }
.receLog-btn-icon.delete { background: #FFEBEE; color: var(--receLog-danger); }
.receLog-btn-icon.delete:hover { background: var(--receLog-danger); color: #fff; }
.receLog-btn-icon.whatsapp { background: #E8F5E9; color: #25D366; }
.receLog-btn-icon.whatsapp:hover { background: #25D366; color: #fff; }

/* ========== MODAL ========== */
.receLog-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100000; opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.receLog-modal-overlay.show { opacity: 1; pointer-events: auto; }
.receLog-modal {
  background: var(--receLog-card);
  border-radius: 16px;
  padding: 32px;
  width: 480px; max-width: 95vw;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  transform: translateY(20px);
  transition: transform 0.3s;
}
.receLog-modal-overlay.show .receLog-modal { transform: none; }
.receLog-modal h2 { margin-bottom: 20px; font-size: 20px; color: var(--receLog-primary-dark); }
.receLog-modal .receLog-btn-group { justify-content: flex-end; }

/* ========== TOAST ========== */
.receLog-toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 200000; display: flex;
  flex-direction: column; gap: 8px;
}
.receLog-toast {
  padding: 14px 20px;
  border-radius: 8px;
  color: #fff; font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  animation: receLogSlideIn 0.3s, receLogFadeOut 0.3s 2.7s;
  display: flex; align-items: center; gap: 8px;
}
.receLog-toast.success { background: #2E7D32; }
.receLog-toast.error { background: var(--receLog-danger); }
.receLog-toast.info { background: var(--receLog-primary); }
@keyframes receLogSlideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes receLogFadeOut { from { opacity: 1; } to { opacity: 0; } }

/* ========== PRESCRIPTION TEMPLATE - LETTER ========== */
.receLog-prescription-letter {
  width: 216mm; min-height: 279mm;
  padding: 15mm 20mm;
  background: #fff;
  position: relative;
  font-family: 'Times New Roman', Georgia, serif;
}
.receLog-prescription-letter .rx-header {
  border-bottom: 3px double #1565C0;
  padding-bottom: 12px;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 16px;
}
.receLog-prescription-letter .rx-header .logo-area { flex-shrink: 0; }
.receLog-prescription-letter .rx-header .logo-area img { width: 5cm; height: 5cm; object-fit: contain; border-radius: 4px; }
.receLog-prescription-letter .rx-header .title-area { flex: 1; text-align: center; }
.receLog-prescription-letter .rx-header h1 { font-size: 22pt; color: #1565C0; letter-spacing: 3px; text-transform: uppercase; margin-bottom: 4px; }
.receLog-prescription-letter .rx-header .subtitle { font-size: 10pt; color: #666; letter-spacing: 1px; }
.receLog-prescription-letter .rx-body { padding: 10px 0; }
.receLog-prescription-letter .clinic-info { font-size: 8pt; color: #555; line-height: 1.5; white-space: pre-wrap; text-align: center; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px dashed #ccc; }
.receLog-prescription-letter .patient-name { font-size: 14pt; margin-bottom: 16px; padding: 8px 0; border-bottom: 1px solid #ccc; }
.receLog-prescription-letter .patient-name strong { font-size: 11pt; color: #555; }
.receLog-prescription-letter .rp-section { margin-bottom: 20px; }
.receLog-prescription-letter .rp-label { font-size: 16pt; font-weight: bold; color: #1565C0; margin-bottom: 8px; }
.receLog-prescription-letter .rp-content { font-size: 12pt; line-height: 1.8; white-space: pre-wrap; min-height: 120mm; }
.receLog-prescription-letter .rx-footer {
  position: absolute; bottom: 15mm; left: 20mm; right: 20mm;
  border-top: 1px solid #ccc; padding-top: 10px;
  display: flex; flex-direction: column;
}
.receLog-prescription-letter .rx-footer .footer-bottom { display: flex; justify-content: space-between; align-items: flex-end; }
.receLog-prescription-letter .rx-footer .datetime { font-size: 9pt; color: #555; }
.receLog-prescription-letter .rx-footer .barcode-area { text-align: right; }
.receLog-prescription-letter .rx-footer .serial-info { font-size: 8pt; color: #888; margin-top: 2px; }
.receLog-prescription-letter .rx-footer .signature-area { text-align: center; min-width: 180px; }
.receLog-prescription-letter .rx-footer .signature-line { border-top: 1px solid #333; width: 180px; margin: 30px auto 4px auto; }
.receLog-prescription-letter .rx-footer .signature-name { font-size: 10pt; font-weight: bold; color: #333; }
.receLog-prescription-letter .rx-footer .signature-label { font-size: 8pt; color: #666; margin-top: 2px; }
.receLog-prescription-letter .rx-footer .signature-stamp { font-size: 7pt; color: #999; font-style: italic; margin-top: 1px; }

/* ========== PRESCRIPTION TEMPLATE - 80mm ========== */
.receLog-prescription-80mm {
  width: 80mm; padding: 5mm 4mm;
  background: #fff;
  font-family: 'Courier New', monospace;
  font-size: 9pt;
}
.receLog-prescription-80mm .rx-header { border-bottom: 2px dashed #1565C0; padding-bottom: 6px; margin-bottom: 8px; display: flex; align-items: center; gap: 4mm; }
.receLog-prescription-80mm .rx-header .logo-area { flex-shrink: 0; }
.receLog-prescription-80mm .rx-header .logo-area img { width: 18mm; height: 18mm; object-fit: contain; border-radius: 2px; }
.receLog-prescription-80mm .rx-header .title-area { flex: 1; text-align: center; }
.receLog-prescription-80mm .rx-header h1 { font-size: 13pt; color: #1565C0; letter-spacing: 2px; }
.receLog-prescription-80mm .clinic-info { font-size: 6pt; color: #555; line-height: 1.4; white-space: pre-wrap; text-align: center; padding-bottom: 4px; margin-bottom: 4px; border-bottom: 1px dotted #ccc; }
.receLog-prescription-80mm .patient-name { font-size: 10pt; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px dotted #ccc; }
.receLog-prescription-80mm .rp-label { font-size: 12pt; font-weight: bold; color: #1565C0; }
.receLog-prescription-80mm .rp-content { font-size: 9pt; line-height: 1.6; white-space: pre-wrap; margin-bottom: 8px; }
.receLog-prescription-80mm .rx-footer { border-top: 1px dashed #ccc; padding-top: 6px; display: flex; flex-direction: column; }
.receLog-prescription-80mm .rx-footer .footer-bottom { text-align: center; }
.receLog-prescription-80mm .rx-footer .datetime { font-size: 8pt; color: #555; }
.receLog-prescription-80mm .rx-footer .barcode-area { margin-top: 4px; }
.receLog-prescription-80mm .rx-footer .serial-info { font-size: 7pt; color: #888; }
.receLog-prescription-80mm .rx-footer .signature-area { text-align: center; margin-top: 6px; }
.receLog-prescription-80mm .rx-footer .signature-line { border-top: 1px solid #333; width: 60mm; margin: 8px auto 2px auto; }
.receLog-prescription-80mm .rx-footer .signature-name { font-size: 8pt; font-weight: bold; color: #333; }
.receLog-prescription-80mm .rx-footer .signature-label { font-size: 6pt; color: #666; }

/* ========== BARCODE ========== */
.receLog-barcode-svg { display: inline-block; }

/* ========== ACTION BUTTONS (History) ========== */
.receLog-btn-zip {
  background: #FF6F00; color: #fff; border: none;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.25s;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.receLog-btn-zip:hover { background: #E65100; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,111,0,0.3); }
.receLog-btn-report {
  background: #1565C0; color: #fff; border: none;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.25s;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.receLog-btn-report:hover { background: #0D47A1; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(21,101,192,0.3); }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .receLog-topbar { padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
  .receLog-wp-app { padding: 10px; }
  .receLog-form-row { flex-direction: column; gap: 0; }
  .receLog-btn-group { flex-direction: column; }
  .receLog-btn-group .receLog-btn { width: 100%; justify-content: center; }
  .receLog-card { padding: 20px; }
  .receLog-format-selector { flex-direction: column; }
  .receLog-tabs { flex-wrap: wrap; }
  .receLog-card-header { flex-direction: column; align-items: flex-start; }
  .receLog-card-header-actions { width: 100%; }
  .receLog-card-header-actions button { flex: 1; justify-content: center; font-size: 12px; padding: 8px 10px; }
}
