/**
 * Senier AI Portal - Styles
 * Admin dashboard styling
 */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: #F8FAFC;
  color: #1E293B;
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

/* ===================================== */
/* LOGIN VIEW */
/* ===================================== */

.portal-login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3B82F6 0%, #1E3A8A 100%);
  padding: 20px;
}

.portal-login-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.portal-login-header {
  text-align: center;
  margin-bottom: 32px;
}

.portal-login-logo {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
}

.portal-login-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 8px;
}

.portal-login-header p {
  font-size: 16px;
  color: #64748B;
}

.portal-login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.portal-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.portal-form-group label {
  font-size: 14px;
  font-weight: 600;
  color: #475569;
}

.portal-form-group input {
  padding: 12px 16px;
  font-size: 15px;
  border: 2px solid #E2E8F0;
  border-radius: 8px;
  transition: all 0.2s;
}

.portal-form-group input:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.portal-login-button {
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: #3B82F6;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.portal-login-button:hover {
  background: #2563EB;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.portal-login-footer {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #E2E8F0;
  text-align: center;
}

.portal-login-footer p {
  font-size: 13px;
  color: #94A3B8;
}

/* ===================================== */
/* MAIN PORTAL VIEW */
/* ===================================== */

.portal-main-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.portal-header {
  background: white;
  border-bottom: 1px solid #E2E8F0;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

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

.portal-header-logo {
  width: 36px;
  height: 36px;
}

.portal-header-title {
  font-size: 20px;
  font-weight: 700;
  color: #1E293B;
}

.portal-header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.portal-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-user-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #3B82F6, #1E3A8A);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.portal-user-details {
  display: flex;
  flex-direction: column;
}

.portal-user-name {
  font-size: 14px;
  font-weight: 600;
  color: #1E293B;
}

.portal-user-role {
  font-size: 12px;
  color: #64748B;
}

.portal-signout-button {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #64748B;
  background: white;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.portal-signout-button:hover {
  background: #F8FAFC;
  border-color: #94A3B8;
  color: #475569;
}

/* Tab Navigation */
.portal-tabs {
  background: white;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  padding: 0 32px;
  position: sticky;
  top: 72px;
  z-index: 99;
}

.portal-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  font-size: 15px;
  font-weight: 600;
  color: #64748B;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.portal-tab:hover {
  color: #3B82F6;
  background: #F8FAFC;
}

.portal-tab.active {
  color: #3B82F6;
  border-bottom-color: #3B82F6;
}

.portal-tab-icon {
  font-size: 18px;
}

/* Content Area */
.portal-content {
  flex: 1;
  padding: 32px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.portal-dashboard {
  display: none;
}

.portal-dashboard.active {
  display: block;
}

.portal-dashboard-title {
  font-size: 28px;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 24px;
}

/* Metrics Grid */
.portal-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.portal-metric-card {
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 24px;
  transition: all 0.2s;
}

.portal-metric-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.portal-metric-card.highlight {
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  color: white;
  border: none;
}

.portal-metric-label {
  font-size: 13px;
  font-weight: 600;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.portal-metric-card.highlight .portal-metric-label {
  color: rgba(255, 255, 255, 0.9);
}

.portal-metric-value {
  font-size: 36px;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 4px;
}

.portal-metric-card.highlight .portal-metric-value {
  color: white;
}

.portal-metric-sublabel {
  font-size: 13px;
  color: #94A3B8;
}

.portal-metric-card.highlight .portal-metric-sublabel {
  color: rgba(255, 255, 255, 0.8);
}

/* Sections */
.portal-section {
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.portal-section-title {
  font-size: 18px;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #E2E8F0;
}

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

.portal-table thead {
  background: #F8FAFC;
}

.portal-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #475569;
  border-bottom: 2px solid #E2E8F0;
  white-space: nowrap;
}

.portal-table td {
  padding: 14px 16px;
  color: #1E293B;
  border-bottom: 1px solid #E2E8F0;
}

.portal-table tbody tr:hover {
  background: #F8FAFC;
}

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

/* Status Badges */
.portal-status-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
  white-space: nowrap;
}

.portal-status-badge.pending {
  background: #FEF3C7;
  color: #92400E;
}

.portal-status-badge.approved {
  background: #D1FAE5;
  color: #065F46;
}

.portal-status-badge.modified {
  background: #DBEAFE;
  color: #1E40AF;
}

.portal-status-badge.active {
  background: #D1FAE5;
  color: #065F46;
}

.portal-status-badge.healthy {
  background: #D1FAE5;
  color: #065F46;
}

.portal-status-badge.pass {
  background: #D1FAE5;
  color: #065F46;
}

.portal-status-badge.compliant {
  background: #D1FAE5;
  color: #065F46;
}

.portal-status-badge.valid {
  background: #D1FAE5;
  color: #065F46;
}

/* Confidence Score */
.portal-confidence-bar {
  width: 100px;
  height: 8px;
  background: #E2E8F0;
  border-radius: 4px;
  overflow: hidden;
}

.portal-confidence-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.portal-confidence-fill.low {
  background: #EF4444;
}

.portal-confidence-fill.medium {
  background: #F59E0B;
}

.portal-confidence-fill.high {
  background: #10B981;
}

/* Flag Counts */
.portal-flag-counts {
  display: flex;
  gap: 8px;
  align-items: center;
}

.portal-flag-badge {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  white-space: nowrap;
}

.portal-flag-badge.critical {
  background: #FEE2E2;
  color: #991B1B;
}

.portal-flag-badge.high {
  background: #FED7AA;
  color: #9A3412;
}

.portal-flag-badge.medium {
  background: #FEF3C7;
  color: #92400E;
}

.portal-flag-badge.low {
  background: #DBEAFE;
  color: #1E40AF;
}

/* Error/Risk Items */
.portal-error-list,
.portal-risk-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.portal-error-item,
.portal-risk-item {
  padding: 16px;
  background: #F8FAFC;
  border-left: 4px solid #3B82F6;
  border-radius: 6px;
}

.portal-error-item h4,
.portal-risk-item h4 {
  font-size: 15px;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 8px;
}

.portal-error-item p,
.portal-risk-item p {
  font-size: 14px;
  color: #475569;
  margin-bottom: 6px;
  line-height: 1.5;
}

.portal-error-meta,
.portal-risk-meta {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #CBD5E1;
  font-size: 13px;
  color: #64748B;
}

.portal-error-meta strong,
.portal-risk-meta strong {
  color: #1E293B;
}

/* Organization Details */
.portal-org-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.portal-org-detail-group h4 {
  font-size: 14px;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.portal-org-detail-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #F1F5F9;
  font-size: 14px;
}

.portal-org-detail-item:last-child {
  border-bottom: none;
}

.portal-org-detail-label {
  color: #64748B;
  font-weight: 500;
}

.portal-org-detail-value {
  color: #1E293B;
  font-weight: 600;
}

/* Stats Grid (for usage stats) */
.portal-stat-item {
  padding: 16px;
  background: #F8FAFC;
  border-radius: 8px;
  text-align: center;
}

.portal-stat-label {
  font-size: 12px;
  color: #64748B;
  margin-bottom: 6px;
  font-weight: 600;
}

.portal-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #1E293B;
}

/* Compliance Improvements */
.portal-compliance-improvements {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #E2E8F0;
}

.portal-compliance-improvements h4 {
  font-size: 15px;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 12px;
}

.portal-compliance-improvements ul {
  list-style: none;
}

.portal-compliance-improvements li {
  padding: 8px 12px;
  background: #F0FDF4;
  border-left: 3px solid #10B981;
  margin-bottom: 8px;
  border-radius: 4px;
  font-size: 14px;
  color: #14532D;
}

/* Trend Indicators */
.portal-trend {
  font-size: 13px;
  font-weight: 700;
}

.portal-trend.up {
  color: #10B981;
}

.portal-trend.down {
  color: #EF4444;
}

/* Responsive */
@media (max-width: 1200px) {
  .portal-content {
    padding: 24px;
  }

  .portal-metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 768px) {
  .portal-header {
    padding: 12px 16px;
  }

  .portal-tabs {
    padding: 0 16px;
    overflow-x: auto;
  }

  .portal-content {
    padding: 16px;
  }

  .portal-metrics-grid {
    grid-template-columns: 1fr;
  }

  .portal-table {
    font-size: 12px;
  }

  .portal-table th,
  .portal-table td {
    padding: 10px 12px;
  }

  .portal-org-details {
    grid-template-columns: 1fr;
  }
}
