/* =========================================================
   rsa.css — RSA Cryptography project specific styles
   Inherits base from styles.css
========================================================= */

/* =========================================================
   LAYOUT — override the standard two-column card
   RSA needs more horizontal space for the crypto UI
========================================================= */
.project-card {
  grid-template-columns: 1fr 300px;
}

/* =========================================================
   INNER TABS (Crypto / Math / Keys)
========================================================= */
.rsa-toolbar {
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.inner-tab {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.35rem 0.85rem;
  transition: all 0.15s;
}
.inner-tab:first-of-type { border-radius: var(--radius) 0 0 var(--radius); }
.inner-tab:last-of-type  { border-radius: 0 var(--radius) var(--radius) 0; border-left: none; }
.inner-tab.active        { background: var(--border); color: var(--text); }
.inner-tab:hover:not(.active) { color: var(--text); }

/* =========================================================
   INNER PANELS
========================================================= */
.inner-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: visible;
  padding: 1.25rem;
  gap: 1rem;
  min-height: 0;
}
.inner-panel.active { display: flex; }

/* =========================================================
   CRYPTO PANEL — main encrypt/decrypt UI
========================================================= */
.crypto-grid {
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  gap: 0.75rem;
  flex: 1;
}

.crypto-box {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.crypto-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.crypto-label .copy-btn {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.15s;
}
.crypto-label .copy-btn:hover { color: var(--text); border-color: var(--text); opacity: 1; }

.crypto-textarea {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--inset);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem;
  border-radius: var(--radius);
  resize: none;
  height: 100px;
  line-height: 1.5;
  transition: border-color 0.15s;
}
.crypto-textarea:focus  { outline: none; border-color: var(--accent); }
.crypto-textarea.output { color: var(--accent); cursor: default; }

/* Arrow + action buttons row */
.crypto-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.action-arrow {
  font-size: 1.2rem;
  color: var(--muted);
}

/* =========================================================
   STEP LOG — shows operation steps
========================================================= */
.step-log {
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 1.8;
  min-height: 80px;
  max-height: none;
  overflow: visible;
}

.step-log .step-line { color: var(--text-soft); }
.step-log .step-line.highlight { color: var(--accent); }
.step-log .step-error { color: var(--danger); }

/* =========================================================
   MATH PANEL — explains the RSA math step by step
========================================================= */
.math-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.math-block {
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.math-block-header {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.math-block-body {
  padding: 0.85rem;
  font-size: 0.82rem;
  color: var(--text-soft);
  line-height: 1.75;
}

.math-formula {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  background: rgba(121, 183, 145, 0.16);
  border: 1px solid rgba(81, 41, 30, 0.2);
  border-radius: var(--radius);
  padding: 0.5rem 0.85rem;
  margin: 0.5rem 0;
  display: block;
}

.math-note {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted);
  margin-top: 0.4rem;
  display: block;
}

/* =========================================================
   KEYS PANEL — shows n, e, d, p, q with bit counts
========================================================= */
.keys-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.key-row {
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.key-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.key-name {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
}

.key-desc {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--muted);
}

.key-bits {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--muted);
  background: var(--border);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius);
}

.key-value {
  padding: 0.5rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-soft);
  word-break: break-all;
  line-height: 1.5;
  max-height: none;
  overflow: visible;
}

/* Key file textareas */
.key-file-box {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.key-file-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.key-file-area {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  background: var(--inset);
  border: 1px solid var(--border);
  color: var(--text-soft);
  padding: 0.6rem;
  border-radius: var(--radius);
  resize: none;
  height: 80px;
  line-height: 1.4;
}
.key-file-area:focus { outline: none; border-color: var(--accent); }

/* Status / spinner */
.rsa-status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  text-align: center;
  min-height: 1.2rem;
}
.rsa-status.ok    { color: var(--accent); }
.rsa-status.error { color: var(--danger); }
.rsa-status.busy  { color: var(--accent2); }
