/* ==========================================================================
   ENTERPRISE LOGS PORTAL DESIGN SYSTEM
   ========================================================================== */

:root {
  /* Color Palette - Slate & Cyan High Contrast Enterprise Theme */
  --bg-darkest: #050811;
  --bg-dark: #0a0f1d;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-sidebar: #070c18;
  --bg-input: #0f172a;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #38bdf8;
  --border-hover: rgba(255, 255, 255, 0.16);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #38bdf8;
  --accent-blue: #2563eb;
  --accent-indigo: #6366f1;

  --status-green: #10b981;
  --status-green-bg: rgba(16, 185, 129, 0.12);
  --status-yellow: #f59e0b;
  --status-red: #ef4444;
  --status-red-bg: rgba(239, 68, 68, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.15);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Reset & Global Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-darkest);
  background-image: 
    radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(56, 189, 248, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Typography Utilities */
.accent-text {
  color: var(--accent-cyan);
}

.text-muted {
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* Form Controls & Buttons */
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

input[readonly] {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: rgba(15, 23, 42, 0.4);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-indigo) 100%);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.primary-btn:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.primary-btn.full-width {
  width: 100%;
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.secondary-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
}

.secondary-btn.small {
  padding: 5px 10px;
  font-size: 12px;
}

.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  background-color: var(--status-red-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  color: #fca5a5;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.danger-btn:hover {
  background-color: rgba(239, 68, 68, 0.25);
}

.text-btn {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 4px;
}

.text-btn:hover {
  text-decoration: underline;
}

/* ==========================================================================
   AUTHENTICATION VIEW (LOGIN CARD)
   ========================================================================== */

.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.logo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(37, 99, 235, 0.2));
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  color: var(--accent-cyan);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
  display: block;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.portal-selector {
  display: flex;
  gap: 6px;
  padding: 4px;
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.portal-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.portal-tab:hover {
  color: var(--text-main);
}

.portal-tab.active {
  background-color: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.auth-header {
  margin-bottom: 20px;
}

.auth-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

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

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

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  pointer-events: none;
}

.input-wrapper input {
  padding-left: 38px;
}

.toast-message {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
}

.toast-message.error {
  background-color: var(--status-red-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.toast-message.success {
  background-color: var(--status-green-bg);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

/* ==========================================================================
   ENTERPRISE DASHBOARD LAYOUT & SIDEBAR
   ========================================================================== */

.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  flex-shrink: 0;
}

.sidebar-header {
  margin-bottom: 24px;
  padding: 0 8px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.05em;
}

.brand-logo svg {
  color: var(--accent-cyan);
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 14px;
  color: white;
}

.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.user-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.role-pill.developer {
  background-color: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
}

.role-pill.devops {
  background-color: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.sidebar-nav {
  flex: 1;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  padding: 0 8px;
  margin-bottom: 8px;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.nav-link:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.04);
}

.nav-link.active {
  color: var(--text-main);
  background-color: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.nav-link.active svg {
  color: var(--accent-cyan);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background-color: var(--status-red-bg);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* Main Dashboard Container */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px 32px 16px;
  border-bottom: 1px solid var(--border-color);
}

.section-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent-cyan);
  display: block;
  margin-bottom: 4px;
}

.top-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

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

.system-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background-color: var(--status-green-bg);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: #34d399;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--status-green);
  border-radius: var(--radius-full);
  box-shadow: 0 0 8px var(--status-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.content-body {
  padding: 24px 32px;
  flex: 1;
}

/* ==========================================================================
   APPLICATIONS CATALOG TAB
   ========================================================================== */

.apps-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
}

.search-input-wrapper svg {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-input-wrapper input {
  padding-left: 40px;
}

.counter-badge {
  padding: 6px 12px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-muted);
}

.app-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.app-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
  box-shadow: var(--shadow-glow);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.app-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background-color: rgba(56, 189, 248, 0.1);
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
}

.status-badge {
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.running {
  background-color: var(--status-green-bg);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.checking {
  background-color: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge.inactive {
  background-color: var(--status-red-bg);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.app-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.app-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  flex: 1;
}

.card-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.view-logs-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
}

.empty-state {
  padding: 40px;
  text-align: center;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  background-color: rgba(15, 23, 42, 0.3);
}

/* ==========================================================================
   DEVOPS MANAGEMENT & TABLES
   ========================================================================== */

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.section-card.margin-top {
  margin-top: 24px;
}

.section-card.max-width-600 {
  max-width: 600px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.header-with-icon {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background-color: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  color: var(--accent-cyan);
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
}

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

.devops-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.app-picker-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.picker-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.divider {
  color: var(--text-dim);
  font-size: 12px;
}

.app-picker-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.picker-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.picker-chip:hover {
  border-color: var(--border-hover);
  color: var(--text-main);
}

.picker-chip.active {
  background-color: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  color: var(--text-main);
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-dim);
}

.picker-chip.active .chip-dot {
  background-color: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-cyan);
}

/* Developer Directory Table */
.dev-table {
  width: 100%;
  border-collapse: collapse;
}

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

.dev-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tags-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.app-tag {
  display: inline-block;
  padding: 2px 8px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--accent-cyan);
}

.action-buttons {
  display: flex;
  gap: 8px;
}

/* Security Section Form */
.security-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==========================================================================
   HIGH-TECH TERMINAL VIEW (LOGS PAGE)
   ========================================================================== */

.terminal-body {
  background-color: #02040a;
  color: #e2e8f0;
  font-family: var(--font-mono);
}

.terminal-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 16px;
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: #0b1120;
  border: 1px solid #1e293b;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.terminal-title-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.terminal-status-dot {
  width: 10px;
  height: 10px;
  background-color: var(--status-green);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--status-green);
}

.terminal-header h2 {
  font-size: 15px;
  font-weight: 600;
}

.terminal-subtitle {
  font-size: 12px;
  color: var(--text-dim);
}

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

.terminal-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.terminal-search-box svg {
  position: absolute;
  left: 10px;
  color: var(--text-dim);
}

.terminal-search-box input {
  padding: 6px 12px 6px 30px;
  background-color: #020617;
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 12px;
}

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

.terminal-btn {
  padding: 6px 12px;
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  color: #f8fafc;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

.terminal-btn.primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  border: none;
}

.terminal-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #020617;
  border: 1px solid #1e293b;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.terminal-toolbar {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px;
  background-color: #0b1120;
  border-bottom: 1px solid #1e293b;
  font-size: 11px;
  color: var(--text-dim);
}

.terminal-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
}

.log-entry {
  display: flex;
  gap: 12px;
  padding: 2px 0;
  word-break: break-all;
}

.log-entry.hidden-log {
  display: none !important;
}

.log-time {
  color: #64748b;
  user-select: none;
  flex-shrink: 0;
}

.log-text {
  color: #e2e8f0;
}

.log-entry.info .log-text { color: #f8fafc; }
.log-entry.warn .log-text { color: #fde68a; }
.log-entry.error .log-text { color: #fca5a5; }
.log-entry.system .log-text { color: var(--accent-cyan); font-weight: 500; }
.log-entry.success .log-text { color: #34d399; font-weight: 500; }

/* Responsive adjustments */
@media (max-width: 860px) {
  .dashboard-wrapper {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .top-header {
    flex-direction: column;
    gap: 12px;
  }
}
