/* Premium Admin Portal Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --dark-bg: #0f172a;
  --sidebar-bg: #1e293b;
  --card-bg: #ffffff;
  --body-bg: #f8fafc;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
}

body {
  background-color: var(--body-bg);
  color: var(--text-main);
  font-size: 14px;
  min-height: 100vh;
}

/* Auth Login Screen */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top right, #1e3a8a, #0f172a);
  padding: 20px;
}

.auth-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.auth-icon {
  font-size: 44px;
  margin-bottom: 12px;
}

.auth-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

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

/* Sidebar */
.sidebar {
  width: 250px;
  background-color: var(--sidebar-bg);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.brand-info h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.brand-info span {
  font-size: 11px;
  color: #94a3b8;
}

.sidebar-nav {
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-item.active {
  background: var(--primary);
  color: #ffffff;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-logout {
  width: 100%;
  padding: 9px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
}

.btn-logout:hover {
  background: #ef4444;
  color: white;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--body-bg);
  overflow-y: auto;
}

/* Topbar */
.topbar {
  padding: 20px 32px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-title h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--dark-bg);
}

.topbar-title p {
  font-size: 12.5px;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.server-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--success-bg);
  color: var(--success);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.btn-primary-pill {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s ease;
}

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

/* View Panes */
.view-pane {
  display: none;
  padding: 28px 32px;
}

.view-pane.active {
  display: block;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.metric-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.metric-icon.blue { background: #eff6ff; }
.metric-icon.green { background: #ecfdf5; }
.metric-icon.purple { background: #f3e8ff; }
.metric-icon.red { background: #fef2f2; }

.metric-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--dark-bg);
  display: block;
}

/* Panels */
.panel-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.max-600 { max-width: 620px; }
.max-500 { max-width: 500px; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.panel-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark-bg);
}

.panel-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.panel-header-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.search-input-wrapper {
  flex: 1;
  max-width: 380px;
}

.search-input-wrapper input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

.data-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.data-table code {
  font-family: monospace;
  font-weight: 700;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  color: #0f172a;
}

/* Status Badges */
.badge-status {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  display: inline-block;
}

.badge-status.active { background: var(--success-bg); color: var(--success); }
.badge-status.expired { background: var(--warning-bg); color: var(--warning); }
.badge-status.revoked { background: var(--danger-bg); color: var(--danger); }

/* Buttons in Table */
.action-btn-group {
  display: flex;
  gap: 4px;
}

.btn-action-sm {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #ffffff;
}

.btn-action-sm:hover {
  background: #f1f5f9;
}

.btn-action-sm.danger { color: var(--danger); }
.btn-action-sm.danger:hover { background: var(--danger-bg); border-color: var(--danger); }

.btn-action-sm.primary { color: var(--primary); }
.btn-action-sm.primary:hover { background: var(--primary-light); border-color: var(--primary); }

/* Forms */
.styled-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.form-select,
.form-select-sm,
input[type="text"],
input[type="password"],
input[type="number"] {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  outline: none;
  background: #ffffff;
}

input:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-submit,
.btn-primary-block {
  padding: 12px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-submit:hover,
.btn-primary-block:hover {
  background: var(--primary-hover);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
}

/* Generated Banner */
.generated-banner {
  margin-top: 20px;
  padding: 16px;
  background: var(--success-bg);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-md);
}

.banner-title {
  font-weight: 700;
  color: #065f46;
  font-size: 13px;
}

.key-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  background: #ffffff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #d1fae5;
}

.key-box code {
  flex: 1;
  font-family: monospace;
  font-weight: 800;
  font-size: 15px;
  color: #064e3b;
  letter-spacing: 1px;
}

.btn-copy-sm {
  background: #065f46;
  color: white;
  border: none;
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background: #ffffff;
  width: 90%;
  max-width: 400px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

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

.btn-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-footer {
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
  z-index: 2000;
}

.alert-error {
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 600;
}

.hidden { display: none !important; }
