/* ============================================
   Dashboard Layout - 3カラム構成
   左サイドバー(60px) + メイン + 右パネル(300px)
   ============================================ */

/* --- Layout Override --- */
.dashboard-layout {
    display: flex !important;
    max-width: 100% !important;
    width: 100%;
    height: 100vh;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
}

/* body自体のpadding/overflowを上書き */
body:has(.dashboard-layout) {
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    height: 100vh;
}

/* 元のheader非表示 */
.dashboard-layout>header {
    display: none !important;
}

/* ===== 左サイドバー ===== */
.sidebar {
    width: 60px;
    min-width: 60px;
    height: 100vh;
    background: rgba(8, 8, 18, 0.95);
    border-right: 1px solid rgba(255, 0, 51, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 4px;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
}

.sidebar-logo {
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
    font-weight: 800;
    color: #ff0033;
    letter-spacing: 1px;
    margin-bottom: 16px;
    padding: 8px 4px;
    border-bottom: 1px solid rgba(255, 0, 51, 0.3);
    width: 100%;
    text-align: center;
    text-shadow: 0 0 12px rgba(255, 0, 51, 0.5);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 0 6px;
}

.sidebar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    position: relative;
}

.sidebar-btn:hover {
    background: rgba(255, 0, 51, 0.12);
    color: #ff4d6d;
    transform: scale(1.05);
}

.sidebar-btn:active {
    transform: scale(0.95);
}

.sidebar-btn.active {
    background: rgba(255, 0, 51, 0.2);
    color: #ff0033;
}

.sidebar-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #ff0033;
    border-radius: 0 3px 3px 0;
}

.sidebar-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.sidebar-label {
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* ===== メインコンテンツ ===== */
.main-content {
    flex: 1;
    min-width: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 0, 51, 0.3) transparent;
}

.main-content::-webkit-scrollbar {
    width: 6px;
}

.main-content::-webkit-scrollbar-track {
    background: transparent;
}

.main-content::-webkit-scrollbar-thumb {
    background: rgba(255, 0, 51, 0.3);
    border-radius: 3px;
}

/* メイン内のsectionのhoverアニメーション抑制 */
.main-content>section {
    transform: none !important;
}

.main-content>section:hover {
    transform: none !important;
}

/* チャート・パーティ・戦場セクションを非表示（モーダルに移動） */
.main-content>.chart-loader,
.main-content>.party-config,
.main-content>.enemy-config {
    display: none !important;
}

/* キャラ状態セクションも非表示（右パネルに表示） */
.main-content>#character-passives-section {
    display: none !important;
}

/* ===== 右パネル ===== */
.right-panel {
    width: 300px;
    min-width: 300px;
    height: 100vh;
    overflow-y: auto;
    background: rgba(8, 8, 18, 0.92);
    border-left: 1px solid rgba(255, 0, 51, 0.12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 0, 51, 0.2) transparent;
    z-index: 50;
}

.right-panel::-webkit-scrollbar {
    width: 4px;
}

.right-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 0, 51, 0.2);
    border-radius: 2px;
}

.right-panel-header {
    padding: 12px 16px;
    font-family: 'Orbitron', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ff4d6d;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 0, 51, 0.15);
    background: rgba(255, 0, 51, 0.04);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(20px);
}

#right-panel-content {
    padding: 8px;
}

/* --- コンパクトステータスセクション --- */
.compact-status-section {
    margin-bottom: 8px;
}

.compact-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 6px 8px 4px;
}

/* --- コンパクトキャラカード --- */
.compact-char-card {
    background: rgba(18, 18, 32, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.compact-char-card:hover {
    background: rgba(255, 0, 51, 0.06);
    border-color: rgba(255, 0, 51, 0.2);
}

.compact-char-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--char-color, #ff0033);
    border-radius: 3px 0 0 3px;
}

.compact-char-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--char-color, #ff4d6d);
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.compact-char-name .char-persona {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 400;
}

.compact-char-buffs {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.compact-buff-tag {
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    white-space: nowrap;
}

.compact-buff-tag.buff-up {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.25);
}

.compact-buff-tag.buff-down {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.25);
}

.compact-buff-tag.buff-special {
    background: rgba(168, 218, 220, 0.12);
    color: #a8dadc;
    border: 1px solid rgba(168, 218, 220, 0.2);
}

.compact-buff-tag.buff-ailment {
    background: rgba(155, 89, 182, 0.15);
    color: #bb6bd9;
    border: 1px solid rgba(155, 89, 182, 0.25);
}

/* --- コンパクト敵カード --- */
.compact-enemy-card {
    background: rgba(18, 18, 32, 0.7);
    border: 1px solid rgba(231, 76, 60, 0.1);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 4px;
}

.compact-enemy-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #e74c3c;
    border-radius: 3px 0 0 3px;
}

.compact-enemy-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: #e74c3c;
    margin-bottom: 3px;
}

.compact-enemy-debuffs {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

/* --- コンパクトパッシブ --- */
.compact-passive-card {
    background: rgba(18, 18, 32, 0.7);
    border: 1px solid rgba(168, 218, 220, 0.08);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 4px;
}

.compact-passive-name {
    font-size: 0.65rem;
    font-weight: 600;
    color: #a8dadc;
    margin-bottom: 2px;
}

.compact-passive-detail {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.4);
}

/* ===== ダッシュボードモーダル ===== */
.dashboard-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.dashboard-modal-content {
    background: rgba(14, 14, 28, 0.98);
    border: 1px solid rgba(255, 0, 51, 0.2);
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(255, 0, 51, 0.05);
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dashboard-modal-content.modal-large {
    max-width: 1100px;
    width: 95%;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dashboard-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 0, 51, 0.03);
    border-radius: 16px 16px 0 0;
}

.dashboard-modal-header h2 {
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    color: #ff4d6d;
    letter-spacing: 2px;
    margin: 0;
    padding: 0;
}

/* モーダルヘッダーのh2のbefore疑似要素を無効化 */
.dashboard-modal-header h2::before {
    display: none !important;
}

.dashboard-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-modal-close:hover {
    background: rgba(255, 0, 51, 0.15);
    border-color: rgba(255, 0, 51, 0.3);
    color: #ff4d6d;
}

.dashboard-modal-body {
    overflow-y: auto;
    padding: 16px;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 0, 51, 0.2) transparent;
}

.dashboard-modal-body::-webkit-scrollbar {
    width: 6px;
}

.dashboard-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 0, 51, 0.2);
    border-radius: 3px;
}

/* モーダル内のセクションのスタイル上書き */
.dashboard-modal-body>section {
    display: block !important;
    margin-bottom: 0;
    border: none;
    background: transparent;
    backdrop-filter: none;
    padding: 0;
    box-shadow: none;
    animation: none;
}

.dashboard-modal-body>section::before {
    display: none;
}

.dashboard-modal-body>section:hover {
    transform: none;
    border-color: transparent;
    box-shadow: none;
}

/* モーダル内のcollapsible-contentは常に展開 */
.dashboard-modal-body .collapsible-content {
    display: block !important;
    max-height: none !important;
    opacity: 1 !important;
    padding-top: 0 !important;
}

/* モーダル内のcollapsible-headerは非表示（モーダルヘッダーに統合） */
.dashboard-modal-body .collapsible-header {
    display: none !important;
}

/* チャートセクションのh2も非表示 */
.dashboard-modal-body .chart-loader>h2 {
    display: none !important;
}

/* ===== メインコンテンツ内の行動入力セクション調整 ===== */
.main-content>.turn-input {
    margin-bottom: 16px;
}

/* 結果セクション */
.main-content>.results {
    margin-bottom: 16px;
}

/* ===== No-data placeholder ===== */
.compact-no-data {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.25);
    padding: 8px;
    text-align: center;
    font-style: italic;
}

/* ===== Keyboard shortcut hint ===== */
.sidebar-btn[title]::after {
    content: attr(data-shortcut);
    position: absolute;
    right: -4px;
    top: 2px;
    font-size: 0.5rem;
    color: rgba(255, 255, 255, 0.15);
    font-weight: 400;
}

/* ===== ダッシュボードヘッダーバー ===== */
.dashboard-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    background: rgba(8, 8, 18, 0.8);
    border: 1px solid rgba(255, 0, 51, 0.12);
    border-radius: 10px;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
}

.header-title-group {
    display: flex;
    align-items: baseline;
    gap: 8px;
    z-index: 1;
}

.header-logo-text {
    font-family: 'Orbitron', monospace;
    font-size: 1.1rem;
    font-weight: 900;
    color: #ff0033;
    letter-spacing: 3px;
    text-shadow: 0 0 20px rgba(255, 0, 51, 0.4), 0 0 40px rgba(255, 0, 51, 0.1);
}

.header-version {
    font-family: 'Orbitron', monospace;
    font-size: 0.6rem;
    color: rgba(255, 0, 51, 0.5);
    font-weight: 600;
    letter-spacing: 1px;
}

.header-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 1px;
    margin-left: auto;
    z-index: 1;
}

.header-animation-bar {
    flex: 1;
    height: 2px;
    background: rgba(255, 0, 51, 0.08);
    border-radius: 1px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.header-pulse {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 0, 51, 0.4) 30%,
            rgba(255, 0, 51, 0.8) 50%,
            rgba(255, 0, 51, 0.4) 70%,
            transparent 100%);
    animation: headerPulse 3s ease-in-out infinite;
}

.header-scan-line {
    position: absolute;
    top: 0;
    left: -100%;
    width: 30%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 200, 200, 0.6),
            transparent);
    animation: headerScan 4s linear infinite;
}

@keyframes headerPulse {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

@keyframes headerScan {
    0% {
        left: -30%;
    }

    100% {
        left: 130%;
    }
}

/* ===== ステージタイトルバー ===== */
.stage-title-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: rgba(255, 0, 51, 0.04);
    border: 1px solid rgba(255, 0, 51, 0.08);
    border-radius: 8px;
    margin-bottom: 12px;
}

.stage-title-text {
    font-family: 'Orbitron', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 1px;
}

.stage-mode-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    display: none;
}

.stage-mode-badge.sea {
    display: inline-block;
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.stage-mode-badge.door-endurance {
    display: inline-block;
    background: rgba(230, 126, 34, 0.2);
    color: #e67e22;
    border: 1px solid rgba(230, 126, 34, 0.3);
}

.stage-mode-badge.door-weakness {
    display: inline-block;
    background: rgba(155, 89, 182, 0.2);
    color: #9b59b6;
    border: 1px solid rgba(155, 89, 182, 0.3);
}

/* ===== 敵デバフグルーピング（右パネル） ===== */
.enemy-debuff-group {
    margin-bottom: 6px;
}

.enemy-debuff-group-title {
    font-size: 0.6rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    padding-left: 2px;
}

.enemy-debuff-group-items {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

/* ===== 防御デバフ進捗バー ===== */
.debuff-progress-section {
    margin: 6px 0 8px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.debuff-progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 3px;
}

.debuff-progress-value {
    font-family: 'Orbitron', monospace;
    font-size: 0.65rem;
    font-weight: 700;
}

.debuff-progress-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.debuff-progress-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease, background 0.4s ease;
    z-index: 2;
}

.debuff-progress-bar-weak {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 3px;
    background: rgba(230, 57, 70, 0.25);
    border-right: 1px solid rgba(230, 57, 70, 0.5);
    transition: width 0.4s ease;
    z-index: 1;
}

.debuff-progress-remaining {
    font-size: 0.6rem;
    font-weight: 700;
    margin-top: 3px;
    text-align: right;
}

.debuff-progress-dual-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.58rem;
    font-weight: 700;
    margin-top: 3px;
}

/* デバフグループサマリー（クリック可能） */
.debuff-group-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    background: rgba(230, 57, 70, 0.08);
    border: 1px solid rgba(230, 57, 70, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.debuff-group-summary:hover {
    background: rgba(230, 57, 70, 0.15);
    border-color: rgba(230, 57, 70, 0.4);
}

.debuff-group-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.debuff-group-total {
    font-size: 0.75rem;
    font-weight: 700;
    color: #ff6b6b;
    font-family: 'Orbitron', monospace;
}

.debuff-group-count {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.35);
}

.debuff-group-expand {
    margin-left: auto;
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.3);
    transition: transform 0.2s;
}

.debuff-group-summary:hover .debuff-group-expand {
    color: rgba(255, 255, 255, 0.6);
}