/* =====================================================================
   main.css — Japanese Flowchart Description Tool
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #1a73e8;
  --primary-dark:  #1557b0;
  --bg:            #f0f2f5;
  --surface:       #ffffff;
  --border:        #dadce0;
  --text:          #202124;
  --text-sub:      #5f6368;
  --error-color:   #d93025;
  --warn-color:    #ea8600;
  --header-h:      52px;
  --footer-h:      40px;
}

/* ── Base ── */
body {
  font-family: 'Segoe UI', 'Noto Sans JP', 'Hiragino Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ── */
.header {
  height: var(--header-h);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  flex-shrink: 0;
  z-index: 10;
}

.header__title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .03em;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header__actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Buttons ── */
.btn {
  padding: 5px 14px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  white-space: nowrap;
}

.btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.btn--primary {
  background: #fff;
  color: var(--primary);
}
.btn--primary:hover { background: #e8f0fe; box-shadow: 0 1px 3px rgba(0,0,0,.2); }

.btn--secondary {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.4);
}
.btn--secondary:hover { background: rgba(255,255,255,.28); }

/* ── Main two-pane layout ── */
.main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.pane {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow: hidden;
}

.pane--editor {
  width: 38%;
  min-width: 260px;
  max-width: 600px;
  border-right: 1px solid var(--border);
  resize: horizontal;   /* ユーザーがドラッグでサイズ変更可能 */
}

.pane--preview { flex: 1; }

.pane__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #f8f9fa;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pane__title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: .6px;
}

.pane__hint {
  font-size: 11px;
  color: #bbb;
}

/* ── Code editor ── */
.editor {
  flex: 1;
  width: 100%;
  padding: 12px 14px;
  border: none;
  outline: none;
  resize: none;
  font-family: 'Consolas', 'Source Code Pro', 'Courier New', monospace;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  background: var(--surface);
  overflow-y: auto;
  tab-size: 2;
}

.editor::placeholder { color: #bbb; }

/* ── SVG Preview ── */
.preview {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 20px;
}

.preview__placeholder {
  color: var(--text-sub);
  font-size: 14px;
  margin: auto;
  text-align: center;
  line-height: 2;
}

.preview svg {
  display: block;
  max-width: 100%;
  box-shadow: 0 1px 6px rgba(0,0,0,.12);
  border-radius: 2px;
}

/* ── Footer / Error bar ── */
.footer {
  height: var(--footer-h);
  background: #f8f9fa;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 14px;
  flex-shrink: 0;
}

.errors {
  flex: 1;
  font-size: 12px;
  color: var(--text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.errors--warn  { color: var(--warn-color); }
.errors--error { color: var(--error-color); font-weight: 600; }

.footer__links {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.footer__links a {
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
}

.footer__links a:hover { text-decoration: underline; }

/* ── Responsive (narrow screens) ── */
@media (max-width: 700px) {
  .main { flex-direction: column; }

  .pane--editor {
    width: 100%;
    max-width: 100%;
    height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
    resize: vertical;
  }

  .header__title { font-size: 14px; }
  .btn { padding: 4px 10px; font-size: 12px; }
}
