/* CLOAKWELL Styling System */

/* CSS Reset & Variables */
:root {
  --bg-primary: #070c16;      /* Deepest dark Prussian navy */
  --bg-secondary: #0d1627;    /* Slate navy for card backgrounds */
  --bg-card: rgba(13, 22, 39, 0.7);
  --bg-input: #050a11;
  --border-color: rgba(114, 164, 194, 0.15);
  --border-focus: rgba(114, 164, 194, 0.5);
  
  /* Brand Blue Gradient Family (Clean -> Mild -> Sensitive) */
  --color-clean: #72a4c2;        /* Light blue */
  --color-mild: #4c86ac;         /* Medium blue */
  --color-sensitive: #134670;    /* Dark Prussian navy/blue */
  
  /* Text colors */
  --text-primary: #f0f4f8;       /* Ice white */
  --text-secondary: #9aa8b9;     /* Steel blue gray */
  --text-muted: #5e6d82;         /* Dark gray-blue */
  
  /* Functional accents */
  --color-error: #da5b6b;
  --color-error-bg: rgba(218, 91, 107, 0.1);
  --color-success: #63b392;
  --color-success-bg: rgba(99, 179, 146, 0.1);
  
  /* Font Stacks */
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-code: 'JetBrains Mono', 'Fira Code', monospace;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-ui);
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Ambient glow blobs in background */
.bg-glow {
  position: absolute;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  opacity: 0.15;
  z-index: 0;
}

.bg-glow-left {
  top: -10%;
  left: -10%;
  background: radial-gradient(circle, var(--color-sensitive) 0%, transparent 70%);
}

.bg-glow-right {
  bottom: -10%;
  right: -10%;
  background: radial-gradient(circle, var(--color-clean) 0%, transparent 70%);
}

/* App container */
.app-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  z-index: 1;
  position: relative;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* Header design */
.app-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.logo-area {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--color-clean);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 2rem;
  padding: 0.5rem 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.logo-icon {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-block;
  animation: logo-float 4s ease-in-out infinite;
  background: linear-gradient(135deg, var(--color-clean) 20%, var(--color-mild) 100%);
  -webkit-mask: url('assets/crow-imogen-oh-white.png') no-repeat center / contain;
  mask: url('assets/crow-imogen-oh-white.png') no-repeat center / contain;
}

.logo-text {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--color-clean) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 0.25rem;
}

.amd-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  background-color: rgba(19, 70, 112, 0.25);
  border: 1px solid rgba(114, 164, 194, 0.25);
  padding: 0.35rem 0.85rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-clean);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: var(--color-clean);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--color-clean);
  animation: pulse-ring 1.8s infinite;
}

/* Main layouts */
.app-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Card base and Glassmorphism styling */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem;
  transition: var(--transition-smooth);
}

.card:hover {
  border-color: rgba(114, 164, 194, 0.25);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7);
}

.card-header h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}

.card-header .description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

/* Prompt Form styling */
.prompt-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.textarea-wrapper {
  position: relative;
  border-radius: 8px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  transition: var(--transition-smooth);
}

.textarea-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(114, 164, 194, 0.15);
}

textarea {
  width: 100%;
  min-height: 120px;
  background: transparent;
  border: none;
  outline: none;
  padding: 1rem;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  resize: vertical;
}

textarea::placeholder {
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-mild) 0%, var(--color-sensitive) 100%);
  color: var(--text-primary);
  box-shadow: 0 4px 15px rgba(19, 70, 112, 0.4);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(19, 70, 112, 0.6);
  filter: brightness(1.1);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Spinner indicator */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Status/Error banner */
.status-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  animation: slide-down 0.3s ease-out;
}

.status-banner.error {
  background-color: var(--color-error-bg);
  border: 1px solid rgba(218, 91, 107, 0.3);
  color: var(--color-error);
}

.status-banner.success {
  background-color: var(--color-success-bg);
  border: 1px solid rgba(99, 179, 146, 0.3);
  color: var(--color-success);
}

/* Entities container */
.entities-section {
  animation: fade-in 0.4s ease-out;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.entity-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background-color: rgba(76, 134, 172, 0.15);
  border: 1px solid rgba(76, 134, 172, 0.3);
  color: #a0c3db;
  animation: scale-up 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.badge-count {
  background-color: rgba(255, 255, 255, 0.15);
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  font-size: 0.7rem;
}

/* Results Grid Layout (Side-by-Side) */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 1.5rem;
}

@media (max-width: 968px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
}

.panel {
  display: flex;
  flex-direction: column;
  height: 450px;
}

.panel-header {
  position: relative;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.panel-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.panel-header .description {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.badge-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.tag-sensitive {
  background-color: rgba(19, 70, 112, 0.4);
  border: 1px solid rgba(114, 164, 194, 0.3);
  color: var(--color-clean);
}

.tag-clean {
  background-color: rgba(99, 179, 146, 0.15);
  border: 1px solid rgba(99, 179, 146, 0.3);
  color: var(--color-success);
}

.panel-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Outputs text areas */
.output-text {
  flex-grow: 1;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-y: auto;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-font {
  font-family: var(--font-code);
  font-size: 0.9rem;
}

.placeholder-text {
  color: var(--text-muted);
  font-style: italic;
}

/* Redacted Placeholder Highlights */
.placeholder-highlight {
  background: rgba(114, 164, 194, 0.15);
  border: 1px solid rgba(114, 164, 194, 0.4);
  color: var(--color-clean);
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
  font-family: var(--font-code);
  display: inline-block;
  margin: 1px 0;
  text-shadow: 0 0 8px rgba(114, 164, 194, 0.3);
  letter-spacing: -0.02em;
}

/* Footer layout */
.app-footer {
  text-align: center;
  padding-top: 3rem;
  padding-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  margin-top: auto;
}

/* Skeleton Loading Animation */
.skeleton-box {
  position: relative;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.03);
  height: 1rem;
  margin-bottom: 0.75rem;
  border-radius: 4px;
}

.skeleton-box::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-100%);
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.05) 20%,
    rgba(255, 255, 255, 0.08) 60%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer 1.5s infinite;
}

/* Keyframes animations */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes logo-float {
  0% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
  100% { transform: translateY(0); }
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(114, 164, 194, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(114, 164, 194, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(114, 164, 194, 0);
  }
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scale-up {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Statistics Dashboard */
.stats-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
  width: 100%;
}

.stat-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  transition: var(--transition-smooth);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-lg);
}

.stat-info-group {
  display: flex;
  flex-direction: column;
}

.stat-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

.stat-number {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.25rem;
  line-height: 1;
}

.stat-icon {
  font-size: 2rem;
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--color-clean);
}

.stat-icon.icon-redact {
  color: var(--color-mild);
  background: rgba(76, 134, 172, 0.05);
}

.stat-icon.icon-block {
  color: var(--color-error);
  background: var(--color-error-bg);
}

/* Audit Logs Card */
.logs-card {
  margin-top: 2rem;
  padding: 1.5rem;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.logs-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.logs-header-title h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-small {
  padding: 0.5rem 0.85rem;
  font-size: 0.8rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.btn-small:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.table-wrapper {
  overflow-x: auto;
  width: 100%;
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.logs-table th, 
.logs-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.logs-table th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logs-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

.table-empty {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-muted);
  font-style: italic;
}

/* Source badge styles */
.source-pill {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.source-pill.source-ext {
  background: rgba(114, 164, 194, 0.1);
  color: var(--color-clean);
  border: 1px solid rgba(114, 164, 194, 0.2);
}

.source-pill.source-dash {
  background: rgba(76, 134, 172, 0.1);
  color: var(--color-mild);
  border: 1px solid rgba(76, 134, 172, 0.2);
}

/* Cell-specific styling */
.cell-time {
  font-family: var(--font-code);
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.cell-action {
  text-transform: capitalize;
  font-size: 0.85rem;
}

.cell-snippet {
  color: var(--text-secondary);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-entities {
  max-width: 250px;
}

/* Entity labels */
.log-entity-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  padding: 0.15rem 0.35rem;
  font-family: var(--font-code);
  font-size: 0.7rem;
  color: var(--color-clean);
  margin: 0.1rem;
}

.log-no-entities {
  color: var(--text-muted);
  font-style: italic;
}

.font-semibold {
  font-weight: 600;
}

