/* ============================================================
   mint2 - diff 3D Floor Plan Generator
   Design System & Core Styles
   
   Refined Architectural Palette:
   - 明るめのコンクリートグレー基調で視認性を大幅向上
   - サイドメニューのテキストコントラスト強化
   - ページ切り替えの完全な独立制御
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
    /* Architectural Grey Palette (もう一段階明るく開放的なグレー) */
    --bg-app:        #22262c;  /* アプリ全体の最背面 */
    --bg-sidebar:    #1c1f24;  /* サイドバー背景 */
    --bg-main:       #333842;  /* メインコンテンツ背景（明るめのコンクリートグレー） */
    --bg-header:     #2b3038;  /* ヘッダー背景 */
    --bg-card:       #3e4450;  /* カード背景（明るく立体感のあるグレー） */
    --bg-card-hover: #464d5b;  /* カードホバー */
    --bg-inner:      #2b3038;  /* 枠内・入力枠背景 */
    --bg-input:      #272c34;  /* ドロップゾーン等の内部 */

    /* ボーダー（視認性向上） */
    --border-subtle: rgba(255, 255, 255, 0.10);
    --border-card:   rgba(255, 255, 255, 0.14);
    --border-strong: rgba(255, 255, 255, 0.24);

    /* テキストカラー（明度を大幅アップ） */
    --text-primary:   #f5f6f8;  /* 最も目立たせる白 */
    --text-secondary: #d4d7dd;  /* サイドメニュー・通常テキスト */
    --text-muted:     #a0a6b2;  /* 補足・説明テキスト */
    --text-dim:       #788090;  /* ラベル・プレースホルダー */

    /* アクセント（diffゴールド＆建築アクセント） */
    --accent:         #e2bc74;  /* 明るいゴールド */
    --accent-light:   #f3d89d;
    --accent-subtle:  rgba(226, 188, 116, 0.15);
    --accent-border:  rgba(226, 188, 116, 0.35);

    /* ステータス */
    --success:        #52c98a;
    --warning:        #f3b34c;
    --error:          #f26b6b;
    --info:           #68a1f7;

    /* レイアウト */
    --sidebar-width: 250px;
    --header-height: 64px;
    --border-radius: 8px;
    --border-radius-lg: 12px;

    /* トランジション */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --duration-fast: 0.15s;
    --duration-normal: 0.3s;
}

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

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-app);
    color: var(--text-secondary);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

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

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

/* ---------- Layout ---------- */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 100;
}

.sidebar-header {
    height: 72px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-logo .logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 17px;
    color: #141414;
    letter-spacing: -0.5px;
    box-shadow: 0 2px 8px rgba(226, 188, 116, 0.25);
}

.sidebar-logo .logo-text {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--text-primary);
    line-height: 1.1;
}

.sidebar-logo .logo-sub {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 2px;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
}

.nav-section {
    margin-bottom: 16px;
}

.nav-section-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #e4e8f0;
    user-select: none;
}

.nav-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.18);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--duration-fast) ease;
    position: relative;
    cursor: pointer;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--accent-light);
    font-weight: 600;
    background: var(--accent-subtle);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
    width: 19px;
    height: 19px;
    opacity: 0.8;
    flex-shrink: 0;
}

.nav-item.active .nav-icon {
    opacity: 1;
    stroke: var(--accent-light);
}

.nav-item .nav-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.nav-item.disabled {
    opacity: 0.55;
    cursor: default;
}

.nav-item.disabled:hover {
    background: none;
    color: var(--text-muted);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

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

.sidebar-footer-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-footer-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-footer-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* ---------- Main Content ---------- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-main);
}

/* Header */
.main-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    background: var(--bg-header);
}

.main-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.page-breadcrumb span {
    color: var(--text-secondary);
    font-weight: 500;
}

.main-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--duration-fast) ease;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.env-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 4px;
    background: rgba(82, 201, 138, 0.15);
    color: var(--success);
    border: 1px solid rgba(82, 201, 138, 0.3);
}

/* Page Display Switch (ページの完全な表示・非表示制御) */
.page {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.page.active {
    display: block;
}

/* ---------- Page: 3D Floor Plan Generator ---------- */

/* Hero Section */
.hero-section {
    margin-bottom: 28px;
}

.hero-header-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.hero-section h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    margin-bottom: 8px;
}

.hero-section p {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 600px;
    line-height: 1.7;
}

/* Mode Switch Tabs */
.mode-switch-tabs {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
}

.mode-tab {
    padding: 8px 18px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all var(--duration-fast) ease;
}

.mode-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.mode-tab.active {
    color: #141414;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    box-shadow: 0 2px 8px rgba(226, 188, 116, 0.3);
}

/* Prompt Textarea & Presets */
.prompt-box-wrapper {
    margin-bottom: 16px;
}

.prompt-textarea {
    width: 100%;
    background: #eef2f6;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--border-radius);
    padding: 16px 18px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: #1a1e24;
    font-weight: 500;
    resize: vertical;
    min-height: 100px;
    outline: none;
    transition: all var(--duration-fast) ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

.prompt-textarea:focus {
    background: #ffffff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle), inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.prompt-textarea::placeholder {
    color: #7b8594;
    font-weight: 400;
}

/* Target Area Selector */
.target-area-section {
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
}

.target-area-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.target-area-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.area-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) ease;
    user-select: none;
}

.area-tag:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

.area-tag.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-color: var(--accent-light);
    color: #141414;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(226, 188, 116, 0.3);
    transform: translateY(-1px);
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--border-radius);
    padding: 18px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all var(--duration-normal) var(--ease-out);
}

.stat-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.stat-unit {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 4px;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 4px;
}

.stat-change.positive {
    color: var(--success);
    background: rgba(82, 201, 138, 0.12);
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    overflow: hidden;
    transition: all var(--duration-normal) var(--ease-out);
}

.card:hover {
    border-color: var(--border-strong);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.1);
}

.card-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-header-title h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}

.card-header-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--accent-subtle);
    border: 1px solid var(--accent-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-light);
}

.card-body {
    padding: 24px;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--border-radius);
    padding: 44px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    overflow: hidden;
    background: var(--bg-input);
}

.upload-zone:hover {
    border-color: var(--accent);
    background: rgba(226, 188, 116, 0.05);
}

.upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(226, 188, 116, 0.10);
    transform: scale(1.01);
}

.upload-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--duration-normal) ease;
}

.upload-zone:hover .upload-icon {
    background: var(--accent-subtle);
    color: var(--accent-light);
    transform: translateY(-2px);
}

.upload-zone h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.upload-zone p {
    font-size: 13px;
    color: var(--text-muted);
}

.upload-zone .upload-formats {
    margin-top: 14px;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.upload-formats .format-tag {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 3px 10px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

/* Style Selector */
.style-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.style-option {
    padding: 16px 12px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-subtle);
    background: var(--bg-input);
    cursor: pointer;
    transition: all var(--duration-fast) ease;
    text-align: center;
}

.style-option:hover {
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, 0.06);
}

.style-option.selected {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.style-option .style-icon {
    font-size: 22px;
    margin-bottom: 8px;
    display: block;
}

.style-option .style-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.style-option .style-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.style-option.selected .style-name {
    color: var(--accent-light);
}

/* Before/After Comparison */
.comparison-labels {
    display: flex;
    gap: 16px;
    margin-bottom: 10px;
}

.comparison-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    flex: 1;
}

.comparison-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.comparison-box {
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
    position: relative;
    overflow: hidden;
}

.comparison-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Action Buttons */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all var(--duration-fast) ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #141414;
    box-shadow: 0 2px 12px rgba(226, 188, 116, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(226, 188, 116, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-card);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: var(--border-strong);
}

/* Progress Overlay */
.progress-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(24, 26, 29, 0.88);
    backdrop-filter: blur(6px);
    z-index: 50;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-lg);
}

.progress-overlay.active {
    display: flex;
}

.progress-content {
    text-align: center;
}

.progress-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.progress-subtext {
    font-size: 12px;
    color: var(--text-muted);
}

.progress-bar-track {
    width: 220px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 16px auto 0;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

/* ---------- Coming Soon Pages ---------- */
.coming-soon-container {
    display: flex;
    height: 60vh;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.coming-soon-content {
    max-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    padding: 48px 36px;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.coming-soon-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.coming-soon-content h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.coming-soon-content p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 24px;
}

.coming-soon-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 6px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
}

/* ---------- Scrollbar global ---------- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-track {
    background: transparent;
}
