:root {
  color-scheme: light;
  
  /* ==========================================================================
     🎨 THEME CUSTOMIZATION / COLOR SETTINGS (대표님 컬러 변경 가이드)
     릴스 메이커의 전체 테마 컬러는 아래의 변수들을 수정하여 손쉽게 변경할 수 있습니다.
     마음에 들지 않을 경우 아래 주석 처리된 기존 웹사이트 테마 컬러로 즉시 전환할 수 있습니다.
     ========================================================================== */
     
  /* [OPTION A] 오렌지/레드 기본 테마 (현재 적용 중) */
  --accent: #e84f3d;
  --accent-dark: #b92f25;
  --paper: #f7f6f0;
  
  /* [OPTION B] 기존 웹사이트 로즈핑크 테마 (원할 시 Option A를 지우고 아래 주석을 해제하세요)
  --accent: #e6b5b5;
  --accent-dark: #8b515d;
  --paper: #fdf8f5;
  */

  --ink: #17201d;
  --muted: #65706b;
  --line: #d8ded7;
  --panel: #ffffff;
  --green: #2c7a58;
  --blue: #315d8f;
  --shadow: 0 18px 50px rgba(23, 32, 29, 0.12);

  /* Main website theme variables for navbar */
  --nav-rose: #e6b5b5;
  --nav-rose-light: #e8aab8;
  --nav-cream: #fdf8f5;
  --nav-brown: #5C3D2E;
  --nav-nav-bg: rgba(253, 248, 245, 0.85);
  --nav-card-bg: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(232, 79, 61, 0.1), transparent 34%),
    linear-gradient(220deg, rgba(49, 93, 143, 0.12), transparent 38%),
    var(--paper);
  color: var(--ink);
  font-family:
    "Pretendard",
    "Apple SD Gothic Neo",
    "Malgun Gothic",
    system-ui,
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: calc(100vh - 80px);
  margin: 0 auto;
  padding: 80px 0 32px; /* 80px top padding for fixed navbar */
  display: flex;
  align-items: center;
}

.workspace {
  width: 100%;
  min-height: min(760px, calc(100vh - 64px));
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(216, 222, 215, 0.9);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.control-panel,
.chat-panel {
  min-width: 0;
}

.control-panel {
  background: #fdfbf5;
  border-right: 1px solid var(--line);
  padding: 28px;
}

.brand-block {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.03;
}

h2 {
  font-size: 24px;
}

.brand-block p:last-child {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

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

label {
  display: grid;
  gap: 8px;
  color: #303a35;
  font-size: 14px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 79, 61, 0.16);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 10px;
  margin-top: 6px;
}

.primary-button,
.secondary-button,
.icon-button,
.quick-actions button {
  border: 0;
  border-radius: 8px;
  font-weight: 900;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.primary-button {
  height: 48px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 22px rgba(232, 79, 61, 0.24);
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover,
.quick-actions button:hover {
  transform: translateY(-1px);
}

.icon-button {
  background: #eef2ee;
  color: var(--ink);
  font-size: 22px;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--panel);
}

.chat-toolbar {
  min-height: 86px;
  padding: 24px 28px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.secondary-button {
  min-width: 104px;
  min-height: 40px;
  padding: 0 14px;
  background: #17201d;
  color: #fff;
}

.gpt-button,
.gemini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 900;
  font-size: 14px;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.gpt-button {
  background: #10a37f;
  color: #fff;
}

.gpt-button:hover {
  background: #0d8a6b;
  transform: translateY(-1px);
}

.gemini-button {
  background: #1a73e8;
  color: #fff;
}

.gemini-button:hover {
  background: #155cb8;
  transform: translateY(-1px);
}

.chat-log {
  padding: 24px 28px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.message.user {
  grid-template-columns: minmax(0, 1fr) 36px;
}

.message.user .avatar {
  grid-column: 2;
  background: var(--blue);
}

.message.user .bubble {
  grid-column: 1;
  grid-row: 1;
  background: #f2f6fb;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
}

.bubble {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.message-header {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 900;
  color: var(--green);
}

.message-body {
  color: #24312b;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.message-body strong {
  color: var(--accent-dark);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 28px 24px;
  border-top: 1px solid var(--line);
}

.quick-actions button {
  min-height: 40px;
  padding: 0 10px;
  background: #eef2ee;
  color: #1f2a25;
  white-space: nowrap;
}

.quick-actions button.active {
  background: #dff0e8;
  color: var(--green);
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100vw - 20px, 620px);
    padding: 80px 0 10px; /* 80px top padding for fixed navbar */
    align-items: start;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: calc(100vh - 20px);
  }

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 22px;
  }

  h1 {
    font-size: 34px;
  }

  .chat-toolbar,
  .chat-log,
  .quick-actions {
    padding-left: 18px;
    padding-right: 18px;
  }

  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .chat-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .toolbar-buttons {
    width: 100%;
  }

  .secondary-button,
  .gpt-button,
  .gemini-button {
    flex: 1 1 auto;
    width: 100%;
    text-align: center;
  }
}

/* ── WEBPAGE NAV BAR INTEGRATION ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10000;
  background: var(--nav-nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(201,123,139,0.12);
  padding: 12px 32px;
  display: flex; align-items: center; justify-content: center; gap: 32px;
  font-family: "Apple SD Gothic Neo","Pretendard",sans-serif;
}
.nav-logo {
  font-family: 'Playfair Display', serif;
  font-size: 20px; font-weight: 600;
  color: var(--nav-rose); letter-spacing: 0.05em;
  text-decoration: none; flex-shrink: 0;
}
.nav-links { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; justify-content: center; }
.nav-links a {
  font-size: 14px; font-weight: 500;
  color: var(--nav-brown); text-decoration: none;
  letter-spacing: 0.02em;
  padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--nav-rose); border-bottom-color: var(--nav-rose); }

/* ── DROPDOWN NAV ── */
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown-content {
  display: none; position: absolute;
  background: var(--nav-card-bg); min-width: 150px;
  box-shadow: 0 8px 24px rgba(201,123,139,0.15);
  z-index: 10000; border-radius: 12px;
  top: 100%; left: 50%; transform: translateX(-50%);
  padding: 8px 0; border: 1px solid rgba(201,123,139,0.1);
  margin-top: 4px;
}
.nav-dropdown-content::before {
  content: '';
  position: absolute;
  top: -16px;
  left: 0;
  width: 100%;
  height: 16px;
  background: transparent;
}

.nav-dropdown-content a {
  color: var(--nav-brown); padding: 10px 20px;
  text-decoration: none; display: block;
  font-size: 13px; border-bottom: none !important;
  transition: background 0.2s, color 0.2s;
}
.nav-dropdown-content a:hover {
  background: var(--nav-rose-light); color: #fff;
}
.nav-dropdown:hover .nav-dropdown-content { display: block; }
