/* Portal Lite Shared Styles */
/* Colors derived from Kupfer-X logo: Teal (#0067a2, #4d9daf) and Copper (#c87533, #d0743b) */

:root {
  /* Portal Lite Primary - Teal from logo */
  --portal-primary: #0067a2;
  --portal-primary-dark: #005080;
  --portal-primary-light: #4d9daf;
  --portal-primary-bg: #e8f4f8;

  /* Portal Lite Accent - Copper from logo */
  --portal-accent: #c87533;
  --portal-accent-dark: #a85d28;
  --portal-accent-light: #d0743b;
  --portal-accent-bg: #fdf4ed;

  /* Neutrals */
  --portal-bg: #f8fafc;
  --portal-surface: #ffffff;
  --portal-border: #e2e8f0;
  --portal-text: #1e293b;
  --portal-text-secondary: #64748b;
  --portal-text-muted: #94a3b8;

  /* Header sizing - matching main dashboard */
  --portal-header-height: 120px;
  --portal-sidebar-width: 240px;
}

/* Portal Header - White background, matches main dashboard */
.portal-header {
  background: var(--portal-surface);
  border-bottom: 1px solid var(--portal-border);
  height: var(--portal-header-height);
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.portal-header .logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Logo sizing matching main dashboard */
.portal-header .logo img {
  height: 100px;
  width: auto;
  max-width: 200px;
}

.portal-header .logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.portal-header .brand-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--portal-primary);
  letter-spacing: -0.5px;
}

.portal-header .brand-tagline {
  font-size: 11px;
  font-weight: 400;
  color: var(--portal-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* User info in header */
.portal-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.portal-user .user-info {
  text-align: right;
}

.portal-user .user-name {
  font-weight: 600;
  color: var(--portal-text);
  font-size: 14px;
}

.portal-user .user-role {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.portal-user .user-role.admin {
  background: var(--portal-accent-bg);
  color: var(--portal-accent);
}

.portal-user .user-role.operator {
  background: var(--portal-primary-bg);
  color: var(--portal-primary);
}

.portal-user .user-role.viewer {
  background: #f1f5f9;
  color: var(--portal-text-secondary);
}

/* Logout button with teal styling */
.portal-logout-btn {
  background: var(--portal-primary);
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* Main container layout */
.portal-container {
  display: flex;
  min-height: 100vh;
  padding-top: var(--portal-header-height);
}

/* Sidebar */
.portal-sidebar {
  width: var(--portal-sidebar-width);
  background: var(--portal-surface);
  border-right: 1px solid var(--portal-border);
  padding: 20px 0;
  position: fixed;
  top: var(--portal-header-height);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.portal-sidebar-content {
  flex: 1;
}

.portal-sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--portal-border);
  text-align: center;
  margin-top: auto;
}

.portal-sidebar-footer img {
  max-width: 100px;
  height: auto;
  opacity: 0.8;
}

.portal-sidebar-footer .footer-text {
  font-size: 10px;
  color: var(--portal-text-muted);
  margin-top: 8px;
}

/* Navigation */
.portal-nav-section {
  padding: 8px 24px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--portal-text-muted);
  margin-top: 16px;
}

.portal-nav-section:first-child {
  margin-top: 0;
}

.portal-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--portal-text-secondary);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.portal-nav-item:hover {
  background: var(--portal-bg);
  color: var(--portal-text);
}

.portal-nav-item.active {
  background: var(--portal-primary-bg);
  color: var(--portal-primary);
  border-left-color: var(--portal-primary);
  font-weight: 500;
}

.portal-nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Main content area */
.portal-main {
  flex: 1;
  padding: 24px;
  background: var(--portal-bg);
  margin-left: var(--portal-sidebar-width);
  min-height: calc(100vh - var(--portal-header-height));
}

.portal-page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--portal-text);
  margin-bottom: 24px;
}

/* Stats/KPI cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--portal-surface);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--portal-border);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.stat-card .stat-icon.teal {
  background: var(--portal-primary-bg);
  color: var(--portal-primary);
}

.stat-card .stat-icon.copper {
  background: var(--portal-accent-bg);
  color: var(--portal-accent);
}

.stat-card .stat-label {
  font-size: 14px;
  color: var(--portal-text-secondary);
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--portal-text);
}

.stat-card .stat-subtext {
  font-size: 12px;
  color: var(--portal-text-muted);
  margin-top: 4px;
}

.stat-card.healthy .stat-value { color: #16a34a; }
.stat-card.warning .stat-value { color: #f59e0b; }
.stat-card.danger .stat-value { color: #dc2626; }

/* Dashboard sections */
.dashboard-section {
  background: var(--portal-surface);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--portal-border);
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--portal-text);
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Portal buttons - using teal primary and copper accent */
.portal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

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

.portal-btn-secondary {
  background: var(--portal-bg);
  color: var(--portal-text);
  border: 1px solid var(--portal-border);
}

.portal-btn-secondary:hover {
  background: #e2e8f0;
}

.portal-btn-accent {
  background: var(--portal-accent);
  color: white;
}

.portal-btn-accent:hover {
  background: var(--portal-accent-dark);
}

.portal-btn-danger {
  background: #dc2626;
  color: white;
}

.portal-btn-danger:hover {
  background: #b91c1c;
}

.portal-btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* Health status indicators */
.health-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.health-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--portal-bg);
  border-radius: 8px;
  border: 1px solid var(--portal-border);
}

.health-item .partner-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.health-item .partner-name {
  font-weight: 600;
  color: var(--portal-text);
}

.health-item .partner-bpn {
  font-size: 12px;
  color: var(--portal-text-muted);
  font-family: 'Monaco', 'Menlo', monospace;
}

.health-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.health-status.healthy {
  background: #dcfce7;
  color: #166534;
}

.health-status.degraded {
  background: #fef3c7;
  color: #92400e;
}

.health-status.unhealthy {
  background: #fee2e2;
  color: #dc2626;
}

.health-status.unknown {
  background: #f1f5f9;
  color: #64748b;
}

/* Activity feed */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--portal-bg);
  border-radius: 8px;
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.activity-icon.success { background: #dcfce7; color: #16a34a; }
.activity-icon.warning { background: #fef3c7; color: #f59e0b; }
.activity-icon.error { background: #fee2e2; color: #dc2626; }
.activity-icon.info { background: var(--portal-primary-bg); color: var(--portal-primary); }

.activity-content {
  flex: 1;
}

.activity-title {
  font-weight: 500;
  color: var(--portal-text);
  margin-bottom: 2px;
}

.activity-meta {
  font-size: 12px;
  color: var(--portal-text-muted);
}

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

.portal-table th,
.portal-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--portal-border);
}

.portal-table th {
  background: var(--portal-bg);
  font-weight: 600;
  font-size: 13px;
  color: var(--portal-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.portal-table tr:hover td {
  background: var(--portal-bg);
}

/* Forms */
.portal-form-group {
  margin-bottom: 20px;
}

.portal-form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 14px;
  color: var(--portal-text);
}

.portal-form-input,
.portal-form-select,
.portal-form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--portal-border);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.portal-form-input:focus,
.portal-form-select:focus,
.portal-form-textarea:focus {
  outline: none;
  border-color: var(--portal-primary);
  box-shadow: 0 0 0 3px var(--portal-primary-bg);
}

/* Modals */
.portal-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.portal-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.portal-modal {
  background: var(--portal-surface);
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  transform: translateY(-20px);
  transition: transform 0.2s;
}

.portal-modal-overlay.active .portal-modal {
  transform: translateY(0);
}

.portal-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--portal-border);
}

.portal-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--portal-text);
}

.portal-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--portal-text-secondary);
}

.portal-modal-close:hover {
  background: var(--portal-bg);
}

.portal-modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(90vh - 130px);
}

.portal-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--portal-border);
}

/* Badges */
.portal-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.portal-badge-teal {
  background: var(--portal-primary-bg);
  color: var(--portal-primary);
}

.portal-badge-copper {
  background: var(--portal-accent-bg);
  color: var(--portal-accent);
}

.portal-badge-success {
  background: #dcfce7;
  color: #166534;
}

.portal-badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.portal-badge-danger {
  background: #fee2e2;
  color: #dc2626;
}

/* Loading spinner */
.portal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.portal-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--portal-border);
  border-top-color: var(--portal-primary);
  border-radius: 50%;
  animation: portal-spin 1s linear infinite;
}

@keyframes portal-spin {
  to { transform: rotate(360deg); }
}

/* Empty state */
.portal-empty {
  text-align: center;
  padding: 40px;
  color: var(--portal-text-secondary);
}

/* Utility classes */
.portal-text-teal { color: var(--portal-primary); }
.portal-text-copper { color: var(--portal-accent); }
.portal-bg-teal { background: var(--portal-primary-bg); }
.portal-bg-copper { background: var(--portal-accent-bg); }

/* Notifications */
.notification-container {
  position: fixed;
  top: calc(var(--portal-header-height) + 20px);
  right: 20px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notification {
  background: var(--portal-surface);
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 250px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.notification-success {
  border-left: 4px solid #16a34a;
}

.notification-error {
  border-left: 4px solid #dc2626;
}

.notification-warning {
  border-left: 4px solid #f59e0b;
}

.notification button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--portal-text-muted);
  padding: 0;
  margin-left: auto;
}

.notification button:hover {
  color: var(--portal-text);
}

/* Error and Status Styles */
.error-text {
  color: #dc2626;
  font-size: 14px;
}

.warning-text {
  color: #f59e0b;
  font-size: 14px;
}

.success-text {
  color: #16a34a;
  font-size: 14px;
}

.muted-text {
  color: var(--portal-text-muted);
  font-size: 13px;
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  border: 2px solid var(--portal-primary-light);
  border-top-color: var(--portal-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Disabled Button */
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Session Expiry Warning */
.session-warning {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 1001;
  display: flex;
  align-items: center;
  gap: 12px;
}

.session-warning button {
  background: #f59e0b;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.session-warning button:hover {
  background: #d97706;
}

/* ============== Notification Bell ============== */

.notification-bell {
  position: relative;
}

.notification-bell-btn {
  background: transparent;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--portal-text-secondary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  position: relative;
}

.notification-bell-btn:hover {
  background: var(--portal-primary-bg);
  color: var(--portal-primary);
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  max-height: 480px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
}

.notification-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.notification-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--portal-border);
}

.notification-dropdown-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--portal-text);
}

.notification-dropdown-header button {
  background: transparent;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--portal-text-muted);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.notification-dropdown-header button:hover {
  background: var(--portal-primary-bg);
  color: var(--portal-primary);
}

.notification-list {
  flex: 1;
  overflow-y: auto;
  max-height: 360px;
}

.notification-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--portal-text-muted);
  text-align: center;
}

.notification-empty svg {
  opacity: 0.4;
  margin-bottom: 12px;
}

.notification-empty p {
  margin: 0;
  font-size: 14px;
}

.notification-item {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--portal-border);
  transition: background 0.15s;
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item:hover {
  background: #f8fafc;
}

.notification-item.unread {
  background: #f0f9ff;
}

.notification-item.unread:hover {
  background: #e0f2fe;
}

.notification-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-icon-info {
  background: #dbeafe;
  color: #2563eb;
}

.notification-icon-success {
  background: #dcfce7;
  color: #16a34a;
}

.notification-icon-warning {
  background: #fef3c7;
  color: #d97706;
}

.notification-icon-error {
  background: #fee2e2;
  color: #dc2626;
}

.notification-icon-system {
  background: #f3e8ff;
  color: #9333ea;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--portal-text);
  margin-bottom: 2px;
  line-height: 1.4;
}

.notification-message {
  font-size: 13px;
  color: var(--portal-text-secondary);
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notification-time {
  font-size: 12px;
  color: var(--portal-text-muted);
}

.notification-actions {
  display: flex;
  gap: 4px;
  align-items: flex-start;
  opacity: 0;
  transition: opacity 0.15s;
}

.notification-item:hover .notification-actions {
  opacity: 1;
}

.notification-actions button {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--portal-text-muted);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.notification-actions button:hover {
  background: var(--portal-border);
  color: var(--portal-text);
}

.notification-dropdown-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--portal-border);
  text-align: center;
}

.notification-dropdown-footer a {
  color: var(--portal-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.notification-dropdown-footer a:hover {
  text-decoration: underline;
}

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

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

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

  .portal-header .logo img {
    height: 60px;
  }
}
