/* 基本設定 */
:root {
    --primary-color: #0073aa;
    --secondary-color: #d63384;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --gray-color: #6c757d;
    --light-gray: #f8f9fa;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* 店舗色を取得できない場合に使用する打刻画面専用の標準配色 */
#tc-timecard-root {
    --tc-store-primary: #0073aa;
    --tc-store-text: #006da2;
    --tc-store-soft: #e0eef5;
    --tc-store-border: #9ecadf;
    --tc-store-gradient-start: #f5f9fc;
    --tc-store-gradient-end: #bddbe9;
    --tc-store-primary-rgb: 0, 115, 170;
}

/* 表示中の版と更新案内 */
#tc-timecard-root .tc-version-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin: 8px 24px;
    font-size: 13px;
    line-height: 1.5;
}

#tc-timecard-root .tc-version-label {
    margin: 8px 24px 12px;
    color: #777;
    font-size: 11px;
    line-height: 1.4;
    text-align: right;
    white-space: nowrap;
}

#tc-timecard-root .tc-update-notice:not([hidden]) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 8px 12px;
    border: 1px solid #dba617;
    border-radius: 6px;
    background: #fff8df;
    color: #513d00;
    font-weight: 600;
}

#tc-timecard-root .tc-update-notice button {
    padding: 6px 12px;
    border: 0;
    border-radius: 5px;
    background: var(--tc-store-primary);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

#tc-timecard-root .tc-update-notice button:disabled {
    opacity: 0.6;
    cursor: wait;
}

#tc-timecard-root .tc-update-error:not([hidden]) {
    color: #a52424;
}

/* 打刻画面・休暇申請ポータルでは、テーマの本文幅を保ったまま共通部品だけを隠す */
body.tc-hide-theme-chrome #masthead,
body.tc-hide-theme-chrome #site-header,
body.tc-hide-theme-chrome #header,
body.tc-hide-theme-chrome #header-container,
body.tc-hide-theme-chrome .site-header,
body.tc-hide-theme-chrome .l-header,
body.tc-hide-theme-chrome #colophon,
body.tc-hide-theme-chrome #site-footer,
body.tc-hide-theme-chrome #footer,
body.tc-hide-theme-chrome .site-footer,
body.tc-hide-theme-chrome .l-footer,
body.tc-timecard-shortcode-page > header,
body.tc-timecard-shortcode-page > footer,
body.tc-timecard-shortcode-page > #page > header,
body.tc-timecard-shortcode-page > #page > footer,
body.tc-timecard-shortcode-page > .site > header,
body.tc-timecard-shortcode-page > .site > footer,
body.tc-timecard-shortcode-page header[role="banner"],
body.tc-timecard-shortcode-page footer[role="contentinfo"],
body.tc-timecard-shortcode-page header.elementor-location-header,
body.tc-timecard-shortcode-page footer.elementor-location-footer,
body.tc-timecard-shortcode-page #brx-header,
body.tc-timecard-shortcode-page #brx-footer,
body.tc-hide-theme-chrome .wp-site-blocks > header,
body.tc-hide-theme-chrome .wp-site-blocks > footer,
body.tc-hide-theme-chrome header.wp-block-template-part,
body.tc-hide-theme-chrome footer.wp-block-template-part,
body.tc-timecard-shortcode-page .wp-site-blocks > .wp-block-template-part[data-area="header"],
body.tc-timecard-shortcode-page .wp-site-blocks > .wp-block-template-part[data-area="footer"],
body.tc-hide-theme-chrome .entry-header,
body.tc-hide-theme-chrome .page-header,
body.tc-hide-theme-chrome .entry-title,
body.tc-hide-theme-chrome .page-title,
body.tc-hide-theme-chrome .wp-block-post-title,
body.tc-hide-theme-chrome .c-pageTitle,
body.tc-hide-theme-chrome .p-entry__title,
body.tc-hide-theme-chrome #breadcrumb,
body.tc-hide-theme-chrome .breadcrumb,
body.tc-hide-theme-chrome .breadcrumbs,
body.tc-hide-theme-chrome .breadcrumb-area,
body.tc-hide-theme-chrome .breadcrumb-wrapper,
body.tc-hide-theme-chrome .breadcrumb-trail,
body.tc-hide-theme-chrome .c-breadcrumb,
body.tc-hide-theme-chrome .yoast-breadcrumb,
body.tc-hide-theme-chrome .rank-math-breadcrumb,
body.tc-hide-theme-chrome .ast-breadcrumbs-wrapper,
body.tc-hide-theme-chrome nav[aria-label="breadcrumb" i],
body.tc-hide-theme-chrome nav[aria-label="breadcrumbs" i],
body.tc-hide-theme-chrome nav[aria-label="パンくず"] {
    display: none !important;
}

/* divで出力されるブロックテーマのテンプレート部品を補完する */
body.tc-timecard-shortcode-page .wp-site-blocks > .wp-block-template-part:has(> header),
body.tc-timecard-shortcode-page .wp-site-blocks > .wp-block-template-part:has(> footer) {
    display: none !important;
}

/* 全体コンテナ */
.tc-container {
    display: flex;
    gap: 20px;
    padding: 24px;
    background: linear-gradient(135deg, var(--tc-store-gradient-start) 0%, var(--tc-store-gradient-end) 100%);
    border-radius: 16px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 80vh;
    align-items: stretch;
}

/* 共通：内枠スタイル */
.tc-staff-list,
.tc-main-inner {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
}

/* 左側：スタッフリスト */
.tc-staff-column {
    position: relative;
    flex: 0 0 280px;
    min-width: 0;
}

.tc-staff-list {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    overflow-y: auto;
}

.tc-staff-list > h3 {
    margin-top: 0;
    font-size: 1.1rem;
    color: var(--tc-store-text);
    border-bottom: 2px solid var(--tc-store-primary);
    padding-bottom: 10px;
    margin-bottom: 15px;
    text-align: center;
}

.tc-primary-staff-heading {
    color: var(--tc-store-text);
    font-size: 0.82rem;
    font-weight: 700;
    margin: 0 0 10px;
}

.tc-other-staff-toggle {
    align-items: center;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #334155;
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    font-size: 0.82rem;
    font-weight: 700;
    gap: 6px;
    justify-content: space-between;
    margin: 8px 0 10px;
    padding: 9px 11px;
    text-align: left;
    width: 100%;
}

.tc-other-staff-toggle[hidden] {
    display: none;
}

.tc-other-staff-toggle:hover,
.tc-other-staff-toggle:focus-visible {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.tc-other-staff-toggle:focus-visible {
    outline: 2px solid var(--tc-store-primary);
    outline-offset: 2px;
}

.tc-other-staff-active-note {
    color: #0f766e;
    font-size: 0.72rem;
    font-weight: 600;
}

.tc-other-staff-chevron {
    display: inline-block;
    margin-left: auto;
    transition: transform 0.2s ease;
}

.tc-other-staff-toggle[aria-expanded="false"] .tc-other-staff-chevron {
    transform: rotate(-90deg);
}

.tc-staff-list.tc-other-staff-collapsed > .tc-other-staff-card,
.tc-staff-list.tc-other-staff-collapsed > .tc-help-staff-section {
    display: none !important;
}

/* スタッフカード */
.staff-card {
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #fdfdfd; /* わずかにオフホワイト */
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e0e6ed;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    background-color: #f8fbff; /* 淡いブルー */
}

.staff-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
    border-color: #ccd9e5;
}

.staff-card.active {
    background: var(--tc-store-soft);
    border-color: var(--tc-store-primary);
    box-shadow: 0 4px 10px rgba(var(--tc-store-primary-rgb), 0.18);
}

.staff-card .staff-name {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

/* 右側：メインパネル */
.tc-main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tc-main-inner {
    flex: 1;
    gap: 15px;
}

/* 各表示エリア */
#tc-display-area {
    text-align: center;
    padding: 10px 0;
}

#real-time-date {
    font-size: 1.2rem;
    color: var(--gray-color);
    font-weight: 500;
}

#real-time-clock {
    font-size: 4rem;
    font-weight: 800;
    color: #1a1a1a;
    line-height: 1;
    margin: 10px 0;
    font-variant-numeric: tabular-nums;
}

#today-status-display {
    display: inline-block;
    background: var(--tc-store-soft);
    color: var(--tc-store-text);
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1.1rem;
    border: 1px solid var(--tc-store-border);
}

/* 打刻ボタン */
.tc-button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.tc-btn {
    padding: 22px 10px;
    font-size: 1.3rem;
    font-weight: 800;
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.tc-btn:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.btn-in {
    background: linear-gradient(to bottom, #2ecc71, #28a745);
}

.btn-out {
    background: linear-gradient(to bottom, #fa5252, #dc3545);
}

.btn-break {
    background: linear-gradient(to bottom, #4dabf7, #17a2b8);
}

.btn-break:nth-of-type(3) {
    background: linear-gradient(to bottom, #ffcc33, #ffc107);
    color: #333;
    text-shadow: none;
}

/* アコーディオン */
.tc-acc-item {
    margin-bottom: 10px;
}

.tc-acc-btn {
    width: 100%;
    padding: 12px 15px;
    text-align: left;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.tc-acc-content {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    padding: 15px;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* 打刻漏れ申請で承認された時刻の前後を区別する */
#personal-log-table {
    overflow-x: auto;
}

/* 欠勤・遅刻・早退と今後の予定 */
.tc-attendance-note {
    margin-top: 2px;
    font-size: 0.75rem;
    line-height: 1.2;
    font-weight: bold;
}

.tc-attendance-note--absence,
.tc-upcoming-event--absence .tc-upcoming-event-name,
.tc-upcoming-event--absence .tc-upcoming-event-detail {
    color: #6c757d;
}

.tc-attendance-note--late,
.tc-upcoming-event--late .tc-upcoming-event-name,
.tc-upcoming-event--late .tc-upcoming-event-detail {
    color: #946200;
}

.tc-attendance-note--early_leave,
.tc-upcoming-event--early_leave .tc-upcoming-event-name,
.tc-upcoming-event--early_leave .tc-upcoming-event-detail {
    color: #08756d;
}

.tc-attendance-reason {
    display: block;
    margin-top: 1px;
    font-size: 0.7rem;
    font-style: italic;
    font-weight: normal;
}

.tc-upcoming-event {
    min-width: 140px;
    padding: 8px 12px;
    border: 1px solid #ffccd5;
    border-radius: 4px;
    background: #fff5f8;
}

.tc-upcoming-event--absence {
    border-color: #dee2e6;
    background: #f8f9fa;
}

.tc-upcoming-event--late {
    border-color: #e8c879;
    background: #fff9e8;
}

.tc-upcoming-event--early_leave {
    border-color: #9ed8d1;
    background: #ecf8f6;
}

.tc-upcoming-event-name {
    color: #d63384;
    font-weight: bold;
}

.tc-upcoming-event-detail {
    color: #d63384;
    font-size: 0.8em;
}

.upcoming-leaves-container {
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    padding: 12px !important;
    border-radius: 8px;
}

/* お知らせセクション */
.tc-notices-container {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tc-notices-container h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.1em;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.tc-notice-card {
    background: var(--tc-store-soft);
    border-left: 4px solid var(--tc-store-primary);
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 8px;
}

.tc-notice-card:last-child {
    margin-bottom: 0;
}

.tc-notice-title {
    font-weight: bold;
    color: #333;
    font-size: 0.95em;
    margin-bottom: 4px;
}

.tc-notice-content {
    color: #555;
    font-size: 0.9em;
    line-height: 1.5;
}

/* レスポンシブ */
@media (max-width: 480px) {
    #tc-timecard-root .tc-version-bar {
        margin: 8px 12px;
    }

    #tc-timecard-root .tc-version-label {
        margin-right: 12px;
        margin-left: 12px;
    }

    .tc-container {
        flex-direction: column;
        padding: 12px;
    }

    .tc-staff-column {
        flex: none;
        width: 100%;
        position: static;
    }

    .tc-staff-list {
        position: static;
        width: 100%;
        max-height: 250px;
    }
}

@media (min-width: 481px) and (max-width: 1024px) {
    .tc-staff-column {
        flex: 0 0 220px;
    }

    .tc-btn {
        font-size: 1.2rem;
        padding: 18px 5px;
    }

    #real-time-clock {
        font-size: 3rem;
    }
}

/* 無効化されたボタン */
.tc-btn:disabled {
    box-shadow: none !important;
    transform: none !important;
    filter: grayscale(1) opacity(0.5);
    cursor: not-allowed;
}

/* ステータスバッジ */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #fff;
    margin-top: 4px;
}

.status-working {
    background: var(--success-color);
}

.status-working-elsewhere {
    background: var(--primary-color);
}

.status-on-break {
    background: var(--warning-color);
    color: #333 !important;
}

.status-clocked-out {
    background: var(--danger-color);
}

.status-none {
    background: var(--gray-color);
}

/* ============================
   ネットワーク状態インジケーター
   ============================ */

/* 右上固定バッジコンテナ */
.tc-network-badge {
    position: fixed;
    top: 12px;
    right: 16px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    cursor: default;
    user-select: none;
}

/* オンライン状態 */
.tc-network-badge.is-online {
    background: rgba(40, 167, 69, 0.15);
    border: 1px solid rgba(40, 167, 69, 0.3);
    color: #1b7a34;
}

/* オフライン状態 */
.tc-network-badge.is-offline {
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid rgba(220, 53, 69, 0.4);
    color: #b02a37;
    animation: tc-pulse-offline 2s ease-in-out infinite;
}

/* 同期中状態 */
.tc-network-badge.is-syncing {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.5);
    color: #856404;
}

/* ステータスドット（丸いインジケーター） */
.tc-network-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tc-network-badge.is-online .tc-network-dot {
    background: #28a745;
    box-shadow: 0 0 4px rgba(40, 167, 69, 0.6);
}

.tc-network-badge.is-offline .tc-network-dot {
    background: #dc3545;
    box-shadow: 0 0 4px rgba(220, 53, 69, 0.6);
}

.tc-network-badge.is-syncing .tc-network-dot {
    background: #ffc107;
    box-shadow: 0 0 4px rgba(255, 193, 7, 0.6);
    animation: tc-spin-dot 1s linear infinite;
}

/* 未送信件数カウント */
.tc-offline-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dc3545;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 50px;
    padding: 0 5px;
    margin-left: 2px;
}

/* 未送信なしの場合は非表示 */
.tc-offline-count:empty,
.tc-offline-count[data-count="0"] {
    display: none;
}

/* オフライン打刻保存通知バー */
.tc-offline-notice {
    margin-top: 8px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #fff3cd, #fff9e6);
    border: 1px solid #ffc107;
    border-left: 4px solid #ff9800;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #664d03;
    font-weight: 600;
    animation: tcFadeIn 0.3s ease;
}

/* オフライン → オンライン同期完了通知 */
.tc-sync-success-notice {
    margin-top: 8px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #d1e7dd, #e8f5e9);
    border: 1px solid #28a745;
    border-left: 4px solid #28a745;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #0f5132;
    font-weight: 600;
    animation: tcFadeIn 0.3s ease;
}

/* アニメーション */
@keyframes tc-pulse-offline {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes tc-spin-dot {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}
.tc-device-lock-screen {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, var(--tc-store-gradient-start) 0%, var(--tc-store-gradient-end) 100%);
    box-sizing: border-box;
}

.tc-device-lock-card {
    width: min(460px, 100%);
    padding: 28px;
    border: 1px solid #c9d2d9;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.tc-device-lock-card h2 {
    margin: 0 0 14px;
    color: var(--tc-store-text);
}

.tc-device-lock-message {
    color: #b32d2e;
    font-weight: 700;
}

.tc-device-registration-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.tc-device-registration-form input[name="registration_code"] {
    width: 190px;
    padding: 10px 12px;
    border: 1px solid #8c8f94;
    border-radius: 6px;
    font-size: 16px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.tc-device-registration-form button {
    padding: 10px 16px;
    border: 0;
    border-radius: 6px;
    background: var(--tc-store-text);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.tc-device-registration-form button:disabled {
    opacity: 0.55;
    cursor: wait;
}

.tc-device-registration-status {
    flex-basis: 100%;
    min-height: 1.5em;
    margin: 2px 0 0;
}

.tc-device-registration-status.is-error {
    color: #b32d2e;
    font-weight: 700;
}

.tc-device-status-panel {
    margin-top: 12px;
    padding: 8px 10px;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    background: #f6f7f7;
    color: #50575e;
    font-size: 12px;
}

.tc-device-status-panel summary {
    cursor: pointer;
    font-weight: 600;
}
