/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700&family=IBM+Plex+Sans:wght@400;500;600&family=Noto+Sans+TC:wght@400;500;700&display=swap");

:root {
  --app-bg: #e9edf2;
  --app-panel: #f8fafc;
  --app-card: #ffffff;
  --app-ink: #0f172a;
  --app-muted: #526072;
  --app-line: rgba(15, 23, 42, 0.12);
  --app-accent: #f97316;
  --app-accent-strong: #ea580c;
  --app-accent-soft: rgba(249, 115, 22, 0.16);
  --app-steel: #223043;
  --app-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
  --app-radius: 16px;
  --app-radius-sm: 12px;
  --app-font-body: "IBM Plex Sans", "Noto Sans TC", sans-serif;
  --app-font-display: "Barlow Condensed", "Noto Sans TC", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--app-font-body);
  color: var(--app-ink);
  background-color: var(--app-bg);
  background-image:
    radial-gradient(1200px 600px at 10% -10%, rgba(249, 115, 22, 0.16), transparent 60%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.08), transparent 40%),
    repeating-linear-gradient(90deg, rgba(15, 23, 42, 0.06), rgba(15, 23, 42, 0.06) 1px, transparent 1px, transparent 64px),
    repeating-linear-gradient(0deg, rgba(15, 23, 42, 0.05), rgba(15, 23, 42, 0.05) 1px, transparent 1px, transparent 64px);
  background-size: auto, auto, 64px 64px, 64px 64px;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--app-accent-strong);
}

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

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  background: rgba(248, 250, 252, 0.88);
  border-bottom: 1px solid var(--app-line);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.app-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-brand {
  font-family: var(--app-font-display);
  font-size: 20px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--app-steel);
}

.app-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.app-nav__link {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px;
  letter-spacing: 0.4px;
  color: var(--app-muted);
  transition: all 0.2s ease;
}

.app-nav__link:hover {
  color: var(--app-steel);
  border-color: var(--app-line);
  background: rgba(15, 23, 42, 0.04);
}

.app-nav__link.is-active {
  color: var(--app-steel);
  background: var(--app-accent-soft);
  border-color: rgba(249, 115, 22, 0.4);
}

.app-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--app-muted);
  font-size: 14px;
}

.app-user form {
  margin: 0;
}

.app-logout.btn {
  border-radius: 999px;
  font-size: 12px;
  padding: 6px 12px;
}

.app-main {
  flex: 1;
  padding: 28px 0 64px;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.app-page {
  animation: page-in 0.45s ease both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-page__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.app-kicker {
  font-family: var(--app-font-display);
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--app-muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.page-title {
  font-family: var(--app-font-display);
  font-size: 32px;
  letter-spacing: 1px;
  margin: 0;
}

.page-subtitle {
  color: var(--app-muted);
  margin: 8px 0 0;
}

.app-card {
  background: var(--app-card);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius);
  padding: 20px;
  box-shadow: var(--app-shadow);
}

.app-card--soft {
  background: var(--app-panel);
}

.app-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.app-card__title {
  font-family: var(--app-font-display);
  font-size: 20px;
  letter-spacing: 0.6px;
  margin: 0;
}

.app-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  font-size: 12px;
  color: var(--app-muted);
}

.ai-draft__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--app-line);
}

.ai-draft__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--app-muted);
  font-size: 12px;
}

.ai-draft__body {
  padding-top: 12px;
}

.ai-draft__content {
  margin: 0;
}

.ai-draft__content p {
  margin: 0 0 12px;
}

.ai-draft__content p:last-child {
  margin-bottom: 0;
}

.ai-draft-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-draft-section {
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius);
  padding: 16px;
  background: var(--app-panel);
}

.ai-draft-section__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ai-draft-section__title {
  font-family: var(--app-font-display);
  font-size: 16px;
  letter-spacing: 0.4px;
  margin: 0;
}

.ai-draft-section__subtitle {
  color: var(--app-muted);
  font-size: 12px;
  margin: 4px 0 0;
}

.app-meta {
  color: var(--app-muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.app-inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.app-inline-list li {
  background: rgba(15, 23, 42, 0.06);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--app-muted);
}

.app-grid {
  display: grid;
  gap: 18px;
}

.app-grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.app-card--animated {
  animation: card-in 0.5s ease both;
  animation-delay: var(--delay, 0s);
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.app-list {
  display: grid;
  gap: 10px;
}

.app-list a {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.03);
  color: var(--app-steel);
  transition: all 0.2s ease;
}

.app-list a:hover {
  border-color: var(--app-line);
  background: rgba(15, 23, 42, 0.06);
}

.app-alert {
  padding: 12px 16px;
  border-radius: var(--app-radius-sm);
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.app-alert--notice {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #0f766e;
}

.app-alert--danger {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.3);
  color: #b91c1c;
}

.app-empty {
  padding: 24px;
  text-align: center;
  border-radius: var(--app-radius);
  border: 1px dashed var(--app-line);
  background: rgba(248, 250, 252, 0.8);
  color: var(--app-muted);
}

.app-form {
  display: grid;
  gap: 16px;
}

.app-form__grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-label {
  font-weight: 600;
  color: var(--app-steel);
}

.form-control,
.form-select,
textarea.form-control {
  border-radius: 12px;
  border-color: rgba(15, 23, 42, 0.18);
  background: #f9fbfd;
  padding: 10px 12px;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
  border-color: rgba(249, 115, 22, 0.6);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

.btn {
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: var(--app-accent);
  border-color: var(--app-accent);
  box-shadow: 0 10px 20px rgba(249, 115, 22, 0.24);
}

.btn-primary:hover {
  background: var(--app-accent-strong);
  border-color: var(--app-accent-strong);
  transform: translateY(-1px);
}

.btn-outline-primary {
  color: var(--app-accent-strong);
  border-color: rgba(249, 115, 22, 0.6);
}

.btn-outline-primary:hover {
  background: var(--app-accent);
  border-color: var(--app-accent);
  color: #ffffff;
}

.btn-outline-secondary {
  color: var(--app-steel);
  border-color: rgba(15, 23, 42, 0.3);
}

.table {
  margin-bottom: 0;
}

.table thead th {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.6px;
  color: var(--app-muted);
  border-bottom-color: var(--app-line);
}

.table tbody tr {
  border-color: var(--app-line);
}

.badge.text-bg-light {
  background: rgba(15, 23, 42, 0.08) !important;
  color: var(--app-steel);
  border: 1px solid rgba(15, 23, 42, 0.12);
}

.app-message {
  border: 1px solid var(--app-line);
  background: rgba(248, 250, 252, 0.9);
  border-radius: var(--app-radius-sm);
  padding: 14px 16px;
}

.app-message__meta {
  font-size: 12px;
  color: var(--app-muted);
}

.app-auth {
  max-width: 440px;
  margin: 80px auto 0;
}

@media (max-width: 768px) {
  .app-header__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-user {
    width: 100%;
    justify-content: space-between;
  }
}
