/* ===== CSS Variables ===== */
:root {
  --sidebar-width: 260px;
  --header-height: 88px;

  --color-primary: #1a3a5c;
  --color-primary-dark: #0f2744;
  --color-primary-light: #2c5282;
  --color-accent: #3182ce;
  --color-accent-hover: #4299e1;

  --color-bg: #f0f4f8;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #1a202c;
  --color-text-muted: #718096;
  --color-text-light: #a0aec0;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ===== App Layout ===== */
.app {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
}

.sidebar__brand {
  padding: 24px 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.sidebar__title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.35;
  color: #fff;
}

.sidebar__title-line {
  display: block;
}

.sidebar__desc {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.8);
}

.sidebar__nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.sidebar__notice {
  margin: 12px;
  padding: 14px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 243, 191, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.sidebar__notice-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
}

.sidebar__notice-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.88);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.9375rem;
  text-align: left;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}

.sidebar__item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 60%;
  background: var(--color-accent-hover);
  border-radius: 0 2px 2px 0;
  transition: transform var(--transition);
}

.sidebar__item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transform: translateX(2px);
}

.sidebar__item.active {
  background: rgba(49, 130, 206, 0.25);
  color: #fff;
  font-weight: 600;
}

.sidebar__item.active::before {
  transform: translateY(-50%) scaleY(1);
}

.sidebar__icon {
  font-size: 1.125rem;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar__label {
  line-height: 1.4;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 150;
  opacity: 0;
  transition: opacity var(--transition);
}

.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* ===== Main ===== */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: var(--header-height);
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.header__brand {
  flex: 1;
  min-width: 0;
  font-family: "Microsoft JhengHei", "Noto Sans TC", sans-serif;
}

.header__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  line-height: 1.35;
  margin: 0;
  font-family: inherit;
}

.header__subtitle {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 4px 0 0;
  max-width: 560px;
}

.header__menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.header__menu-btn:hover {
  background: var(--color-bg);
}

.header__menu-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
  transition: transform var(--transition), opacity var(--transition);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn__icon {
  font-size: 1rem;
}

.btn--outline {
  background: var(--color-surface);
  color: var(--color-primary);
  border: 1.5px solid var(--color-border);
}

.btn--outline:hover {
  background: var(--color-bg);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn--primary {
  background: var(--color-accent);
  color: #fff;
  border: 1.5px solid var(--color-accent);
}

.btn--primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  box-shadow: 0 2px 8px rgba(49, 130, 206, 0.35);
}

.btn--disabled,
.btn--disabled:hover,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--color-bg);
  color: var(--color-text-muted);
  border-color: var(--color-border);
  box-shadow: none;
  transform: none;
}

.btn__tag {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--color-bg);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  letter-spacing: 0.02em;
}

/* ===== Content Layout ===== */
.content {
  flex: 1;
  display: flex;
  gap: 24px;
  padding: 24px;
  align-items: flex-start;
}

.content__form {
  flex: 0 0 45%;
  min-width: 0;
}

.content__preview {
  flex: 0 0 calc(55% - 24px);
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}
