/* PII Scanner - Notion-like UI */

:root {
  --font-sans: "Inter", sans-serif;
  --text-color: rgb(25, 25, 24);
  --bg-color: #fafafa;
  --border-color: rgba(55, 53, 47, 0.12);
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;
}

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

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--text-color);
  background-color: var(--bg-color);
  line-height: 1.55;
  min-height: 100vh;
  padding: 32px 20px;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-32) var(--space-24);
}

.app-header {
  text-align: center;
  margin-bottom: var(--space-24);
  padding: var(--space-16) var(--space-24);
  margin: calc(-1 * var(--space-32)) calc(-1 * var(--space-24)) var(--space-24);
}

.app-header__title {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--text-color);
  margin: 0;
  padding-bottom: var(--space-16);
}

.app-header__title::after {
  content: "";
  display: block;
  width: 40%;
  height: 1px;
  background: var(--border-color);
  margin: var(--space-16) auto 0;
}

.input-section {
  margin-bottom: 32px;
}

.input-card {
  background: white;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.input-wrapper {
  margin-bottom: 20px;
}

.input-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: rgba(25, 25, 24, 0.6);
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  min-height: 200px;
  padding: 16px;
  font-family: "Inter", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  color: rgb(25, 25, 24);
  background: rgba(55, 53, 47, 0.04);
  border: 0.5px solid rgba(55, 53, 47, 0.16);
  border-radius: 8px;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s ease, background 0.2s ease;
}

textarea:focus {
  border-color: #2383e2;
  background: white;
}

textarea::placeholder {
  color: rgba(25, 25, 24, 0.4);
}

.button-row {
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Inter", sans-serif;
  font-size: 16px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 50px;
  background: #000000;
  color: white;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
  background: #1a1a1a;
}

.btn-primary:active:not(:disabled) {
  background: #333333;
}

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

.btn-primary svg {
  width: 18px;
  height: 18px;
}

.hint {
  margin-top: 14px;
  font-size: 14px;
  color: rgba(25, 25, 24, 0.6);
}

.loading-state {
  text-align: center;
  padding: 48px 24px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-top: 24px;
}

.spinner-container {
  margin-bottom: 24px;
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border: 3px solid rgba(35, 131, 226, 0.2);
  border-top-color: #2383e2;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 18px;
  font-weight: 500;
}

.error-state {
  text-align: center;
  padding: 32px 24px;
  background: #fef2f2;
  border: 0.5px solid rgba(55, 53, 47, 0.16);
  border-radius: 12px;
  margin-top: 24px;
}

.error-icon {
  color: #dc2626;
  margin-bottom: 12px;
}

.error-icon svg {
  width: 40px;
  height: 40px;
}

.error-text {
  font-size: 16px;
  color: #991b1b;
  margin-bottom: 16px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  font-size: 16px;
  font-weight: 500;
  color: #2383e2;
  background: white;
  border: 0.5px solid rgba(55, 53, 47, 0.16);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background: rgba(35, 131, 226, 0.08);
}

.result-section {
  animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Summary Card */
.summary-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
}

.summary-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.summary-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.summary-icon svg {
  width: 24px;
  height: 24px;
}

.summary-icon.safe {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.summary-icon.warning {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.summary-icon.danger {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

.summary-content h3 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.005em;
  margin-bottom: 4px;
}

.summary-content p {
  font-size: 16px;
  color: rgba(25, 25, 24, 0.7);
  line-height: 1.5;
}

.summary-stats {
  display: flex;
  gap: 32px;
  padding-top: 16px;
  border-top: 1px solid rgba(55, 53, 47, 0.16);
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: rgb(25, 25, 24);
}

.stat-label {
  font-size: 13px;
  font-weight: 500;
  color: rgba(25, 25, 24, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-badge {
  display: inline-block;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
}

.stat-badge.low {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.stat-badge.medium {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.stat-badge.high {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

/* PII Details Card */
.pii-details-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(55, 53, 47, 0.16);
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: rgb(25, 25, 24);
}

.pii-list {
  padding: 12px 24px;
  max-height: 240px;
  overflow-y: auto;
}

.pii-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(55, 53, 47, 0.16);
}

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

.pii-type-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  min-width: 80px;
  text-align: center;
}

.pii-type-badge.email { background: rgba(35, 131, 226, 0.12); color: #2383e2; }
.pii-type-badge.phone { background: rgba(139, 92, 246, 0.12); color: #7c3aed; }
.pii-type-badge.ssn { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.pii-type-badge.credit_card { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.pii-type-badge.address { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.pii-type-badge.name { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.pii-type-badge.dob { background: rgba(236, 72, 153, 0.12); color: #db2777; }
.pii-type-badge.ip_address { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.pii-type-badge.default { background: rgba(55, 53, 47, 0.08); color: rgba(25, 25, 24, 0.7); }

.pii-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
  color: rgb(25, 25, 24);
  background: rgba(55, 53, 47, 0.04);
  padding: 4px 8px;
  border-radius: 4px;
  word-break: break-all;
}

/* Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.result-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(55, 53, 47, 0.16);
}

.result-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: rgb(25, 25, 24);
}

.result-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(55, 53, 47, 0.08);
  color: rgba(25, 25, 24, 0.6);
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(25, 25, 24, 0.6);
  background: transparent;
  border: 0.5px solid rgba(55, 53, 47, 0.16);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: rgba(55, 53, 47, 0.08);
  color: rgb(25, 25, 24);
}

.copy-btn.copied {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.3);
  color: #16a34a;
}

.copy-btn svg {
  width: 14px;
  height: 14px;
}

.result-content {
  padding: 20px;
  font-size: 15px;
  line-height: 1.6;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.highlighted-text {
  background: rgba(55, 53, 47, 0.02);
}

.masked-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
  background: rgba(55, 53, 47, 0.04);
}

/* PII Highlight styles */
.pii-highlight {
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 500;
}

.pii-highlight.email { background: rgba(35, 131, 226, 0.2); }
.pii-highlight.phone { background: rgba(139, 92, 246, 0.2); }
.pii-highlight.ssn { background: rgba(239, 68, 68, 0.25); }
.pii-highlight.credit_card { background: rgba(239, 68, 68, 0.25); }
.pii-highlight.address { background: rgba(245, 158, 11, 0.2); }
.pii-highlight.name { background: rgba(34, 197, 94, 0.2); }
.pii-highlight.dob { background: rgba(236, 72, 153, 0.2); }
.pii-highlight.ip_address { background: rgba(59, 130, 246, 0.2); }
.pii-highlight.default { background: rgba(55, 53, 47, 0.15); }

/* Result Actions */
.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 16px;
  font-weight: 500;
  color: rgba(25, 25, 24, 0.8);
  background: white;
  border: 0.5px solid rgba(55, 53, 47, 0.16);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(55, 53, 47, 0.08);
  border-color: rgba(55, 53, 47, 0.24);
}

.btn-secondary svg {
  width: 18px;
  height: 18px;
}

.btn-secondary.primary {
  font-family: "Inter", sans-serif;
  background: #000000;
  border-color: #000000;
  color: white;
  border-radius: 50px;
}

.btn-secondary.primary:hover {
  background: #1a1a1a;
  border-color: #1a1a1a;
}

/* Examples Section */
.examples-section {
  margin-top: 48px;
  text-align: center;
}

.examples-title {
  font-size: 14px;
  font-weight: 500;
  color: rgba(25, 25, 24, 0.5);
  margin-bottom: 16px;
}

.examples-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.example-btn {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 400;
  color: rgba(25, 25, 24, 0.7);
  background: white;
  border: 0.5px solid rgba(55, 53, 47, 0.16);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.example-btn:hover {
  background: rgba(35, 131, 226, 0.08);
  border-color: rgba(35, 131, 226, 0.3);
  color: #2383e2;
}

/* Responsive Styles */
@media (max-width: 768px) {
  body {
    padding: 24px 16px;
  }

  .container {
    padding: var(--space-24) var(--space-16);
  }

  .app-header {
    padding: var(--space-12) var(--space-16);
    margin: calc(-1 * var(--space-24)) calc(-1 * var(--space-16)) var(--space-20);
  }

  .app-header__title {
    font-size: 28px;
  }

  .input-card {
    padding: 24px;
  }

  textarea {
    font-size: 16px;
  }

  .summary-stats {
    flex-wrap: wrap;
    gap: 20px;
  }

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

  .result-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .result-content {
    font-size: 14px;
    padding: 16px;
  }

  .btn-secondary {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 32px;
  }

  .examples-grid {
    flex-direction: column;
  }

  .example-btn {
    width: 100%;
  }

  .summary-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .pii-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
