/* CIA Redacted Theme - Classified Document Styling */

:root {
  --paper-color: #f4f1e8;
  --paper-dark: #e8e4d9;
  --ink-black: #1a1a1a;
  --ink-faded: #3d3d3d;
  --red-classified: #8b0000;
  --red-stamp: #c41e3a;
  --blue-stamp: #1e3a5f;
  --green-approved: #2d5a27;
  --yellow-highlight: #fff3cd;
  --border-color: #c9c4b5;
  --shadow-color: rgba(0, 0, 0, 0.2);
}

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

body {
  font-family: 'Courier Prime', 'Courier New', monospace;
  background-color: #2a2a2a;
  background-image: 
    radial-gradient(ellipse at center, #3a3a3a 0%, #1a1a1a 100%);
  min-height: 100vh;
  color: var(--ink-black);
  position: relative;
  overflow-x: hidden;
}

/* Scan lines effect */
.scan-lines {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.03),
    rgba(0, 0, 0, 0.03) 1px,
    transparent 1px,
    transparent 2px
  );
  z-index: 1000;
}

/* Vignette effect */
.vignette {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    transparent 0%,
    transparent 60%,
    rgba(0, 0, 0, 0.4) 100%
  );
  z-index: 999;
}

/* Classification banners */
.classified-header,
.classified-footer {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 100;
}

.classified-header {
  top: 0;
}

.classified-footer {
  bottom: 0;
}

.classification-banner {
  background: var(--red-classified);
  color: #fff;
  text-align: center;
  padding: 8px 20px;
  font-family: 'Special Elite', monospace;
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  border-bottom: 3px solid #5a0000;
}

.classification-banner.bottom {
  border-bottom: none;
  border-top: 3px solid #5a0000;
}

.blink {
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

/* Main document container */
.document-container {
  padding: 80px 20px;
  max-width: 1000px;
  margin: 0 auto;
}

.document {
  background: var(--paper-color);
  background-image: 
    url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
  border: 1px solid var(--border-color);
  box-shadow: 
    0 0 0 1px rgba(0,0,0,0.1),
    0 10px 40px var(--shadow-color),
    inset 0 0 100px rgba(0,0,0,0.03);
  position: relative;
}

/* Paper aging effects */
.document::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    linear-gradient(135deg, transparent 40%, rgba(139, 119, 101, 0.05) 100%),
    linear-gradient(-135deg, transparent 40%, rgba(139, 119, 101, 0.03) 100%);
  pointer-events: none;
}

/* Coffee stain effect */
.document::after {
  content: '';
  position: absolute;
  top: 60px;
  right: 40px;
  width: 80px;
  height: 80px;
  background: radial-gradient(
    ellipse at center,
    transparent 30%,
    rgba(139, 90, 43, 0.08) 50%,
    rgba(139, 90, 43, 0.12) 60%,
    transparent 70%
  );
  border-radius: 50%;
  transform: rotate(-15deg);
  pointer-events: none;
}

/* Document header */
.document-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 30px 40px;
  border-bottom: 2px solid var(--ink-black);
  position: relative;
}

.agency-seal {
  flex-shrink: 0;
}

.seal-outer {
  width: 100px;
  height: 100px;
  border: 3px solid var(--ink-faded);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.seal-outer::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid var(--ink-faded);
  border-radius: 50%;
}

.seal-inner {
  text-align: center;
}

.seal-text {
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  line-height: 1.3;
  color: var(--ink-faded);
  letter-spacing: 1px;
}

.document-title {
  flex-grow: 1;
  text-align: center;
  padding: 0 20px;
}

.document-title h1 {
  font-family: 'Special Elite', monospace;
  font-size: 28px;
  letter-spacing: 4px;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.subtitle {
  font-size: 12px;
  color: var(--ink-faded);
  letter-spacing: 2px;
}

.document-stamps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stamp {
  padding: 8px 15px;
  font-family: 'Special Elite', monospace;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  border: 3px solid;
  transform: rotate(-5deg);
  opacity: 0.85;
}

.stamp.approved {
  color: var(--green-approved);
  border-color: var(--green-approved);
}

.stamp.classified {
  color: var(--red-classified);
  border-color: var(--red-classified);
  transform: rotate(3deg);
}

/* Document body */
.document-body {
  padding: 30px 40px;
}

/* Sections */
.section {
  margin-bottom: 30px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border-color);
}

.section-number {
  font-family: 'Special Elite', monospace;
  font-size: 18px;
  font-weight: bold;
  color: var(--ink-faded);
}

.section-title {
  font-family: 'Special Elite', monospace;
  font-size: 16px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* Upload zone */
.upload-zone {
  border: 3px dashed var(--border-color);
  background: var(--paper-dark);
  padding: 50px 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--ink-faded);
  background: rgba(0, 0, 0, 0.03);
}

.upload-zone.drag-over {
  border-style: solid;
}

.folder-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  color: var(--ink-faded);
}

.upload-text {
  font-family: 'Special Elite', monospace;
  font-size: 18px;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.upload-subtext {
  font-size: 14px;
  color: var(--ink-faded);
  margin-bottom: 15px;
}

.upload-formats {
  font-size: 11px;
  color: var(--ink-faded);
  letter-spacing: 1px;
}

/* Preview section */
.preview-container {
  display: flex;
  align-items: stretch;
  gap: 20px;
  margin-bottom: 25px;
}

.preview-box {
  flex: 1;
  border: 2px solid var(--border-color);
  background: var(--paper-dark);
  padding: 15px;
  position: relative;
}

.preview-label {
  position: absolute;
  top: -12px;
  left: 15px;
  background: var(--paper-color);
  padding: 2px 10px;
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--ink-faded);
}

.preview-box img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 400px;
  object-fit: contain;
  background: #fff;
}

.arrow-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
}

.processing-arrow {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 24px;
  color: var(--ink-faded);
}

.processing-arrow span {
  animation: arrow-pulse 1.5s infinite;
  opacity: 0.3;
}

.processing-arrow span:nth-child(1) { animation-delay: 0s; }
.processing-arrow span:nth-child(2) { animation-delay: 0.3s; }
.processing-arrow span:nth-child(3) { animation-delay: 0.6s; }

@keyframes arrow-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

#resultContainer {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

#resultPlaceholder {
  color: var(--ink-faded);
  font-family: 'Special Elite', monospace;
  font-size: 14px;
  letter-spacing: 2px;
}

/* Processing indicator */
#processingIndicator {
  text-align: center;
  padding: 40px;
}

.processing-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: var(--ink-black);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 1s linear infinite;
}

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

#processingIndicator p {
  font-family: 'Special Elite', monospace;
  letter-spacing: 3px;
  margin-bottom: 5px;
}

.processing-sub {
  font-size: 12px;
  color: var(--ink-faded);
}

/* Action buttons */
.action-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  font-family: 'Special Elite', monospace;
  font-size: 14px;
  letter-spacing: 2px;
  padding: 15px 25px;
  border: 2px solid;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  text-transform: uppercase;
}

.btn-icon {
  font-size: 16px;
}

.btn-primary {
  background: var(--ink-black);
  color: var(--paper-color);
  border-color: var(--ink-black);
}

.btn-primary:hover {
  background: #333;
}

.btn-primary:disabled {
  background: #888;
  border-color: #888;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--green-approved);
  color: #fff;
  border-color: var(--green-approved);
}

.btn-secondary:hover {
  background: #1e4a1a;
}

.btn-tertiary {
  background: transparent;
  color: var(--ink-faded);
  border-color: var(--border-color);
}

.btn-tertiary:hover {
  background: var(--paper-dark);
  border-color: var(--ink-faded);
}

/* Info section */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.info-box {
  border: 1px solid var(--border-color);
  padding: 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.3);
}

.info-icon {
  font-size: 32px;
  margin-bottom: 15px;
}

.info-box h3 {
  font-family: 'Special Elite', monospace;
  font-size: 14px;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.info-box p {
  font-size: 13px;
  color: var(--ink-faded);
  line-height: 1.6;
}

/* Document footer */
.document-footer {
  padding: 20px 40px;
  border-top: 2px solid var(--ink-black);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.footer-text {
  font-size: 10px;
  color: var(--ink-faded);
  line-height: 1.8;
}

.case-number {
  font-family: 'Special Elite', monospace;
  letter-spacing: 2px;
}

.timestamp {
  font-size: 11px;
  color: var(--ink-faded);
}

/* Error modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-content {
  background: var(--paper-color);
  padding: 40px;
  max-width: 500px;
  text-align: center;
  border: 3px solid var(--red-classified);
}

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

.modal-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 15px;
}

.modal-header h2 {
  font-family: 'Special Elite', monospace;
  letter-spacing: 3px;
  color: var(--red-classified);
}

.modal-content p {
  margin-bottom: 25px;
  color: var(--ink-faded);
  line-height: 1.6;
}

/* Mode Toggle */
.mode-toggle {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
  justify-content: center;
}

.mode-btn {
  font-family: 'Special Elite', monospace;
  font-size: 13px;
  letter-spacing: 1px;
  padding: 12px 20px;
  border: 2px solid var(--border-color);
  background: var(--paper-dark);
  color: var(--ink-faded);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-btn:hover {
  border-color: var(--ink-faded);
}

.mode-btn.active {
  background: var(--ink-black);
  color: var(--paper-color);
  border-color: var(--ink-black);
}

.mode-icon {
  font-size: 16px;
}

/* Manual Editor */
.manual-editor {
  display: flex;
  gap: 25px;
  margin-bottom: 25px;
}

.canvas-container {
  flex: 2;
  border: 2px solid var(--border-color);
  background: var(--paper-dark);
  padding: 15px;
  position: relative;
}

#editorCanvas {
  width: 100%;
  height: auto;
  display: block;
  cursor: move;
  background: #fff;
  max-height: 500px;
  object-fit: contain;
}

.canvas-hint {
  font-size: 11px;
  color: var(--ink-faded);
  text-align: center;
  margin-top: 10px;
  letter-spacing: 1px;
}

/* Controls Panel */
.controls-panel {
  flex: 1;
  min-width: 250px;
  border: 2px solid var(--border-color);
  background: var(--paper-dark);
  padding: 20px;
}

.control-group {
  margin-bottom: 20px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-group label {
  display: block;
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--ink-faded);
  margin-bottom: 8px;
}

.control-group input[type="range"] {
  width: calc(100% - 50px);
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-color);
  border-radius: 0;
  outline: none;
  cursor: pointer;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--ink-black);
  cursor: pointer;
  border: 2px solid var(--paper-color);
}

.control-group input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--ink-black);
  cursor: pointer;
  border: 2px solid var(--paper-color);
  border-radius: 0;
}

.control-value {
  display: inline-block;
  width: 45px;
  text-align: right;
  font-family: 'Courier Prime', monospace;
  font-size: 12px;
  color: var(--ink-black);
  vertical-align: middle;
  margin-left: 5px;
}

/* Responsive design */
@media (max-width: 768px) {
  .document-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
  }

  .document-title h1 {
    font-size: 20px;
  }

  .document-stamps {
    flex-direction: row;
  }

  .preview-container {
    flex-direction: column;
  }

  .arrow-container {
    transform: rotate(90deg);
    padding: 10px 0;
  }

  .action-buttons {
    flex-direction: column;
  }

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

  .classification-banner {
    font-size: 10px;
    letter-spacing: 1px;
    padding: 6px 10px;
  }

  .mode-toggle {
    flex-direction: column;
  }

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

  .manual-editor {
    flex-direction: column;
  }

  .controls-panel {
    min-width: 100%;
  }
}

/* Typewriter cursor effect for processing */
@keyframes typewriter-cursor {
  0%, 100% { border-right-color: var(--ink-black); }
  50% { border-right-color: transparent; }
}

/* Redacted text effect */
.redacted-text {
  background: var(--ink-black);
  color: var(--ink-black);
  padding: 0 5px;
  user-select: none;
}

/* Glitch effect for loading */
@keyframes glitch {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(2px, -2px); }
}

.glitch {
  animation: glitch 0.3s infinite;
}
