/* ============================================
   COMPONENTS.CSS - ヘッダー、ボタン、共通コンポーネント
   ============================================ */

/* ヘッダー - Bloomberg風ダークスタイル */
header {
    background: #000;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    width: 100%;
    border: none;
}

/* ヘッダー1段目: タイトル */
header .header-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 90px;
    padding: 0 calc((100% - 1240px) / 2 + 30px);
    border-bottom: none;
}

/* ヘッダー時計（NICT正確時刻） */
.header-clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    color: #888;
    font-family: 'Saira', 'Zen Kaku Gothic New', sans-serif;
    font-variant-numeric: tabular-nums;
    cursor: default;
    transition: color 0.3s;
    line-height: 1.1;
}

.header-clock.synced {
    /* 同期済みでも色は変更しない */
}

.header-clock .clock-date {
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.header-clock .clock-time {
    font-size: 26px;
    font-weight: 500;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(77, 171, 247, 0.3);
}

header h1 {
    font-size: 40px;
    font-weight: 700;
    color: #ffffff;
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    background-clip: unset;
    margin: 0;
    line-height: 1;
}

header h1 a {
    color: #ffffff !important;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    line-height: 1;
}

.site-logo-wrapper {
    display: flex;
    align-items: center;
    height: 40px;
    font-size: 0;
    line-height: 0;
    margin-top: 4px;
}

.site-logo {
    height: 40px;
    width: auto;
    border-radius: 0;
    display: block;
    margin-bottom: 3px;
}

.site-title-text {
    display: flex;
    align-items: center;
    height: 40px;
    margin-top: 4px;
}

/* ヘッダー2段目: ナビゲーション */
.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 calc((100% - 1240px) / 2 + 30px);
    background: #1C1C1C;
}

.header-nav-left,
.header-nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* PC用ヘッダーツールボタン */
.header-tools {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
}

.btn-header-tool {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
    line-height: 1;
}

.btn-header-tool:hover {
    background: #333;
}

.header-tool-item .screenshot-menu {
    right: 0;
    left: auto;
}

.header-nav-left .header-nav-link:first-child {
    padding-left: 0;
}

.header-nav-link {
    color: #fff;
    text-decoration: none;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 500;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
}

.header-nav-link:hover {
    color: #fff;
    background: #333;
}

/* ヘッダーナビ用通知バッジ（PC） */
.header-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.header-user-name {
    color: #888;
    font-size: 14px;
    padding: 12px 16px;
}

.header-logout {
    color: #999;
}

.debug-badge {
    background: #f39c12;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    margin: 8px 16px;
}

.header-user-number {
    color: #888;
    font-size: 14px;
    font-weight: 400;
}

/* ユーザードロップダウン */
.user-dropdown {
    position: relative;
}

.user-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 16px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.user-dropdown-trigger:hover {
    background: #333;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.user-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #1C1C1C;
    border: 1px solid #333;
    border-radius: 6px;
    min-width: 140px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.user-dropdown.open .user-dropdown-menu {
    display: block;
}

.user-dropdown-menu a {
    display: block;
    padding: 12px 16px;
    color: #ccc;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}

.user-dropdown-menu a:hover {
    background: #333;
    color: #fff;
}

.debug-badge-inline {
    display: block;
    padding: 8px 16px;
    background: #f39c12;
    color: white;
    font-size: 12px;
    text-align: center;
}

/* ナビゲーションドロップダウン（PC用） */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    line-height: 1.6;
}

.nav-dropdown-trigger:hover {
    background: #333;
}

.nav-dropdown.active .nav-dropdown-trigger {
    color: #4dabf7;
}

.nav-dropdown .dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.nav-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #1C1C1C;
    border: 1px solid #333;
    border-radius: 6px;
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    padding: 12px 16px;
    color: #ccc;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}

.nav-dropdown-menu a:hover {
    background: #333;
    color: #fff;
}

.nav-dropdown-menu a.active {
    color: #4dabf7;
    background: rgba(77, 171, 247, 0.1);
}

.header-nav-link.active {
    color: #4dabf7;
}

/* ダークモード時の「自分のHOME」ボタン */
[data-theme="dark"] .header-nav-link[style*="background: #e8e8e8"],
[data-theme="dark"] .mobile-nav-item[style*="background: #e8e8e8"] {
    background: #334155 !important;
    color: #e2e8f0 !important;
}

/* モバイル用メインナビ（PCでは非表示） */
.mobile-main-nav {
    display: none;
}

.btn-header {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: var(--card-bg);
    color: var(--text);
    padding: 10px 16px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.btn-header:hover {
    background: var(--hover-bg);
    border-color: var(--primary);
}

/* 設定ボタン（歯車のみ） */
.btn-settings {
    padding: 10px 12px;
    font-size: 18px;
}

/* 電卓ボタン */
.btn-calculator {
    padding: 10px 12px;
    font-size: 18px;
}

/* スクショボタン（アイコンのみ） */
.btn-screenshot {
    padding: 10px 12px;
    font-size: 18px;
}

/* スクリーンショットドロップダウン */
.screenshot-dropdown {
    position: relative;
    display: inline-block;
}

.screenshot-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    min-width: 160px;
    overflow: hidden;
}

.screenshot-menu.show,
.screenshot-menu.open,
.screenshot-dropdown.open .screenshot-menu {
    display: block;
}

.screenshot-option {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.screenshot-option:hover {
    background: var(--hover-bg);
}

.screenshot-option:first-child {
    border-radius: 8px 8px 0 0;
}

.screenshot-option:last-child {
    border-radius: 0 0 8px 8px;
}

/* ヘッダー用スクリーンショットメニュー（黒背景） */
.header-screenshot-menu {
    background: #1C1C1C;
    border: 1px solid #333;
}

.header-screenshot-menu .screenshot-option {
    color: #ccc;
}

.header-screenshot-menu .screenshot-option:hover {
    background: #333;
    color: #fff;
}

.header-screenshot-menu .screenshot-menu-section {
    padding: 8px 16px 6px;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    background: #252525;
    display: flex;
    align-items: center;
}

.header-screenshot-menu .screenshot-menu-divider {
    height: 1px;
    background: #333;
    margin: 4px 0;
}

.export-note {
    font-size: 14px;
    color: var(--text-light);
    margin: 10px 0;
}

/* ヘッダーユーザー名 */
.header-user-name {
    font-weight: 600;
    color: var(--text);
    padding: 8px 14px;
    background: var(--hover-bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 14px;
}