/*
 * Root & Branch Practitioner Portal Styles
 * Organic, warm aesthetic matching the medicinary brand
 */

/* Remove spinner arrows from all number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

:root {
  /* Primary palette - warm, earthy tones */
  --primary: #5d7a5f;           /* Sage green */
  --primary-dark: #4a6349;      /* Deeper sage */
  --primary-light: #7a9a7c;     /* Light sage */

  /* Accent colors */
  --accent: #c4a35a;            /* Warm gold */
  --accent-light: #d4b76a;      /* Light gold */
  --accent-muted: #b89f6a;      /* Muted gold */

  /* Neutral palette - warm tones */
  --bg: #faf8f5;                /* Warm cream background */
  --bg-card: #ffffff;           /* White for cards */
  --bg-subtle: #f5f2ed;         /* Subtle warm gray */

  /* Text colors */
  --text: #3d3d3d;              /* Warm dark gray */
  --text-light: #6b6b6b;        /* Medium gray */
  --text-muted: #8a8a8a;        /* Light gray */

  /* Borders */
  --border: #e5e0d8;            /* Warm border */
  --border-light: #f0ebe3;      /* Light border */

  /* Status colors */
  --success: #5d7a5f;           /* Sage green */
  --warning: #c4a35a;           /* Warm gold */
  --danger: #b85450;            /* Muted red */
  --info: #6a8caf;              /* Soft blue */

  /* Sidebar - warm olive with parchment text */
  --sidebar-bg: #3d4a3a;        /* Warm olive */
  --sidebar-hover: #4a5847;     /* Lighter olive on hover */
  --sidebar-active: #566453;    /* Active state */
  --sidebar-border: rgba(255,255,255,0.08);
  --sidebar-text: #f5f0e6;      /* Parchment/canvas text */
  --sidebar-text-muted: rgba(245,240,230,0.6);
  --sidebar-icon: #c4a35a;      /* Gold icons */
  --sidebar-width: 230px;

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Spacing */
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.05), 0 4px 6px rgba(0,0,0,0.03);
}

/* Import Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Layout
   ============================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ============================================
   Sidebar Navigation
   ============================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand a {
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: block;
}

.sidebar-brand .brand-subtitle {
  font-size: 0.7rem;
  color: var(--sidebar-icon);
  font-weight: 500;
  margin-top: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-nav {
  padding: 0.75rem 0;
}

.nav-section {
  margin-bottom: 0.25rem;
}

.nav-section-title {
  padding: 0.6rem 1.25rem 0.5rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sidebar-text-muted);
  font-weight: 700;
}

.nav-item {
  display: block;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.65rem 1.25rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 450;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  margin: 0 0.5rem;
  border-radius: var(--radius);
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
}

.nav-link.active {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: var(--sidebar-icon);
  font-weight: 600;
  border-radius: var(--radius);
}

/* Navigation Icons - gold for visibility against olive */
.nav-link .nav-icon {
  width: 24px;
  margin-right: 0.75rem;
  text-align: center;
  font-size: 1.1rem;
  color: var(--sidebar-icon);
  opacity: 0.85;
  transition: all 0.15s ease;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
  opacity: 1;
}

/* Sub-navigation */
.nav-sub {
  background: rgba(0,0,0,0.15);
}

.nav-sub .nav-link {
  padding-left: 3rem;
  font-size: 0.8rem;
}

/* ============================================
   Top Header Bar
   ============================================ */
.top-header {
  background: var(--bg-card);
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

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

.header-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-light);
  font-size: 0.875rem;
}

.header-user-name {
  font-weight: 500;
  color: var(--text);
}

/* ============================================
   Content Area
   ============================================ */
.content-body {
  padding: 1.75rem 2rem;
  flex: 1;
}

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  gap: 0.5rem;
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(93, 122, 95, 0.2);
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--text-muted);
}

.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.btn-success:hover {
  background: var(--primary-dark);
}

.btn-warning {
  background: var(--warning);
  color: white;
  border-color: var(--warning);
}

.btn-warning:hover {
  background: var(--accent-muted);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #a04845;
}

.btn-small {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-large {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* ============================================
   Forms
   ============================================ */
.form-group {
  margin-bottom: 1.25rem;
}

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

.form-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(93, 122, 95, 0.15);
}

.form-input::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b6b6b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

/* ============================================
   Tables
   ============================================ */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  background: var(--bg-subtle);
}

.table tbody tr:hover {
  background: var(--bg-subtle);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* ============================================
   Alerts & Messages
   ============================================ */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.alert-success {
  background: #f0f7f0;
  border: 1px solid #c8dfc8;
  color: #3d5a3d;
}

.alert-error,
.alert-danger {
  background: #fdf2f2;
  border: 1px solid #f0caca;
  color: #8b3d3d;
}

.alert-warning {
  background: #fdf8f0;
  border: 1px solid #f0e0c0;
  color: #8b6b3d;
}

.alert-info {
  background: #f0f5fa;
  border: 1px solid #c8d8e8;
  color: #3d5a7a;
}

/* ============================================
   Tags & Badges
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-success {
  background: #e8f5e9;
  color: #2e5a30;
}

.badge-warning {
  background: #fff8e1;
  color: #8b6b00;
}

.badge-danger {
  background: #ffebee;
  color: #8b3d3d;
}

.badge-info {
  background: #e3f2fd;
  color: #1565c0;
}

.badge-neutral {
  background: var(--bg-subtle);
  color: var(--text-light);
}

/* ============================================
   Page Headers
   ============================================ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.page-header h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.page-header-subtitle {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* ============================================
   Floating Page Title Card (like patient portal)
   ============================================ */
.page-title-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
}

.page-title-card h1 {
  color: white;
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
}

.page-title-card .btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
}

.page-title-card .btn:hover {
  background: rgba(255,255,255,0.3);
}

/* Content constrained width */
.content-constrained {
  max-width: 1200px;
}

/* Welcome Section - floating box style */
.welcome-section {
  background: linear-gradient(135deg, rgba(93, 122, 95, 0.1) 0%, rgba(196, 163, 90, 0.1) 100%);
  border: 1px solid rgba(93, 122, 95, 0.2);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.welcome-section h1,
.welcome-section h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.35rem;
  color: var(--primary);
}

.welcome-section p {
  margin: 0;
  color: var(--text-light);
}

.store-hours {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-light);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.store-hours svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.order-reminder {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(93, 122, 95, 0.15);
  font-size: 0.85rem;
  color: var(--accent-muted);
}

.order-reminder svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* Dashboard Card Style */
.dashboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.dashboard-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1.25rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
}

.dashboard-card-header h2,
.dashboard-card-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.dashboard-card-header .btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
}

.dashboard-card-header .btn:hover {
  background: rgba(255,255,255,0.3);
}

.dashboard-card-body {
  padding: 0;
}

/* ============================================
   Empty States
   ============================================ */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-light);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.empty-state a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.empty-state a:hover {
  text-decoration: underline;
}

/* ============================================
   Links
   ============================================ */
a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ============================================
   Portal-specific sidebar overrides
   ============================================ */
.cart-section {
  border-bottom: 1px solid var(--sidebar-border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}

.cart-link {
  font-weight: 600;
  position: relative;
}

.cart-badge {
  display: none;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.cart-badge.has-items {
  display: inline-block;
}

.nav-section-title.collapsible {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  padding: 0.6rem 1.25rem;
  margin: 0 0.5rem;
  border-radius: var(--radius);
  color: var(--sidebar-text);
}

.nav-section-title.collapsible:hover {
  background: var(--sidebar-hover);
}

.collapse-icon {
  font-size: 0.65rem;
  transition: transform 0.2s ease;
  opacity: 0.5;
}

.nav-section.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.nav-section.collapsed .nav-section-items {
  display: none;
}

.nav-section.standalone-link {
  margin-bottom: 0.15rem;
}

.nav-section.standalone-link .nav-item {
  padding: 0;
}

.nav-section-link {
  font-weight: 600;
  font-size: 0.8rem;
}

.nav-section-link .nav-icon {
  font-size: 1rem;
}

/* ============================================
   Utility Classes
   ============================================ */
.text-muted {
  color: var(--text-muted);
}

.text-light {
  color: var(--text-light);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .content-body {
    padding: 1rem;
  }

  .top-header {
    padding: 1rem;
  }
}
