/* ============================================================
   AI Writing Suite — Main Stylesheet
   Aesthetic: Editorial Dark / Warm Cream — Refined & Purposeful
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --aws-bg:          #0f0e0c;
  --aws-surface:     #1a1916;
  --aws-surface-2:   #242220;
  --aws-border:      #2e2c29;
  --aws-accent:      #e8c96b;
  --aws-accent-2:    #d4a853;
  --aws-text:        #f0ece3;
  --aws-text-muted:  #8a8580;
  --aws-text-dim:    #5a5751;
  --aws-success:     #6dbf8a;
  --aws-error:       #e06b6b;
  --aws-warning:     #e8a96b;
  --aws-radius:      10px;
  --aws-radius-lg:   16px;
  --aws-font-serif:  'Instrument Serif', Georgia, serif;
  --aws-font-sans:   'DM Sans', system-ui, sans-serif;
  --aws-shadow:      0 4px 24px rgba(0,0,0,.45);
  --aws-shadow-lg:   0 8px 48px rgba(0,0,0,.6);
  --aws-transition:  all .2s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ── */
.aws-wrap *, .aws-wrap *::before, .aws-wrap *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Outer Wrapper ── */
.aws-wrap {
  font-family: var(--aws-font-sans);
  background: var(--aws-bg);
  color: var(--aws-text);
  border-radius: var(--aws-radius-lg);
  overflow: hidden;
  min-height: 640px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--aws-shadow-lg);
  border: 1px solid var(--aws-border);
}

/* ── Header ── */
.aws-header {
  background: var(--aws-surface);
  border-bottom: 1px solid var(--aws-border);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.aws-logo {
  font-family: var(--aws-font-serif);
  font-size: 22px;
  color: var(--aws-accent);
  letter-spacing: -.3px;
}
.aws-logo span { color: var(--aws-text-muted); font-size: 12px; font-family: var(--aws-font-sans); font-weight: 300; margin-left: 8px; letter-spacing: .6px; text-transform: uppercase; }
.aws-header-badge {
  margin-left: auto;
  background: linear-gradient(135deg, var(--aws-accent) 0%, var(--aws-accent-2) 100%);
  color: #1a1916;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
}

/* ── Tool Nav ── */
.aws-nav {
  background: var(--aws-surface);
  border-bottom: 1px solid var(--aws-border);
  padding: 0 28px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.aws-nav::-webkit-scrollbar { display: none; }
.aws-nav-btn {
  background: none;
  border: none;
  color: var(--aws-text-muted);
  font-family: var(--aws-font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .3px;
  padding: 14px 16px;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: var(--aws-transition);
  display: flex;
  align-items: center;
  gap: 6px;
}
.aws-nav-btn:hover { color: var(--aws-text); }
.aws-nav-btn.active { color: var(--aws-accent); border-bottom-color: var(--aws-accent); }
.aws-nav-btn .nav-icon { font-size: 14px; }

/* ── Main Layout ── */
.aws-body { display: flex; flex: 1; min-height: 0; }

/* ── Tool Panel ── */
.aws-tool-panel { display: none; flex: 1; flex-direction: column; padding: 28px; gap: 20px; }
.aws-tool-panel.active { display: flex; }

/* ── Tool Options Bar ── */
.aws-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.aws-select {
  background: var(--aws-surface-2);
  border: 1px solid var(--aws-border);
  color: var(--aws-text);
  font-family: var(--aws-font-sans);
  font-size: 12px;
  padding: 7px 32px 7px 12px;
  border-radius: var(--aws-radius);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a8580' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: var(--aws-transition);
}
.aws-select:focus { outline: none; border-color: var(--aws-accent); }
.aws-select option { background: var(--aws-surface-2); }

.aws-label {
  font-size: 11px;
  color: var(--aws-text-muted);
  font-weight: 500;
  letter-spacing: .4px;
  text-transform: uppercase;
}

/* ── Editor Area ── */
.aws-editors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
}
.aws-editors.single-editor { grid-template-columns: 1fr; }
.aws-editors.result-only { grid-template-columns: 1fr 1fr; }

.aws-editor-box {
  background: var(--aws-surface);
  border: 1px solid var(--aws-border);
  border-radius: var(--aws-radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--aws-transition);
}
.aws-editor-box:focus-within { border-color: var(--aws-accent); box-shadow: 0 0 0 3px rgba(232,201,107,.07); }

.aws-editor-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--aws-border);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--aws-surface-2);
}
.aws-editor-title { font-size: 11px; color: var(--aws-text-muted); font-weight: 500; letter-spacing: .5px; text-transform: uppercase; flex: 1; }
.aws-word-count { font-size: 11px; color: var(--aws-text-dim); }

.aws-textarea {
  width: 100%;
  flex: 1;
  background: transparent;
  border: none;
  color: var(--aws-text);
  font-family: var(--aws-font-sans);
  font-size: 14px;
  line-height: 1.75;
  padding: 18px 20px;
  resize: none;
  outline: none;
  min-height: 240px;
}
.aws-textarea::placeholder { color: var(--aws-text-dim); }

.aws-output-text {
  flex: 1;
  padding: 18px 20px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--aws-text);
  overflow-y: auto;
  min-height: 240px;
  white-space: pre-wrap;
  word-break: break-word;
}
.aws-output-text.placeholder { color: var(--aws-text-dim); font-style: italic; }

.aws-editor-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--aws-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--aws-surface-2);
}

/* ── Buttons ── */
.aws-btn {
  font-family: var(--aws-font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: var(--aws-radius);
  border: none;
  cursor: pointer;
  transition: var(--aws-transition);
  letter-spacing: .2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.aws-btn-primary {
  background: linear-gradient(135deg, var(--aws-accent) 0%, var(--aws-accent-2) 100%);
  color: #1a1916;
}
.aws-btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(232,201,107,.25); }
.aws-btn-primary:active { transform: translateY(0); }
.aws-btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.aws-btn-ghost {
  background: transparent;
  border: 1px solid var(--aws-border);
  color: var(--aws-text-muted);
}
.aws-btn-ghost:hover { color: var(--aws-text); border-color: var(--aws-text-dim); background: var(--aws-surface-2); }

.aws-btn-icon {
  background: none;
  border: none;
  color: var(--aws-text-muted);
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  font-size: 15px;
  transition: var(--aws-transition);
  display: inline-flex;
}
.aws-btn-icon:hover { color: var(--aws-text); background: var(--aws-surface-2); }

/* ── Run Button Area ── */
.aws-run-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}

/* ── Loading ── */
.aws-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex: 1;
  color: var(--aws-text-muted);
  font-size: 13px;
  min-height: 160px;
}
.aws-loading.active { display: flex; }
.aws-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--aws-border);
  border-top-color: var(--aws-accent);
  border-radius: 50%;
  animation: aws-spin .8s linear infinite;
}
@keyframes aws-spin { to { transform: rotate(360deg); } }

/* ── Score / Badge ── */
.aws-score-ring {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-size: 22px;
  font-weight: 700;
  margin: 16px auto;
  border: 3px solid;
}
.aws-score-ring.human { border-color: var(--aws-success); color: var(--aws-success); }
.aws-score-ring.mixed  { border-color: var(--aws-warning); color: var(--aws-warning); }
.aws-score-ring.ai     { border-color: var(--aws-error);   color: var(--aws-error);   }

.aws-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
}
.aws-badge-success { background: rgba(109,191,138,.15); color: var(--aws-success); border: 1px solid rgba(109,191,138,.3); }
.aws-badge-warning { background: rgba(232,169,107,.15); color: var(--aws-warning); border: 1px solid rgba(232,169,107,.3); }
.aws-badge-error   { background: rgba(224,107,107,.15); color: var(--aws-error);   border: 1px solid rgba(224,107,107,.3); }

/* ── Grammar Issues ── */
.aws-issues-list { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.aws-issue-item {
  background: var(--aws-surface-2);
  border: 1px solid var(--aws-border);
  border-radius: var(--aws-radius);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.aws-issue-type { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.aws-issue-type.grammar  { color: var(--aws-error); }
.aws-issue-type.spelling { color: var(--aws-warning); }
.aws-issue-type.style    { color: #6bb8e8; }
.aws-issue-change { font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aws-issue-wrong { text-decoration: line-through; color: var(--aws-error); }
.aws-issue-right { color: var(--aws-success); font-weight: 500; }
.aws-issue-arrow { color: var(--aws-text-dim); }
.aws-issue-exp { font-size: 12px; color: var(--aws-text-muted); line-height: 1.4; }

/* ── Signals List (AI Detector) ── */
.aws-signals { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.aws-signal-item { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--aws-text-muted); }
.aws-signal-item::before { content: '•'; color: var(--aws-accent); flex-shrink: 0; margin-top: 1px; }

/* ── Citation Output ── */
.aws-citation-box {
  background: var(--aws-surface-2);
  border: 1px solid var(--aws-border);
  border-left: 3px solid var(--aws-accent);
  border-radius: var(--aws-radius);
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--aws-text);
  font-family: var(--aws-font-serif);
}

/* ── Progress Bar ── */
.aws-progress-bar { height: 4px; background: var(--aws-border); border-radius: 2px; overflow: hidden; margin: 8px 0; }
.aws-progress-fill { height: 100%; border-radius: 2px; transition: width .4s ease; }
.aws-progress-fill.human { background: var(--aws-success); }
.aws-progress-fill.mixed  { background: var(--aws-warning); }
.aws-progress-fill.ai     { background: var(--aws-error); }

/* ── Tabs within panels ── */
.aws-subtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.aws-subtab {
  background: var(--aws-surface-2);
  border: 1px solid var(--aws-border);
  border-radius: 6px;
  color: var(--aws-text-muted);
  font-family: var(--aws-font-sans);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 12px;
  cursor: pointer;
  transition: var(--aws-transition);
  letter-spacing: .3px;
}
.aws-subtab:hover { color: var(--aws-text); border-color: var(--aws-text-dim); }
.aws-subtab.active { background: var(--aws-accent); color: #1a1916; border-color: var(--aws-accent); font-weight: 600; }

/* ── Notification Toast ── */
.aws-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--aws-surface-2);
  border: 1px solid var(--aws-border);
  border-left: 3px solid var(--aws-accent);
  color: var(--aws-text);
  font-family: var(--aws-font-sans);
  font-size: 13px;
  padding: 12px 18px;
  border-radius: var(--aws-radius);
  box-shadow: var(--aws-shadow);
  z-index: 9999;
  opacity: 0;
  transform: translateY(8px);
  transition: all .25s ease;
  pointer-events: none;
}
.aws-toast.show { opacity: 1; transform: translateY(0); pointer-events: all; }

/* ── Scrollbar ── */
.aws-output-text::-webkit-scrollbar,
.aws-textarea::-webkit-scrollbar { width: 4px; }
.aws-output-text::-webkit-scrollbar-track,
.aws-textarea::-webkit-scrollbar-track { background: transparent; }
.aws-output-text::-webkit-scrollbar-thumb,
.aws-textarea::-webkit-scrollbar-thumb { background: var(--aws-border); border-radius: 2px; }

/* ── Responsive ── */
@media (max-width: 760px) {
  .aws-editors { grid-template-columns: 1fr; }
  .aws-nav { padding: 0 12px; }
  .aws-tool-panel { padding: 16px; }
}

/* ── Admin Page Styles ── */
.aws-admin-wrap { font-family: var(--aws-font-sans); }
.aws-admin-header { background: var(--aws-bg); color: var(--aws-text); padding: 28px 32px; border-radius: var(--aws-radius-lg) var(--aws-radius-lg) 0 0; display: flex; align-items: center; gap: 16px; }
.aws-admin-logo { font-family: var(--aws-font-serif); font-size: 26px; color: var(--aws-accent); }
.aws-shortcode-box { background: #f6f7f7; border: 1px solid #e0e0e0; border-radius: 8px; padding: 16px 20px; font-family: monospace; font-size: 13px; color: #333; margin: 12px 0; }
.aws-tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin: 16px 0; }
.aws-tool-card { background: #fff; border: 1px solid #e0e0e0; border-radius: var(--aws-radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.aws-tool-card-icon { font-size: 22px; }
.aws-tool-card-name { font-weight: 600; font-size: 14px; color: #1a1a1a; }
.aws-tool-card-desc { font-size: 12px; color: #666; line-height: 1.4; }
