/* App page styles — tool interface */

.app-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Nav */
.app-nav {
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  background: rgba(12, 15, 26, 0.92);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.nav-inner {
  max-width: 860px;
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--fg-primary);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-brand:hover { color: var(--accent); }

.nav-tagline {
  font-size: 0.82rem;
  color: var(--fg-muted);
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.nav-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-email {
  font-size: 0.82rem;
  color: var(--fg-muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-logout {
  font-size: 0.82rem;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: color 0.15s, border-color 0.15s;
}

.nav-logout:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Main */
.app-main {
  flex: 1;
  padding: 48px 24px 80px;
}

.app-container {
  max-width: 700px;
  margin: 0 auto;
}

/* Header */
.app-header {
  text-align: center;
  margin-bottom: 36px;
}

.app-header h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.app-header p {
  color: var(--fg-secondary);
  font-size: 1rem;
}

/* Panel */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: var(--bg-secondary);
  padding: 5px;
  border-radius: var(--radius-sm);
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--fg-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.tab:hover { color: var(--fg-secondary); }

.tab.active {
  background: var(--bg-card);
  color: var(--fg-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Tab content */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  overflow: hidden;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
}

.drop-icon {
  color: var(--fg-muted);
  opacity: 0.6;
}

.drop-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--fg-secondary);
}

.drop-hint {
  font-size: 0.85rem;
  color: var(--fg-muted);
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--bg-secondary);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  font-size: 0.78rem;
  font-family: monospace;
}

.drop-browse {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.85rem;
  text-decoration: underline;
  padding: 0;
}

.drop-zone-preview {
  width: 100%;
  height: 100%;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.drop-zone-preview img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  object-fit: contain;
}

.remove-image {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-secondary);
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.remove-image:hover {
  background: rgba(255,255,255,0.1);
  color: var(--fg-primary);
}

/* Email textarea */
.email-textarea {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.65;
  padding: 16px;
  resize: vertical;
  min-height: 180px;
  transition: border-color 0.2s;
  outline: none;
}

.email-textarea:focus {
  border-color: rgba(240, 160, 124, 0.4);
}

.email-textarea::placeholder {
  color: var(--fg-muted);
}

/* Tone selector */
.tone-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.tone-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.tone-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tone-option {
  cursor: pointer;
}

.tone-option input[type="radio"] { display: none; }

.tone-option span {
  display: block;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.85rem;
  color: var(--fg-secondary);
  transition: all 0.15s;
}

.tone-option:hover span {
  border-color: rgba(255,255,255,0.15);
  color: var(--fg-primary);
}

.tone-option input[type="radio"]:checked + span {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Generate button */
.btn-generate {
  width: 100%;
  margin-top: 24px;
  padding: 16px 24px;
  background: var(--accent);
  color: #0c0f1a;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.01em;
}

.btn-generate:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

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

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

.btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; }

/* Error */
.error-msg {
  margin-top: 14px;
  padding: 12px 16px;
  background: rgba(255, 90, 90, 0.08);
  border: 1px solid rgba(255, 90, 90, 0.2);
  border-radius: var(--radius-sm);
  color: #ff7070;
  font-size: 0.9rem;
}

/* Output panel */
.output-panel {
  border-color: rgba(240, 160, 124, 0.2);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(240, 160, 124, 0.03) 100%);
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.output-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 600;
}

.output-actions {
  display: flex;
  gap: 8px;
}

.btn-copy, .btn-regenerate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-regenerate {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
}

.btn-regenerate:hover {
  border-color: rgba(255,255,255,0.15);
  color: var(--fg-secondary);
}

.btn-copy {
  background: var(--accent-soft);
  border: 1px solid rgba(240, 160, 124, 0.25);
  color: var(--accent);
}

.btn-copy:hover {
  background: rgba(240, 160, 124, 0.2);
}

.btn-copy.copied {
  background: rgba(80, 200, 120, 0.12);
  border-color: rgba(80, 200, 120, 0.3);
  color: #5cc87a;
}

.output-body {
  font-size: 0.97rem;
  line-height: 1.75;
  color: var(--fg-primary);
  white-space: pre-wrap;
}

/* Responsive */
@media (max-width: 600px) {
  .app-main { padding: 32px 16px 60px; }
  .panel { padding: 20px; }
  .tone-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .nav-tagline { display: none; }
  .history-sidebar { width: 100%; max-width: 100%; }
  .clarify-actions { flex-direction: column; }
  .btn-clarify-skip { text-align: center; }
}
