/**
 * layout.css - レイアウト（ヘッダー、ナビ、メインコンテンツ）
 */

/* ==================== ヘッダー ==================== */

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 8px 12px;
    gap: 8px;
}

/* 言語セレクター */
.language-select {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 0.75rem;
    cursor: pointer;
    outline: none;
    transition: background 0.2s;
    max-width: 100px;
    flex-shrink: 0;
}

.language-select:hover {
    background: rgba(255, 255, 255, 0.3);
}

.language-select:focus {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.5);
}

.language-select option {
    background: var(--primary-color);
    color: white;
}

.app-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.app-logo {
    height: 54px;
}

/* ==================== メインコンテンツ ==================== */

.app-main {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-sm) var(--spacing-md);
}

/* 管理画面の時だけpaddingを削除 */
#manage-screen.active ~ .app-main,
.app-main:has(#manage-screen.active) {
    padding: 0;
}

.screen {
    display: none;
    max-width: 800px;
    margin: 0 auto;
}

.screen.active {
    display: block;
}

.screen h2 {
    margin-bottom: var(--spacing-lg);
    font-size: 1.4rem;
    color: var(--text-color);
}

/* 学習フェーズ中のスクロール制御 */
.app-main.no-scroll {
    overflow: hidden !important;
}

/* ==================== ナビゲーション ==================== */

.app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--card-bg);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border-color);
    z-index: 100;
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-btn.active {
    color: var(--primary-color);
}

.nav-icon {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.nav-label {
    font-weight: 500;
}

/* ==================== PWA用調整 ==================== */

/* iOS SafeArea対応 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .app-nav {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(var(--nav-height) + env(safe-area-inset-bottom));
    }

    body {
        padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
    }

    .integrated-learn-actions,
    .quiz-actions {
        bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
    }
}

/* スタンドアロンモード */
@media (display-mode: standalone) {
    .app-header {
        padding-top: env(safe-area-inset-top);
        height: calc(var(--header-height) + env(safe-area-inset-top));
    }

    body {
        padding-top: calc(var(--header-height) + env(safe-area-inset-top));
    }
}

/* スマホ向け調整 */
@media (max-width: 480px) {
    .app-header {
        padding: 6px 10px;
    }

    .app-logo {
        height: 44px;
    }

    .app-main {
        padding: var(--spacing-xs) var(--spacing-sm);
    }
}
