/**
 * ESMA専用 共通UIテーマスタイル
 * CSS変数（カスタムプロパティ）によるカラー集中管理
 */

/* ==========================================================================
   1. カラーテーマの定義（カスタムプロパティ）
   ========================================================================== */

:root {
    --bg-main: #FDFBF7;       /* 薄クリーム */
    --bg-card: #FFFFFF;
    --bg-sidebar: #1A2E40;    /* 紺 */
    --text-main: #3C2F2F;     /* こげ茶 */
    --text-muted: #6D5D5D;
    --text-sidebar: #FFFFFF;
    --accent: #8B0000; /* エンジ色 */
    --border: #E8E2D5;
    --status-success: #2E7D32;
    --status-pending: #EF6C00;
    --bg-logo: #fcf8ed;
}

/* ==========================================================================
   2. 全体レイアウト・共通スタイル
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', sans-serif;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    margin: 0 !important;
    padding: 0 !important;
}

/* サイドバー */
aside {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: var(--text-sidebar);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    flex-shrink: 0;
    margin: 0 !important;
}

aside ul {
    padding-left: 0px;
}

.logo {
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 16px;
}

.menu-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item {
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-item.active {
    background-color: var(--accent);
    font-weight: bold;
}

/* メインコンテンツエリア */
main {
    flex-grow: 1;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ヘッダー・テーマ切替エリア */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border);
    padding-bottom: 16px;
}

/* h1タイトルのサイズを元サンプル（32px）のサイズ感に復元 */
header h1 {
    font-size: 32px !important;
    font-weight: bold;
}

.theme-switcher {
    display: flex;
    gap: 8px;
    background-color: var(--bg-card);
    padding: 6px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.theme-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    background: transparent;
    color: var(--text-muted);
}

.theme-btn.active {
    background-color: var(--accent);
    color: #FFFFFF;
}

/* ==========================================================================
   3. コンポーネント（統計・配信状況カード、ログテーブル）
   ========================================================================== */

/* 統計カード（配信状況のサマリー） */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.card-title {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.card-value {
    font-size: 28px;
    font-weight: bold;
}

/* カラーインジケーター（数値を色で強調） */
.val-total { color: var(--text-main); }
.val-success { color: var(--status-success); }
.val-error { color: var(--accent); } /* エラーをエンジ色で強調 */
.val-pending { color: var(--status-pending); }

/* 配信タスク・ログの一覧テーブル */
.section-title {
    font-size: 18px;
    font-weight: bold;
    margin-top: 8px;
}

.table-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

th, td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: rgba(0, 0, 0, 0.02);
    color: var(--text-muted);
    font-weight: bold;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    color: #FFFFFF;
}

.status-badge.success { background-color: var(--status-success); }
.status-badge.error { background-color: var(--accent); }
.status-badge.pending { background-color: var(--status-pending); }

/* 緊急停止等のアクションボタン */
.btn-action {
    background-color: var(--accent);
    color: #FFFFFF;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
}

.btn-action:hover {
    opacity: 0.9;
}

/* ロゴ表示エリアのスタイル修正 */
.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center; /* 中央揃え */
    text-align: center;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.logo-img {
    width: 68px;        /* アプリ画面に合わせて適切なサイズに調整 */
    height: auto;
    object-fit: contain;
    margin-bottom: 8px;  /* ロゴと下の文字の間の余白 */
}

.logo-subtext {
    font-size: 11px;     /* 小さく上品に入れる */
    color: #FDFBF7;      /* 薄クリーム色 */
    letter-spacing: 0.5px;
    line-height: 1.3;
    /*text-transform: uppercase;*/ /* 英小文字を大文字に統一して洗練させる */
    opacity: 0.9;
}

p {
    margin-bottom: 0.3rem;
}

/* ==========================================================================
4. レスポンシブ対応（スマホ表示時の調整）
========================================================================== */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    aside {
        width: 100%;
        padding: 16px;
        gap: 16px;
    }
    aside ul {
        margin-bottom: 0px;
    }
    .menu-list {
        flex-direction: row;
        overflow-x: auto;
    }
    .menu-item {
        white-space: nowrap;
        padding: 8px 12px;
    }
    main {
        padding: 16px;
    }
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .theme-switcher {
        width: 100%;
        justify-content: space-between;
    }
}
