/* ==========================================================================
   CedCast Org Admin Design System
   Modern, clean, professional interface for organization administrators
   ========================================================================== */

/* --------------------------------------------------------------------------
   Google Fonts — Inter (also loaded in base.html)
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* --------------------------------------------------------------------------
   Design Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Surface & Layout */
  --oa-bg:             #f1f5f9;
  --oa-surface:        #ffffff;
  --oa-surface-hover:  #f8fafc;
  --oa-border:         #e2e8f0;
  --oa-border-radius:  12px;
  --oa-border-radius-sm: 8px;

  /* Shadows */
  --oa-shadow:         0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --oa-shadow-md:      0 4px 12px rgba(0,0,0,.08);
  --oa-shadow-hover:   0 6px 20px rgba(0,0,0,.10);

  /* Brand Colors (overridden per-org via inline style on .org-admin-page) */
  --org-primary:       #2563eb;
  --org-secondary:     #7c3aed;

  /* Semantic colors */
  --oa-primary:        var(--org-primary);
  --oa-accent:         var(--org-secondary);
  --oa-success:        #16a34a;
  --oa-warning:        #d97706;
  --oa-danger:         #dc2626;
  --oa-info:           #0891b2;

  /* Text */
  --oa-text:           #1e293b;
  --oa-text-muted:     #64748b;
  --oa-text-light:     #94a3b8;

  /* Typography */
  --oa-font: 'Inter', system-ui, -apple-system, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* --------------------------------------------------------------------------
   Base Page Setup
   -------------------------------------------------------------------------- */
.org-admin-page {
  background: var(--oa-bg);
  font-family: var(--oa-font);
  min-height: 100vh;
  color: var(--oa-text);
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.oa-card {
  background: var(--oa-surface);
  border: 1px solid var(--oa-border);
  border-radius: var(--oa-border-radius);
  box-shadow: var(--oa-shadow);
  transition: box-shadow .2s ease, transform .2s ease;
  overflow: hidden;
}

.oa-card:hover {
  box-shadow: var(--oa-shadow-md);
}

/* Remove colored card-header pattern */
.oa-card .card-header,
.oa-card-header {
  background: transparent;
  border-bottom: 1px solid var(--oa-border);
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: .9rem;
  color: var(--oa-text);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.oa-card .card-header i,
.oa-card-header i {
  color: var(--oa-primary);
  font-size: 1rem;
}

/* --------------------------------------------------------------------------
   Stat Cards
   -------------------------------------------------------------------------- */
.oa-stat-card {
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}

.oa-stat-card .stretched-link::after {
  z-index: 1;
}

.oa-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--oa-border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  color: #fff;
}

.oa-stat-icon.bg-blue    { background: rgba(37,99,235,.12); color: #2563eb; }
.oa-stat-icon.bg-violet  { background: rgba(124,58,237,.12); color: #7c3aed; }
.oa-stat-icon.bg-cyan    { background: rgba(8,145,178,.12); color: #0891b2; }
.oa-stat-icon.bg-green   { background: rgba(22,163,74,.12); color: #16a34a; }
.oa-stat-icon.bg-amber   { background: rgba(217,119,6,.12); color: #d97706; }
.oa-stat-icon.bg-rose    { background: rgba(220,38,38,.12); color: #dc2626; }
.oa-stat-icon.bg-primary-tint { background: rgba(37,99,235,.12); color: var(--oa-primary); }

.oa-stat-body {
  flex: 1;
  min-width: 0;
}

.oa-stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
  color: var(--oa-text);
  margin-bottom: .25rem;
}

.oa-stat-label {
  font-size: .75rem;
  font-weight: 500;
  color: var(--oa-text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* --------------------------------------------------------------------------
   Quick Action Tiles
   -------------------------------------------------------------------------- */
.oa-action-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 1.25rem .75rem;
  background: var(--oa-surface);
  border: 1px solid var(--oa-border);
  border-radius: var(--oa-border-radius);
  box-shadow: var(--oa-shadow);
  text-decoration: none;
  color: var(--oa-text);
  transition: box-shadow .2s ease, transform .15s ease, background .15s ease;
  cursor: pointer;
}

.oa-action-tile:hover {
  box-shadow: var(--oa-shadow-md);
  transform: translateY(-2px);
  background: var(--oa-surface-hover);
  color: var(--oa-primary);
}

.oa-action-tile i {
  font-size: 1.5rem;
  color: var(--oa-primary);
  transition: transform .15s ease;
}

.oa-action-tile:hover i {
  transform: scale(1.1);
}

.oa-action-tile span {
  font-size: .8rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
}

/* --------------------------------------------------------------------------
   Page Header
   -------------------------------------------------------------------------- */
.oa-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.oa-page-header-left {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}

.oa-page-header-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--oa-border-radius-sm);
  background: rgba(37,99,235,.1);
  color: var(--oa-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: .1rem;
}

.oa-page-header-text h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--oa-text);
  margin-bottom: .2rem;
}

.oa-page-header-text p {
  font-size: .875rem;
  color: var(--oa-text-muted);
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Greeting Banner
   -------------------------------------------------------------------------- */
.oa-greeting-banner {
  background: linear-gradient(135deg, var(--oa-primary) 0%, color-mix(in srgb, var(--oa-primary) 70%, #000) 100%);
  border-radius: var(--oa-border-radius);
  padding: 1.5rem 1.75rem;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--oa-shadow-md);
}

.oa-greeting-banner h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: .2rem;
}

.oa-greeting-banner p {
  font-size: .875rem;
  opacity: .85;
  margin-bottom: 0;
}

/* Fallback for browsers without color-mix */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .oa-greeting-banner {
    background: linear-gradient(135deg, var(--oa-primary) 0%, #1d4ed8 100%);
  }
}

/* --------------------------------------------------------------------------
   Onboarding Checklist
   -------------------------------------------------------------------------- */
.oa-onboarding-card {
  border-left: 4px solid var(--oa-primary);
}

.oa-onboarding-step {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .5rem;
  border-radius: var(--oa-border-radius-sm);
  transition: background .15s;
}

.oa-onboarding-step:hover {
  background: var(--oa-surface-hover);
}

.oa-onboarding-step .step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
}

.oa-onboarding-step.done .step-icon {
  background: rgba(22,163,74,.1);
  color: var(--oa-success);
}

.oa-onboarding-step.pending .step-icon {
  background: rgba(37,99,235,.1);
  color: var(--oa-primary);
}

.oa-onboarding-step .step-label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--oa-text);
}

.oa-onboarding-step .step-label a {
  color: inherit;
  text-decoration: none;
}

.oa-onboarding-step .step-label a:hover {
  color: var(--oa-primary);
  text-decoration: underline;
}

.oa-onboarding-step.done .step-label {
  color: var(--oa-text-muted);
  text-decoration: line-through;
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */
.oa-navbar {
  background: var(--oa-surface);
  border-bottom: 1px solid var(--oa-border);
  box-shadow: var(--oa-shadow);
  font-family: var(--oa-font);
  padding: .5rem 0;
}

.oa-navbar .navbar-brand {
  font-weight: 700;
  color: var(--oa-text) !important;
  font-size: 1rem;
}

.oa-navbar .nav-link {
  font-weight: 500;
  font-size: .875rem;
  color: var(--oa-text-muted);
  padding: .45rem .75rem;
  border-radius: var(--oa-border-radius-sm);
  transition: color .15s ease, background .15s ease;
}

.oa-navbar .nav-link:hover,
.oa-navbar .nav-link:focus {
  color: var(--oa-primary);
  background: rgba(37,99,235,.07);
}

.oa-navbar .nav-link.active,
.oa-navbar .nav-link[aria-current="page"] {
  color: var(--oa-primary);
  background: rgba(37,99,235,.1);
  font-weight: 600;
}

.oa-navbar .dropdown-menu {
  border: 1px solid var(--oa-border);
  border-radius: var(--oa-border-radius);
  box-shadow: var(--oa-shadow-md);
  padding: .5rem;
  min-width: 200px;
}

.oa-navbar .dropdown-item {
  font-size: .875rem;
  font-weight: 500;
  color: var(--oa-text);
  padding: .5rem .75rem;
  border-radius: var(--oa-border-radius-sm);
  display: flex;
  align-items: center;
  gap: .5rem;
  transition: background .15s ease, color .15s ease;
}

.oa-navbar .dropdown-item:hover,
.oa-navbar .dropdown-item:focus {
  background: rgba(37,99,235,.07);
  color: var(--oa-primary);
}

.oa-navbar .dropdown-item i {
  width: 16px;
  text-align: center;
  font-size: .9rem;
}

.oa-navbar .dropdown-divider {
  border-color: var(--oa-border);
  margin: .35rem 0;
}

/* --------------------------------------------------------------------------
   Sub-navigation Pills (Messages, Contacts tabs)
   -------------------------------------------------------------------------- */
.oa-subnav {
  background: var(--oa-surface);
  border-bottom: 1px solid var(--oa-border);
}

.oa-subnav .nav-pills .nav-link {
  font-size: .8125rem;
  font-weight: 500;
  color: var(--oa-text-muted);
  padding: .45rem .9rem;
  border-radius: 20px;
  transition: all .15s ease;
}

.oa-subnav .nav-pills .nav-link:hover {
  background: var(--oa-surface-hover);
  color: var(--oa-text);
}

.oa-subnav .nav-pills .nav-link.active {
  background: var(--oa-primary);
  color: #fff;
}

/* --------------------------------------------------------------------------
   Breadcrumb
   -------------------------------------------------------------------------- */
.oa-breadcrumb {
  font-size: .8rem;
  margin-bottom: .75rem;
}

.oa-breadcrumb .breadcrumb-item a {
  color: var(--oa-text-muted);
  text-decoration: none;
}

.oa-breadcrumb .breadcrumb-item a:hover {
  color: var(--oa-primary);
}

.oa-breadcrumb .breadcrumb-item.active {
  color: var(--oa-text);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.oa-table {
  --bs-table-hover-bg: var(--oa-surface-hover);
}

.oa-table thead th {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--oa-text-muted);
  border-bottom: 1px solid var(--oa-border);
  padding: .75rem 1rem;
  white-space: nowrap;
}

.oa-table tbody td {
  padding: .75rem 1rem;
  font-size: .875rem;
  color: var(--oa-text);
  border-bottom: 1px solid var(--oa-border);
  vertical-align: middle;
}

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

.oa-table tbody tr:hover {
  background: var(--oa-surface-hover);
}

/* --------------------------------------------------------------------------
   Status Badges
   -------------------------------------------------------------------------- */
.oa-badge {
  font-size: .7rem;
  font-weight: 600;
  padding: .3em .65em;
  border-radius: 20px;
  letter-spacing: .02em;
}

.oa-badge-sent     { background: rgba(22,163,74,.12);  color: #16a34a; }
.oa-badge-pending  { background: rgba(217,119,6,.12);  color: #d97706; }
.oa-badge-failed   { background: rgba(220,38,38,.12);  color: #dc2626; }
.oa-badge-queued   { background: rgba(8,145,178,.12);  color: #0891b2; }
.oa-badge-scheduled { background: rgba(124,58,237,.12); color: #7c3aed; }

/* --------------------------------------------------------------------------
   Empty State
   -------------------------------------------------------------------------- */
.oa-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}

.oa-empty-state .oa-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(37,99,235,.07);
  color: var(--oa-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 1.25rem;
}

.oa-empty-state h5 {
  font-weight: 600;
  color: var(--oa-text);
  margin-bottom: .5rem;
}

.oa-empty-state p {
  font-size: .875rem;
  color: var(--oa-text-muted);
  max-width: 320px;
  margin-bottom: 1.25rem;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.oa-form-label {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--oa-text);
  margin-bottom: .4rem;
}

.oa-form-control {
  border: 1px solid var(--oa-border);
  border-radius: var(--oa-border-radius-sm);
  padding: .5rem .75rem;
  font-size: .875rem;
  font-family: var(--oa-font);
  color: var(--oa-text);
  background: var(--oa-surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.oa-form-control:focus {
  border-color: var(--oa-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  outline: none;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.oa-btn-primary {
  background: var(--oa-primary);
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: .875rem;
  padding: .5rem 1.25rem;
  border-radius: var(--oa-border-radius-sm);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: opacity .15s ease, box-shadow .15s ease, transform .1s ease;
  text-decoration: none;
  cursor: pointer;
}

.oa-btn-primary:hover {
  opacity: .9;
  box-shadow: 0 4px 12px rgba(37,99,235,.3);
  transform: translateY(-1px);
  color: #fff;
}

.oa-btn-outline {
  background: transparent;
  border: 1.5px solid var(--oa-border);
  color: var(--oa-text);
  font-weight: 500;
  font-size: .875rem;
  padding: .45rem 1.1rem;
  border-radius: var(--oa-border-radius-sm);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
  text-decoration: none;
  cursor: pointer;
}

.oa-btn-outline:hover {
  border-color: var(--oa-primary);
  color: var(--oa-primary);
  background: rgba(37,99,235,.05);
}

/* --------------------------------------------------------------------------
   Mobile Floating Menu Button (updated to match new design)
   -------------------------------------------------------------------------- */
.oa-mobile-fab {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--oa-primary);
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(37,99,235,.35);
  z-index: 1050;
  cursor: pointer;
  transition: transform .3s ease, box-shadow .3s ease;
  font-size: 1.25rem;
}

.oa-mobile-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(37,99,235,.45);
}

.oa-mobile-fab .fab-icon-open,
.oa-mobile-fab .fab-icon-close {
  position: absolute;
  transition: opacity .25s ease, transform .25s ease;
}

.oa-mobile-fab .fab-icon-close {
  opacity: 0;
  transform: rotate(-90deg);
}

.oa-mobile-fab.active .fab-icon-open {
  opacity: 0;
  transform: rotate(90deg);
}

.oa-mobile-fab.active .fab-icon-close {
  opacity: 1;
  transform: rotate(0deg);
}

/* Mobile panel */
.oa-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1040;
  opacity: 0;
  transition: opacity .3s ease;
  backdrop-filter: blur(2px);
  pointer-events: none;
}

.oa-mobile-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.oa-mobile-panel {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--oa-surface);
  z-index: 1045;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,.12);
  padding: 1.25rem 1.25rem 2rem;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  max-height: 75vh;
  overflow-y: auto;
}

.oa-mobile-panel.active {
  transform: translateY(0);
}

.oa-mobile-panel-handle {
  width: 40px;
  height: 4px;
  background: var(--oa-border);
  border-radius: 2px;
  margin: 0 auto 1.25rem;
}

.oa-mobile-nav-link {
  display: flex;
  align-items: center;
  padding: .8rem 1rem;
  color: var(--oa-text);
  text-decoration: none;
  border-radius: var(--oa-border-radius-sm);
  font-weight: 500;
  font-size: .9rem;
  transition: background .15s ease, color .15s ease;
  gap: .75rem;
}

.oa-mobile-nav-link:hover {
  background: rgba(37,99,235,.07);
  color: var(--oa-primary);
}

.oa-mobile-nav-link i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  color: var(--oa-primary);
}

.oa-mobile-nav-group-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--oa-text-light);
  padding: .6rem 1rem .3rem;
}

.oa-mobile-nav-divider {
  height: 1px;
  background: var(--oa-border);
  margin: .5rem 0;
}

@media (max-width: 991.98px) {
  .oa-mobile-fab,
  .oa-mobile-overlay,
  .oa-mobile-panel {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .oa-mobile-overlay,
  .oa-mobile-panel {
    display: block;
  }

  .oa-nav-toggler {
    display: none !important;
  }

  .navbar-collapse {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   Alerts — Override Bootstrap defaults inside org-admin pages
   -------------------------------------------------------------------------- */
.org-admin-page .alert {
  border-radius: var(--oa-border-radius);
  border: 1px solid;
  font-size: .875rem;
}

/* --------------------------------------------------------------------------
   Sparkline canvas utility
   -------------------------------------------------------------------------- */
.oa-sparkline {
  display: block;
  width: 100%;
  height: 32px;
  margin-top: .5rem;
}

/* --------------------------------------------------------------------------
   Responsive tweaks
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
  .oa-stat-value { font-size: 1.4rem; }
  .oa-greeting-banner { padding: 1.25rem; }
  .oa-greeting-banner h2 { font-size: 1.1rem; }
  .oa-page-header { flex-direction: column; }
}

@media (max-width: 767.98px) {
  .oa-action-tile { padding: 1rem .5rem; }
}
