/* ==========================================
   mikanBox 管理画面 CSS (admin.css)
   ========================================== */

/* --- カラーパレット（CSS変数） --- */
:root {
    --primary: #fc0;
    --bg: #fff;
    --border: #fed7aa;
    --border-light: #cbd5e1;
    --border-faint: #e2e8f0;
    --text: #431407;
    --text-muted: #78350f;
    --text-sub: #64748b;
    --text-dark-sub: #475569;
    --text-dark: #334155;
    --bg-light: #f1f5f9;
    --bg-lighter: #f8fafc;
    --bg-page: #fafafa;
    --accent: #3b6dcb;
    --accent-light: #4e80e0;
    --blue: #3b6dcb;
    --red: #c94b4b;
    --danger: #c94b4b;
    --th-bg: #ffedd5;
    --msg-bg: #fff8cc;
    --status-draft-bg: #e2e8f0;
    --status-draft-text: #475569;
    --status-dynamic-bg: #fee2e2;
    --status-dynamic-text: #991b1b;
    --status-static-bg: #dbeafe;
    --status-static-text: #1e40af;
    --status-db-bg: #ede9fe;
    --status-db-text: #6d28d9;
    --badge-wrapper: #2d6a4f;
    --badge-parts: #1e293b;
    --footer-bg: #fff8cc;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}

/* smooth scrolling handled by JS for nav links */

/* --- ベース --- */
body {
    font-family: var(--font-sans);
    background: var(--bg-page);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.4s ease;
    overflow-x: hidden;
}

/* --- サイドナビゲーション --- */
.side-nav {
    position: fixed;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 100;
}

.side-nav-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 5px;
    padding-bottom: 15px;
    border-bottom: 1px dashed var(--border-faint);
    width: 80%;
    margin-left: auto;
    margin-right: auto;
    color: var(--text-muted);
    user-select: none;
}
.side-nav-brand .emoji {
    font-size: 1.8rem;
    line-height: 1;
}
.side-nav-brand .text {
    font-size: 0.65rem;
    font-weight: 700;
    margin-top: 5px;
    letter-spacing: 0.8px;
    opacity: 0.9;
}

.side-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    border-radius: 16px;
    text-decoration: none;
    color: var(--text-muted);
    background: #fff;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    border: 2px solid transparent;
}

.side-nav a .icon {
    font-size: 1.6rem;
    margin-bottom: 2px;
    transition: transform 0.3s ease;
}

.side-nav a span {
    font-size: 0.65rem;
    font-weight: 600;
}

.side-nav a:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

.side-nav a:hover .icon {
    transform: scale(1.1);
}

/* --- セクションごとの色分け (Active状態) --- */
.side-nav a.nav-pages.active {
    color: #3b6dcb;
    border-color: #bfdbfe;
    background: #dbeafe;
}
.side-nav a.nav-design.active {
    color: #cb7a1c;
    border-color: #fde68a;
    background: #fdf2c4;
}
.side-nav a.nav-media.active {
    color: #3e7b56;
    border-color: #cbdad0;
    background: #e1ede4;
}
.side-nav a.nav-edit {
    position: relative;
    animation: navEntrance 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: transform, opacity;
}

.side-nav a.nav-edit.closing {
    animation: navExit 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: none;
    overflow: hidden;
}

@keyframes navEntrance {
    0% { opacity: 0; transform: scale(0.6) translateY(20px); height: 0; margin-top: -15px; }
    30% { height: 68px; margin-top: 0; }
    100% { opacity: 1; transform: scale(1) translateY(0); height: 68px; margin-top: 0; }
}

@keyframes navExit {
    0% { opacity: 1; transform: scale(1); height: 68px; margin-top: 0; }
    40% { opacity: 0; transform: scale(0.3); }
    100% { opacity: 0; transform: scale(0); height: 0; margin-top: -15px; padding: 0; border-width: 0; }
}
.side-nav a.nav-edit[href*="page"].active {
    color: var(--blue);
    border-color: #c7d2fe;
    background: #dbeafe;
}
.side-nav a.nav-edit[href*="page"] .close-badge {
    border-color: #dbeafe;
}
.side-nav a.nav-edit[href*="design"].active {
    color: #d97706;
    border-color: #fde68a;
    background: #fffbeb;
}
.side-nav a.nav-edit[href*="design"] .close-badge {
    border-color: #fffbeb;
}
.side-nav .close-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--red);
    color: white;
    font-size: 10px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    line-height: 1;
    border: 1.5px solid transparent;
}
.side-nav a.nav-settings.active {
    color: var(--text-dark);
    border-color: #cbd5e1; /* Gray border */
    background: #ffffff; /* White background */
}
.page-top-links {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    padding: 8px 0 4px;
    pointer-events: none;
}
.page-top-links a {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.2s;
    pointer-events: auto;
}
.page-top-links a:hover {
    opacity: 1;
    color: var(--text-dark);
}

/* --- レスポンシブ --- */
@media (max-width: 900px) {
    .side-nav {
        top: auto;
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
        flex-direction: row;
        gap: 8px;
        background: rgba(255,255,255,0.9);
        backdrop-filter: blur(10px);
        padding: 10px;
        border-radius: 20px;
        box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    }
    .side-nav-brand {
        display: none;
    }
    .side-nav a {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        box-shadow: none;
    }
    .side-nav a .icon {
        font-size: 1.4rem;
        margin-bottom: 0;
    }
    .side-nav a span:not(.icon):not(.close-badge) {
        display: none;
    }
    .main {
        padding-bottom: 100px !important;
        padding-left: 15px !important;
    }
    /* Media upload: stack vertically on mobile */
    .flex-row.items-center {
        flex-wrap: wrap;
    }
    .flex-row.items-center input[type="file"] {
        width: 100%;
    }
    .flex-row.items-center .btn {
        width: 100%;
        justify-content: center;
    }
}

@keyframes navExitMobile {
    0% { opacity: 1; transform: scale(1); width: 48px; margin-left: 0; }
    40% { opacity: 0; transform: scale(0.3); }
    100% { opacity: 0; transform: scale(0); width: 0; margin-left: -8px; padding: 0; border-width: 0; }
}

@media (max-width: 900px) {
    .side-nav a.nav-edit.closing {
        animation: navExitMobile 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
        overflow: hidden;
    }
}

/* --- メインコンテンツ --- */
.main {
    padding: 0 15px 40px 110px;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
    background: transparent;
}

.page-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px 20px;
    margin-bottom: 20px;
}

.grid-span-1 {
    grid-column: span 1;
}

.grid-span-2 {
    grid-column: span 2;
}

.grid-span-4 {
    grid-column: span 4;
}

@media (min-width: 900px) {
    .page-edit-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}


@media (max-width: 899px) {
    .page-edit-grid {
        grid-template-columns: 1fr;
    }

    .grid-span-1,
    .grid-span-2,
    .grid-span-4 {
        grid-column: span 1;
    }
}

/* --- ヘッダー --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 5px;
    flex-wrap: wrap;
    gap: 10px;
}

.header-title-group {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.last-updated-group {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-sub);
}

.updated-label {
    margin-right: 5px;
    white-space: nowrap;
}

.last-updated-input {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    padding: 0;
    width: 140px;
    outline: none;
}

.last-updated-input:focus {
    color: var(--accent);
}

.manual-link {
    font-size: 0.75rem;
    font-weight: normal;
    color: var(--text-sub);
    text-decoration: none;
    margin-left: 10px;
    border: 1px solid var(--border-light);
    padding: 2px 6px;
    border-radius: 4px;
    background: #fff;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.manual-link:hover {
    background: var(--bg-light);
    color: var(--accent-light);
    border-color: var(--accent-light);
}

.header h1 {
    margin: 0;
    font-size: 1.8rem;
}

.section-container {
    margin-bottom: 20px;
}

/* Structure padding for Native Y=0 scrolling gaps */
.main .section-anchor {
    padding-top: 40px;
    padding-bottom: 20px;
}

/* First section matches initial load position */
.main > .section-anchor:first-child {
    padding-top: 40px;
}

/* 🍊 Sections that need large bottom spacing */
.main .section-large-bottom {
    margin-bottom: 60px; /* 🍊 Refined 60px bottom gap for lists */
}

/* 🍊 Management Block Top - Separate from Pages */
#memo.section-container {
    margin-top: 60px; /* 🍊 Unified 60px separation */
}

/* 🍊 Utility group (Memo, SSG, Settings, Backup, AI) */
.main .section-tight {
    margin-bottom: 15px; /* 🍊 Restored tight rhythm */
}

/* 🍊 Resetting header interference within tight groups */
.section-tight .section-header,
.section-tight .header,
.section-tight summary {
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 5px;
}

.section-tight .editor-container-sub {
    margin-top: 5px;
}

/* --- セクション区切りヘッダ（上書き用） --- */
.section-header-first,
.section-header {
    margin-top: 0;
    border-bottom: none;
}

/* --- ボタン --- */
.btn {
    padding: 8px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn:hover {
    filter: brightness(1.1);
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.8rem;
}

.btn-blue {
    background: var(--accent);
}

.btn-red {
    background: var(--danger);
}

.btn-gray {
    background: var(--text-sub);
}



/* --- メッセージ --- */
.msg {
    background: var(--msg-bg);
    color: var(--text-muted);
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary);
}

/* --- テーブル --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    background: #fff;
    margin-bottom: 20px;
    border: 1px solid var(--border-faint);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    min-width: 500px;
}

th,
td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

th {
    background: var(--th-bg);
    font-weight: 600;
    color: var(--text);
    font-size: 0.85rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: var(--bg-lighter);
}

td.td-narrow {
    width: 1%;
}

td.td-empty {
    text-align: center;
    color: var(--text-sub);
}

th.td-top,
td.td-top {
    vertical-align: top;
}

/* --- フォーム --- */
.form-group {
    margin-bottom: 20px;
}

.form-inline {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.form-inline label {
    margin-bottom: 0;
    white-space: nowrap;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.sub-label {
    font-weight: normal;
    color: var(--text-dark-sub);
    font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-family: monospace;
    box-sizing: border-box;
    background: #fff;
}

textarea {
    resize: vertical;
    min-height: 150px;
}

.textarea-lg {
    min-height: 450px;
}

.textarea-md {
    min-height: 400px;
}

.textarea-sm {
    min-height: 300px;
}

.textarea-xs {
    min-height: 80px;
}

.textarea-memo {
    min-height: 140px; /* 🍊 4-5 lines as requested */
    font-family: sans-serif;
    line-height: 1.6;
    padding: 15px;
}

.textarea-prompt {
    min-height: 200px;
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 15px;
    background: #fff;
    font-family: sans-serif;
    padding: 15px;
}

/* --- エディタコンテナ --- */
.editor-container {
    background: #fff;
    padding: 20px 25px 25px 25px;
    margin-bottom: 30px;
}

/* Focused Editor Styles - Floating Card Stage */
.editor-focus-bg {
    background: transparent;
    width: 100%;
    margin: 0;
    padding: 30px 0 60px 0;
}
.editor-focus-bg.spa-entering {
    animation: editorSlideIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.editor-focus-bg.spa-leaving {
    animation: editorSlideOut 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes editorSlideIn {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes editorSlideOut {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(20px); }
}

.editor-floating-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0,0,0,0.05);
    overflow: hidden;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
}

.editor-floating-card .section-header {
    padding-top: 10px;
    margin-top: 0;
}
@media (max-width: 768px) {
    .editor-focus-bg {
        padding: 20px 0;
        margin-left: -15px;
        margin-right: -15px;
    }
    .editor-floating-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* --- レイアウトユーティリティ --- */
.grid-2col,
.grid-3col,
.grid-4col {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}
.items-end { align-items: flex-end; }
.items-center { align-items: center; }

.grid-2col>.form-group,
.grid-3col>.form-group,
.grid-4col>.form-group {
    margin-bottom: 0;
}

.grid-2col {
    grid-template-columns: 1fr 1fr;
}

.grid-3col {
    grid-template-columns: 2fr 1fr 1fr;
}

.grid-4col {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
    .grid-4col {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {

    .grid-2col,
    .grid-3col,
    .grid-4col {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 15px;
    }

    .form-group {
        margin-bottom: 15px;
    }
}

/* --- ページ編集画面・専用レイアウト --- */
.status-order-box {
    align-items: center;
    border: 1px solid var(--border-light);
    padding: 0 10px;
    border-radius: 4px;
    background: #fff;
    height: 38px;
    box-sizing: border-box;
    display: flex;
    gap: 8px;
}


.flex-row {
    display: flex;
    gap: 10px;
}

.flex-row-wrap {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.inline-form {
    display: inline;
}

/* --- 独自アイコン --- */
.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    line-height: 1;
    vertical-align: -0.125em;
}

.icon svg {
    fill: currentColor;
    width: 100%;
    height: 100%;
}

.status-select-inline {
    border: none;
    background: transparent;
    font-size: 0.8rem;
    padding: 2px 5px;
    border-radius: 4px;
    cursor: pointer;
    width: auto;
}

.status-select-inline.static {
    background: var(--status-static-bg);
    color: var(--status-static-text);
}

.status-select-inline.dynamic {
    background: var(--status-dynamic-bg);
    color: var(--status-dynamic-text);
}

.status-select-inline.draft {
    background: var(--status-draft-bg);
    color: var(--status-draft-text);
}
.status-select-inline.db {
    background: var(--status-db-bg);
    color: var(--status-db-text);
}

.title-link {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    text-decoration: none;
}

.title-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.hint-box {
    padding: 24px;
    background: #f1f5fb;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    margin-top: 30px;
    line-height: 1.6;
}

/* 🍊 Logic over Force: Define each child to achieve uniform size */
.hint-box,
.hint-box p,
.hint-box span,
.hint-box strong,
.hint-box code,
.hint-box div {
    font-size: 0.8rem;
}

.hint-box h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.0rem;
    color: var(--text-dark);
}

.hint-grid {
    display: grid;
    gap: 20px;
}

.hint-list {
    margin: 5px 0 0 0;
    padding: 0;
    list-style: none;
    line-height: 1.6;
}

.hint-list code {
    background: #fff;
    border: 1px solid #e1e4e8;
    padding: 1px 4px;
    border-radius: 3px;
    font-family: var(--font-mono);
    color: var(--blue);
}

.hint-list strong,
.hint-list span:not(.hint-desc):not(.hint-section-label) {
    display: block;
    margin-bottom: 5px;
    color: var(--text-dark-sub);
    font-size: 0.85rem; /* 🍊 Standardized text size inside hints */
}

.status-selector-group {
    display: flex;
    gap: 10px;
}

.radio-label {
    padding: 10px 15px;
    border: 1px solid var(--border-light);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.radio-label input {
    margin: 0;
}

.radio-label:hover {
    background: var(--bg-lighter);
}

.radio-label.active.draft {
    background: var(--status-draft-bg);
    color: var(--status-draft-text);
    border-color: var(--status-draft-text);
}

.radio-label.active.dynamic {
    background: var(--status-dynamic-bg);
    color: var(--status-dynamic-text);
    border-color: var(--status-dynamic-text);
}

.radio-label.active.static {
    background: var(--status-static-bg);
    color: var(--status-static-text);
    border-color: var(--status-static-text);
}
.radio-label.active.db {
    background: var(--status-db-bg);
    color: var(--status-db-text);
    border-color: var(--status-db-text);
}

/* --- メディアグリッド・カード --- */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.media-card {
    background: #fff;
    border: 1px solid var(--border-faint);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.media-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.media-card-thumb {
    aspect-ratio: 16 / 10;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border-faint);
}

.media-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.media-card-icon {
    font-size: 2.5rem;
    color: var(--text-sub);
    opacity: 0.5;
}

.media-card-body {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.media-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    word-break: break-all;
    cursor: pointer;
    color: var(--text);
}

.media-card-title:hover {
    color: var(--accent);
}

.media-card-meta {
    font-size: 0.75rem;
    color: var(--text-sub);
}

.copy-input {
    font-size: 0.8rem;
    padding: 5px 8px;
    border: 1px solid var(--border-faint);
    background: var(--bg-lighter);
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
}

.copy-input:focus {
    background: #fff;
    outline: none;
    border-color: var(--accent-light);
}

.btn-red-text {
    color: var(--danger);
    background: transparent;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
}

.resize-details summary {
    outline: none;
    list-style: none;
}
.resize-details summary::-webkit-details-marker {
    display: none;
}

.section-accordion summary {
    list-style: none; /* Hide standard arrow */
}
.section-accordion summary::-webkit-details-marker {
    display: none; /* Hide standard arrow in Chrome/Safari */
}
.section-accordion summary h2:hover {
    color: var(--accent);
}

/* --- ドロップゾーン (Drag & Drop Upload) --- */
#drop-zone {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 204, 0, 0.9);
    display: none; /* 🍊 Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 5000;
    font-size: 2rem;
    color: #431407;
    font-weight: bold;
    flex-direction: column;
    gap: 20px;
    border: 10px dashed rgba(67, 20, 7, 0.2);
    pointer-events: none;
    transition: all 0.2s;
}

#drop-zone.active {
    display: flex; /* 🍊 Show only when dragging over */
}

#drop-zone .icon {
    font-size: 5rem;
    display: block;
    margin-bottom: 20px;
}

/* ==========================================
   Utility Classes (inline style replacements)
   ========================================== */

/* --- Text Utilities --- */
.text-sub        { font-size: 0.8rem; color: var(--text-sub); }
.text-sub-sm     { font-size: 0.85rem; color: var(--text-sub); }
.text-sub-xs     { font-size: 0.75rem; color: var(--text-sub); }
.text-center     { text-align: center; }
.text-muted-link { color: var(--text-sub); text-decoration: none; }
.text-muted-link:hover { color: var(--accent); }

/* --- Layout Utilities --- */
.gap-5           { gap: 5px; }
.gap-10          { gap: 10px; }
.gap-20          { gap: 20px; }
.mt-0            { margin-top: 0; }
.mt-5            { margin-top: 5px; }
.mt-10           { margin-top: 10px; }
.mt-15           { margin-top: 15px; }
.mt-25           { margin-top: 25px; }
.mt-30           { margin-top: 30px; }
.mb-0            { margin-bottom: 0; }
.mb-10           { margin-bottom: 10px; }
.mb-15           { margin-bottom: 15px; }

/* --- Flex Utilities --- */
.flex-between    { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap       { flex-wrap: wrap; }
.self-end        { align-self: flex-end; }
.inline          { display: inline; }

/* --- Form Utilities --- */
.input-height    { height: 38px; }
.input-full      { width: 100%; height: 38px; }
.input-compact   { width: 150px; }
.select-auto     { width: auto; }
.no-margin       { margin: 0; }

/* --- Editor Card Header (inside floating card) --- */
.editor-card-header {
    border: none;
    padding: 20px 25px 0 25px;
}

/* --- Editor Container (transparent, inside floating card) --- */
.editor-container-transparent {
    box-shadow: none;
    border: none;
    background: transparent;
    border-radius: 0;
}

/* --- Accordion Summary Header --- */
.accordion-summary {
    cursor: pointer;
    outline: none;
    list-style: none;
}

/* --- Accordion Section Title (h2) --- */
.accordion-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 1.2rem;
}

/* --- Accordion Arrow Indicator --- */
.accordion-arrow {
    font-size: 0.8rem;
    opacity: 0.5;
}

/* --- Section Sub Title (smaller headings) --- */
.section-sub-title {
    font-size: 1.2rem;
    margin: 0;
}

/* --- Section Divider Header (e.g. password change) --- */
.section-divider {
    margin-top: 30px;
    padding-bottom: 5px;
}

/* --- Sub Text Block --- */
.sub-text-block  { display: block; margin-top: 5px; }
.sub-text-intro  { display: block; margin-bottom: 15px; }
.sub-text-hint   { display: block; margin-top: 10px; }
.sub-text-indent { display: block; margin-left: 24px; margin-top: 4px; }

/* --- Checkbox Label --- */
.checkbox-flex {
    height: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Textarea Variants --- */
.textarea-mono       { font-family: var(--font-mono); }
.textarea-description { height: 60px; min-height: 60px; padding: 10px; font-family: sans-serif; }
.textarea-prompt      { font-family: var(--font-mono); height: 180px; background: #f9f9fb; margin-bottom: 15px; }
.textarea-min-80      { min-height: 80px; }

/* --- Topbar Brand --- */
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: sans-serif;
    font-size: 1.8rem;
    position: relative;
    top: 0;
}
.topbar-brand-emoji { font-size: 0.9em; line-height: 1; position: relative; top: 1px; }
.topbar-brand-version {
    font-size: 0.7rem;
    font-weight: normal;
    opacity: 0.8;
    margin-left: 4px;
    position: relative;
    top: 5px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}



/* --- Hint Grid Variants --- */
.hint-grid-wide   { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.hint-grid-narrow { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.hint-grid-md3    { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hint-grid-md4    { grid-template-columns: 2fr 2fr 2.5fr 2fr; gap: 12px; }
.hint-grid-tag    { grid-template-columns: 3fr 3.5fr 3.5fr; gap: 16px; }

@media (max-width: 900px) {
    .hint-grid-md4,
    .hint-grid-tag {
        grid-template-columns: 1fr;
    }
}
.hint-list-sm     { font-size: 0.75rem; }
.hint-note        { list-style: none; margin-top: 8px; opacity: 0.8; font-size: 0.72rem; line-height: 1.4; }
.hint-desc        { display: inline; font-size: 0.7rem; color: var(--text-sub); }
.hint-pre         { margin: 2px 0 4px; padding: 4px 6px; background: var(--bg-code, #f4f4f4); border-radius: 4px; font-size: 0.72rem; line-height: 1.5; white-space: pre-wrap; }
.hint-section-label { display: inline; font-size: 0.7rem; color: var(--text-dark-sub); font-weight: 600; }

/* --- Collapsible Hint Accordion --- */
.hint-accordion {
    background: #f1f5fb;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    margin-top: 20px;
    line-height: 1.6;
    font-size: 0.8rem;
}
.hint-accordion > summary {
    padding: 12px 20px;
    cursor: pointer;
    outline: none;
    list-style: none;
    user-select: none;
}
.hint-accordion > summary::-webkit-details-marker { display: none; }
.hint-accordion .accordion-title {
    margin: 0;
    font-size: 1.0rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.hint-accordion-body {
    padding: 4px 20px 16px;
}
.hint-accordion-body strong {
    display: block;
    font-size: 0.78rem;
    color: var(--text-dark-sub);
    margin-bottom: 4px;
}
.hint-accordion .hint-list code {
    white-space: nowrap;
}

/* --- Tag Guide Helper Hint (small gray) --- */
.hint-subtle {
    font-weight: normal;
    opacity: 0.7;
}

/* --- Media Card Utilities --- */
.media-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.media-meta-label {
    margin: 0;
    font-size: 0.75rem;
    opacity: 0.7;
}
.media-action-border {
    margin-top: 0;
    padding-top: 4px;
    border-top: 1px dashed var(--border-faint);
}
.media-delete-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--red);
    background: transparent;
    border: none;
    font-size: 0.75rem;
    padding: 0;
    font-weight: 500;
    cursor: pointer;
}
.media-delete-btn:hover { opacity: 0.8; }

/* --- Resize Input Group --- */
.resize-input-group {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1px solid var(--border-faint);
    padding: 2px 6px;
    border-radius: 4px;
}
.resize-input {
    width: 50px;
    border: none;
    font-size: 0.8rem;
    outline: none;
    padding: 4px 0;
}
.resize-separator { opacity: 0.3; }
.resize-form {
    margin-top: 5px;
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
}
.resize-submit {
    padding: 4px 10px;
    border-radius: 4px;
    transform: scale(0.9);
}
.resize-summary {
    cursor: pointer;
    color: var(--blue);
    opacity: 0.8;
    padding: 2px 0;
    display: inline-block;
    font-size: 0.75rem;
}
.resize-arrow { font-size: 0.7rem; margin-right: 2px; }

/* --- Upload Info --- */
.upload-info {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--text-sub);
    line-height: 1.6;
}

/* --- Media Hints (transparent hint box) --- */
.media-hints {
    margin-top: 10px;
    margin-bottom: 20px;
    background: transparent;
    padding: 0;
}
.media-hints-list {
    font-size: 0.85rem;
    color: var(--text-dark-sub);
    line-height: 1.6;
    list-style: none;
    padding: 0;
}

/* --- SSG Build Row (bottom of page list) --- */
.ssg-build-row {
    margin-top: -5px;
}
.ssg-build-row.has-editor {
    margin-bottom: 0px;
}
.ssg-build-row.no-editor {
    margin-bottom: 60px;
}

/* --- Type Badge (Design Component List) --- */
.comp-id-link { text-decoration: none; }
.type-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #dde3ea;
    color: var(--badge-parts);
    border: 1px solid #c4cdd6;
}
.type-badge.wrapper {
    background: #c9e8d7;
    color: var(--badge-wrapper);
    border-color: #a8d4be;
}

/* --- ログイン画面 --- */
.login-body {
    background: #fff8cc; /* Soft yellow/orange bg */
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 0;
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-title {
    font-size: 2.2rem;
    font-family: sans-serif;
    color: var(--text);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-box p {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 25px;
}

.login-box form input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 20px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: all 0.2s;
}

.login-box form input[type="password"]:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-box button {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.login-box button:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.login-box .error {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.login-hint {
    text-align: center;
    font-size: 0.82rem;
    color: #999;
    margin-top: 25px;
    line-height: 1.6;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 20px 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
footer a { color: inherit; text-decoration: none; }