/*  ============================================================
    OECTA-HW Shared Components  |  @home@oectahw
    ============================================================
    Reusable UI classes shared across all portals.
    Depends on oecta-tokens.css being loaded first.
    ============================================================ */


/* ── Cards ──────────────────────────────────────────────────── */

.oecta-card {
  background: var(--oecta-surface-lowest);
  border-radius: var(--oecta-radius-lg);
  box-shadow: var(--oecta-shadow-sm);
  padding: var(--oecta-space-xl);
  transition: box-shadow var(--oecta-duration-base) var(--oecta-ease),
              transform var(--oecta-duration-base) var(--oecta-ease);
}
.oecta-card:hover {
  box-shadow: var(--oecta-shadow-md);
}

.oecta-card-header {
  font-family: var(--oecta-font-display);
  font-size: var(--oecta-text-lg);
  font-weight: var(--oecta-weight-bold);
  color: var(--oecta-on-surface);
  display: flex;
  align-items: center;
  gap: var(--oecta-space-sm);
  margin-bottom: var(--oecta-space-lg);
}
.oecta-card-header .material-icons-outlined,
.oecta-card-header .material-icons {
  font-size: 22px;
  color: var(--oecta-primary-container);
}

.oecta-card-compact {
  padding: var(--oecta-space-lg);
}

.oecta-card-interactive {
  cursor: pointer;
}
.oecta-card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--oecta-shadow-lg);
}
.oecta-card-interactive:active {
  transform: translateY(0);
  box-shadow: var(--oecta-shadow-sm);
}


/* ── Metric Cards ───────────────────────────────────────────── */

.oecta-metric {
  background: var(--oecta-surface-lowest);
  border-radius: var(--oecta-radius-lg);
  box-shadow: var(--oecta-shadow-sm);
  padding: var(--oecta-space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--oecta-space-xs);
}
.oecta-metric-value {
  font-family: var(--oecta-font-display);
  font-size: var(--oecta-text-2xl);
  font-weight: var(--oecta-weight-extrabold);
  color: var(--oecta-on-surface);
  line-height: 1;
}
.oecta-metric-label {
  font-family: var(--oecta-font-body);
  font-size: var(--oecta-text-xs);
  font-weight: var(--oecta-weight-semibold);
  color: var(--oecta-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.oecta-metric-trend {
  font-size: var(--oecta-text-xs);
  font-weight: var(--oecta-weight-medium);
  margin-top: var(--oecta-space-xs);
}
.oecta-metric-trend.up   { color: var(--oecta-success); }
.oecta-metric-trend.down { color: var(--oecta-error); }


/* ── Buttons ────────────────────────────────────────────────── */

.oecta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--oecta-space-sm);
  font-family: var(--oecta-font-body);
  font-size: var(--oecta-text-base);
  font-weight: var(--oecta-weight-semibold);
  line-height: 1;
  padding: 10px 20px;
  border-radius: var(--oecta-radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--oecta-duration-fast) var(--oecta-ease);
  text-decoration: none;
  white-space: nowrap;
}
.oecta-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.oecta-btn .material-icons-outlined,
.oecta-btn .material-icons {
  font-size: 18px;
}

/* Primary — navy gradient */
.oecta-btn-primary {
  background: var(--oecta-gradient-navy);
  color: #fff;
  box-shadow: var(--oecta-shadow-sm);
}
.oecta-btn-primary:hover:not(:disabled) {
  box-shadow: var(--oecta-shadow-md);
  filter: brightness(1.1);
}
.oecta-btn-primary:active:not(:disabled) {
  filter: brightness(0.95);
  box-shadow: var(--oecta-shadow-xs);
}
.oecta-btn-primary:focus-visible {
  outline: none;
  box-shadow: var(--oecta-focus-ring);
}

/* Secondary — ghost style */
.oecta-btn-secondary {
  background: transparent;
  color: var(--oecta-primary-container);
  box-shadow: inset 0 0 0 1.5px var(--oecta-outline-variant);
}
.oecta-btn-secondary:hover:not(:disabled) {
  background: var(--oecta-surface-low);
  box-shadow: inset 0 0 0 1.5px var(--oecta-primary-container);
}
.oecta-btn-secondary:focus-visible {
  outline: none;
  box-shadow: var(--oecta-focus-ring), inset 0 0 0 1.5px var(--oecta-primary-container);
}

/* Accent — amber for urgent/CTA */
.oecta-btn-accent {
  background: var(--oecta-gradient-accent);
  color: #fff;
  box-shadow: var(--oecta-shadow-accent);
}
.oecta-btn-accent:hover:not(:disabled) {
  box-shadow: var(--oecta-shadow-accent-hover);
  filter: brightness(1.05);
}
.oecta-btn-accent:focus-visible {
  outline: none;
  box-shadow: var(--oecta-focus-ring-accent);
}

/* Danger */
.oecta-btn-danger {
  background: var(--oecta-error);
  color: #fff;
}
.oecta-btn-danger:hover:not(:disabled) {
  filter: brightness(1.1);
}

/* Text-only */
.oecta-btn-text {
  background: transparent;
  color: var(--oecta-primary-container);
  padding: 8px 12px;
}
.oecta-btn-text:hover:not(:disabled) {
  background: var(--oecta-surface-low);
}

/* Icon-only */
.oecta-btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--oecta-radius-md);
  background: transparent;
  color: var(--oecta-on-surface-variant);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--oecta-duration-fast) var(--oecta-ease);
}
.oecta-btn-icon:hover {
  background: var(--oecta-surface-container);
  color: var(--oecta-on-surface);
}

/* Size variants */
.oecta-btn-sm {
  font-size: var(--oecta-text-sm);
  padding: 6px 14px;
  border-radius: var(--oecta-radius-sm);
}
.oecta-btn-lg {
  font-size: var(--oecta-text-md);
  padding: 14px 28px;
  border-radius: var(--oecta-radius-lg);
}


/* ── Inputs ─────────────────────────────────────────────────── */

.oecta-input {
  font-family: var(--oecta-font-body);
  font-size: var(--oecta-text-base);
  color: var(--oecta-on-surface);
  background: var(--oecta-surface-high);
  border: 1.5px solid transparent;
  border-radius: var(--oecta-radius-md);
  padding: 10px 14px;
  width: 100%;
  transition: all var(--oecta-duration-fast) var(--oecta-ease);
}
.oecta-input::placeholder {
  color: var(--oecta-text-subtle);
}
.oecta-input:focus {
  outline: none;
  background: var(--oecta-surface-lowest);
  border-color: var(--oecta-outline-variant);
  box-shadow: 0 0 0 3px rgba(32,65,100,0.06), inset 0 -2px 0 var(--oecta-accent);
}
.oecta-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.oecta-input-label {
  display: block;
  font-family: var(--oecta-font-body);
  font-size: var(--oecta-text-sm);
  font-weight: var(--oecta-weight-semibold);
  color: var(--oecta-on-surface-variant);
  margin-bottom: var(--oecta-space-xs);
}

.oecta-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2373777f' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

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


/* ── Badges ─────────────────────────────────────────────────── */

.oecta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--oecta-font-body);
  font-size: var(--oecta-text-xs);
  font-weight: var(--oecta-weight-semibold);
  line-height: 1;
  padding: 4px 10px;
  border-radius: var(--oecta-radius-pill);
  white-space: nowrap;
}
.oecta-badge-success {
  background: var(--oecta-success-soft);
  color: var(--oecta-success);
}
.oecta-badge-error {
  background: var(--oecta-error-soft);
  color: var(--oecta-error);
}
.oecta-badge-warning {
  background: var(--oecta-warning-soft);
  color: var(--oecta-warning);
}
.oecta-badge-info {
  background: var(--oecta-info-soft);
  color: var(--oecta-info);
}
.oecta-badge-neutral {
  background: var(--oecta-surface-container);
  color: var(--oecta-on-surface-variant);
}
.oecta-badge-accent {
  background: var(--oecta-accent);
  color: #fff;
}


/* ── Glass / Frosted ────────────────────────────────────────── */

.oecta-glass {
  background: var(--oecta-glass-bg);
  backdrop-filter: blur(var(--oecta-glass-blur));
  -webkit-backdrop-filter: blur(var(--oecta-glass-blur));
  border: 1px solid var(--oecta-glass-border);
}


/* ── Hero Banner ────────────────────────────────────────────── */

.oecta-hero {
  position: relative;
  background: var(--oecta-gradient-navy-deep);
  padding: var(--oecta-space-3xl) var(--oecta-space-xl);
  overflow: hidden;
  color: #fff;
}
.oecta-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 80% 20%, rgba(243,156,18,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 400px 300px at 20% 80%, rgba(32,65,100,0.15) 0%, transparent 60%);
  pointer-events: none;
}
.oecta-hero-title {
  font-family: var(--oecta-font-display);
  font-size: var(--oecta-text-2xl);
  font-weight: var(--oecta-weight-extrabold);
  line-height: 1.15;
  position: relative;
  z-index: 1;
}
.oecta-hero-subtitle {
  font-family: var(--oecta-font-body);
  font-size: var(--oecta-text-md);
  color: rgba(255,255,255,0.75);
  margin-top: var(--oecta-space-sm);
  position: relative;
  z-index: 1;
}
.oecta-hero-actions {
  display: flex;
  gap: var(--oecta-space-sm);
  margin-top: var(--oecta-space-xl);
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}


/* ── Labels ─────────────────────────────────────────────────── */

.oecta-label {
  font-family: var(--oecta-font-body);
  font-size: var(--oecta-text-xs);
  font-weight: var(--oecta-weight-semibold);
  color: var(--oecta-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}


/* ── Divider (no-line rule: spacing, not a visible line) ───── */

.oecta-divider {
  height: 1px;
  background: var(--oecta-surface-container);
  margin: var(--oecta-space-xl) 0;
  border: none;
}


/* ── Chip / Tag ─────────────────────────────────────────────── */

.oecta-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--oecta-space-xs);
  font-family: var(--oecta-font-body);
  font-size: var(--oecta-text-sm);
  font-weight: var(--oecta-weight-medium);
  color: var(--oecta-on-surface-variant);
  background: var(--oecta-surface-container);
  padding: 5px 12px;
  border-radius: var(--oecta-radius-pill);
  border: none;
  cursor: pointer;
  transition: all var(--oecta-duration-fast) var(--oecta-ease);
}
.oecta-chip:hover {
  background: var(--oecta-surface-high);
  color: var(--oecta-on-surface);
}
.oecta-chip.active {
  background: var(--oecta-primary-container);
  color: #fff;
}


/* ── Avatar ─────────────────────────────────────────────────── */

.oecta-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--oecta-radius-round);
  object-fit: cover;
  background: var(--oecta-surface-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--oecta-font-display);
  font-weight: var(--oecta-weight-bold);
  font-size: var(--oecta-text-base);
  color: var(--oecta-primary-container);
  flex-shrink: 0;
}
.oecta-avatar-sm { width: 32px; height: 32px; font-size: var(--oecta-text-sm); }
.oecta-avatar-lg { width: 56px; height: 56px; font-size: var(--oecta-text-xl); }


/* ── Empty States ───────────────────────────────────────────── */

.oecta-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--oecta-space-3xl) var(--oecta-space-xl);
  text-align: center;
  color: var(--oecta-text-muted);
}
.oecta-empty .material-icons-outlined {
  font-size: 48px;
  color: var(--oecta-outline-variant);
  margin-bottom: var(--oecta-space-lg);
}
.oecta-empty-title {
  font-family: var(--oecta-font-display);
  font-size: var(--oecta-text-lg);
  font-weight: var(--oecta-weight-bold);
  color: var(--oecta-on-surface);
  margin-bottom: var(--oecta-space-sm);
}


/* ── Sidebar Navigation (shared base) ──────────────────────── */

.oecta-nav-item {
  display: flex;
  align-items: center;
  gap: var(--oecta-space-md);
  padding: 10px 16px;
  border-radius: var(--oecta-radius-md);
  font-family: var(--oecta-font-body);
  font-size: var(--oecta-text-base);
  font-weight: var(--oecta-weight-medium);
  color: var(--oecta-on-surface-variant);
  cursor: pointer;
  transition: all var(--oecta-duration-fast) var(--oecta-ease);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}
.oecta-nav-item:hover {
  background: var(--oecta-surface-low);
  color: var(--oecta-on-surface);
}
.oecta-nav-item.active {
  background: var(--oecta-gradient-navy);
  color: #fff;
  font-weight: var(--oecta-weight-semibold);
  box-shadow: var(--oecta-shadow-sm);
}
.oecta-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--oecta-accent);
}
.oecta-nav-item .material-icons-outlined,
.oecta-nav-item .material-icons {
  font-size: 20px;
  flex-shrink: 0;
}

.oecta-nav-section {
  font-family: var(--oecta-font-body);
  font-size: var(--oecta-text-xs);
  font-weight: var(--oecta-weight-semibold);
  color: var(--oecta-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--oecta-space-lg) var(--oecta-space-lg) var(--oecta-space-xs);
}


/* ── Modal ──────────────────────────────────────────────────── */

.oecta-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2,43,77,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--oecta-z-modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--oecta-duration-base) var(--oecta-ease);
}
.oecta-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.oecta-modal {
  background: var(--oecta-surface-lowest);
  border-radius: var(--oecta-radius-xl);
  box-shadow: var(--oecta-shadow-xl);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--oecta-space-2xl);
  transform: scale(0.95) translateY(8px);
  transition: transform var(--oecta-duration-base) var(--oecta-ease-spring);
}
.oecta-modal-backdrop.open .oecta-modal {
  transform: scale(1) translateY(0);
}
.oecta-modal-title {
  font-family: var(--oecta-font-display);
  font-size: var(--oecta-text-xl);
  font-weight: var(--oecta-weight-bold);
  color: var(--oecta-on-surface);
  margin-bottom: var(--oecta-space-lg);
}
.oecta-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--oecta-space-sm);
  margin-top: var(--oecta-space-xl);
}


/* ── Toast (used with Notyf — style overrides) ──────────────── */

.oecta-toast {
  font-family: var(--oecta-font-body) !important;
  border-radius: var(--oecta-radius-lg) !important;
  box-shadow: var(--oecta-shadow-lg) !important;
}


/* ── Tables ─────────────────────────────────────────────────── */

.oecta-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--oecta-font-body);
  font-size: var(--oecta-text-base);
}
.oecta-table thead th {
  font-size: var(--oecta-text-xs);
  font-weight: var(--oecta-weight-semibold);
  color: var(--oecta-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: var(--oecta-space-md) var(--oecta-space-lg);
  text-align: left;
  background: var(--oecta-surface-low);
}
.oecta-table tbody td {
  padding: var(--oecta-space-md) var(--oecta-space-lg);
  color: var(--oecta-on-surface);
  border-bottom: 1px solid var(--oecta-surface-container);
}
.oecta-table tbody tr:hover {
  background: var(--oecta-surface-low);
}


/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 768px) {
  .oecta-hero {
    padding: var(--oecta-space-2xl) var(--oecta-space-lg);
  }
  .oecta-hero-title {
    font-size: var(--oecta-text-xl);
  }
  .oecta-card {
    padding: var(--oecta-space-lg);
  }
  .oecta-modal {
    width: 95%;
    padding: var(--oecta-space-xl);
  }
}
