/* CSS Reset for front-end consistency */
.attendance-container,
.attendance-container * {
    box-sizing: border-box;
}

.attendance-container {
    max-width: 900px;
    width: 95%;
    margin: 40px auto;
    /* 画面中央に十分な余白を持たせる */
    font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    padding: 20px;
    background: #ffffff;
    color: #3c434a;
    line-height: 1.5;
    font-size: 16px !important;
}

.attendance-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #0073aa;
}

.common-header {
    background: #ffffff;
    padding: 20px;
    border: 2px solid #0073aa;
    border-radius: 8px;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.header-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 8px;
}

.info-box {
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}

.info-line {
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
    width: 100%; /* 幅を広げる */
}

/* ログアウトボタンを枠いっぱいに広げる */
.info-box .btn {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    text-align: center;
}

.info-line strong {
    color: #0073aa;
}

.page-title {
    font-size: 1.4rem;
    font-weight: bold;
    color: #0073aa;
    margin: 0;
}

.header-datetime {
    font-size: 1.2rem;
    color: #333;
    font-weight: bold;
}

.role-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: bold;
    margin-right: 5px;
    font-size: 0.9rem;
}

.role-badge.general {
    color: #0073aa;
    border: 1px solid #0073aa;
    background: #f0f7ff;
}

.role-badge.manager {
    color: #46b450;
    border: 1px solid #46b450;
    background: #f0fdf0;
}

.role-badge.president {
    color: #d6a100;
    border: 1px solid #d6a100;
    background: #fffdf0;
}

.status-field {
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 1.2rem;
    /* タイトル(header-datetime)のサイズに合わせる */
    /* 背景を透明にする */
    background: transparent;
}

.status-field:empty {
    display: none !important;
}

.attendance-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.attendance-card h2 {
    margin-top: 0;
    font-size: 1.25rem;
    color: #333;
    text-align: center;
}

.action-buttons {
    text-align: center;
    margin-bottom: 15px;
}

.time-sections {
    margin-bottom: 25px;
}

.time-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
}

.btn {
    padding: 8px 16px;
    height: 46px;
    /* 高さを46pxで統一 */
    border: 1px solid transparent;
    border-radius: 4px;
    font-weight: bold;
    font-size: 16px !important;
    /* 文字サイズを16pxで統一 */
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1;
    text-align: center;
    box-sizing: border-box;
}

.btn .dashicons {
    margin: 0 !important;
    /* WordPress標準の余白を強制リセット */
    width: auto !important;
    height: auto !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    /* アイコン自体の高さ枠だけは1にしておく */
    line-height: 1;
}

.btn:hover {
    opacity: 0.85;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-primary {
    background: #0073aa;
    color: white;
}

.btn-primary:active {
    background: #005177;
}

.btn-secondary {
    background: #0073aa;
    color: white;
}

.btn-warning {
    background: #ffb900;
    color: #3c434a;
}

.btn-warning.active {
    background: #d63638;
    color: white;
}

.btn-success {
    background: #46b450;
    color: white;
}

.btn-large {
    width: 100% !important;
    /* 横幅いっぱいに広げる */
    font-size: 16px !important;
    height: 46px;
}

.time-select {
    padding: 0 5px !important;
    /* 上下パディングを0に */
    height: 46px !important;
    /* ボタンと同じ高さに固定 */
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1.1rem !important;
    min-width: 60px !important;
    vertical-align: middle !important;
    /* ボタンとの横並びを綺麗にする */
}

.notes-section {
    margin-bottom: 25px;
}

.notes-section label {
    display: block;
    margin-top: 20px;
    /* 有休ボタンとの距離を離す */
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 1.25rem;
    /* 見出しを大きく */
}

.notes-section textarea {
    width: 100%;
    height: 100px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: none;
}

.status-field.db-saved {
    color: #46b450;
    background: #e7f4e8;
    border: 1px solid #c3e6cb;
}

.status-field.vacation-active {
    color: #d63638;
    font-size: 1.25rem;
    padding: 20px;
    border: 2px dashed #d63638;
    background: #fbeaea;
}

.status-field.error {
    color: #d63638;
    background: #fbeaea;
    border: 1px solid #f5c6cb;
}

/* Monthly Table */
.attendance-table-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.attendance-table {
    width: 100%;
    border-collapse: collapse;
}

.attendance-table th,
.attendance-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
    /* 折り返しを防止して備考の省略を活かす */
    font-size: 16px !important;
}

.attendance-table td.note-cell {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    /* ... のためのCSS（一応） */
    text-align: left;
}

.attendance-table th {
    background: #f8f9fa;
    font-weight: bold;
    color: #555;
}

.attendance-table tr.rest-day {
    background-color: #fff0f0;
}

.month-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 1.3rem;
    font-weight: bold;
}

.nav-btn {
    text-decoration: none;
    color: #0073aa;
    font-size: 1.5rem;
}

.submit-section {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.status-badge {
    padding: 12px 24px;
    /* ボタンと完全に一致させる */
    border-radius: 6px;
    font-size: 1.1rem;
    /* ボタンと一致させる */
    font-weight: bold;
    border: 1px solid #ddd;
    display: inline-flex;
    align-items: center;
    line-height: 1.2;
}

.status-badge.unsubmitted {
    background: #eee;
    color: #666;
}

.status-badge.submitted {
    background: #e7f4e8;
    color: #2e7d32;
    border-color: #46b450;
}

.status-badge.approved {
    background: #e3f2fd;
    color: #1976d2;
    border-color: #2196f3;
}

.status-badge.rejected {
    background: #fff5f5;
    color: #d32f2f;
    border-color: #ef5350;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .common-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 15px;
    }

    .info-box {
        text-align: center;
        width: 100%;
        font-size: 1.1rem;
    }

    .info-line {
        justify-content: center;
    }

    .header-left {
        width: 100%;
        text-align: center;
        align-items: center;
    }

    .time-block {
        flex-direction: row;
        /* 横並びを維持 */
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    }

    .time-block .btn,
    .special-actions .btn {
        width: 100px;
        flex-shrink: 0;
        padding: 8px 12px;
        font-size: 0.95rem;
    }

    .time-dropdowns {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 5px;
    }

    .time-select {
        min-width: 60px !important;
        padding: 8px 5px !important;
        font-size: 1.1rem !important;
    }

    .submit-section {
        flex-direction: column;
    }

    .submit-section .btn,
    .submit-section .status-badge {
        width: 100%;
        margin-bottom: 10px;
    }

    .submit-section .btn:last-child {
        margin-bottom: 0;
    }

    .attendance-container.monthly {
        padding: 5px;
    }

    .attendance-table th,
    .attendance-table td {
        padding: 6px 3px;
        font-size: 0.82rem;
        letter-spacing: -0.5px;
    }

    /* 備考セルが見切れないように調整 */
    .attendance-table td.note-cell {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* WP-Members Login Form Styling - Supports both ID and Class */
#wpmem_login,
.wpmem_login {
    max-width: 500px !important;
    margin: 60px auto !important;
    padding: 40px !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #e1e4e8 !important;
    font-family: 'Inter', 'Noto Sans JP', sans-serif !important;
}

/* ログイン画面の「ログイン」見出しを装飾 */
#wpmem_login legend,
.wpmem_login legend {
    font-size: 1.6rem !important;
    font-weight: bold !important;
    color: #0073aa !important;
    margin-bottom: 30px !important;
    text-align: center !important;
    width: 100% !important;
    border: none !important;
}

#wpmem_login .wpmem_row,
.wpmem_login .wpmem_row {
    margin-bottom: 25px !important;
}

#wpmem_login label,
.wpmem_login label {
    display: block !important;
    margin-bottom: 10px !important;
    font-weight: bold !important;
    color: #3c434a !important;
}

#wpmem_login input[type="text"],
#wpmem_login input[type="password"],
.wpmem_login input[type="text"],
.wpmem_login input[type="password"] {
    width: 100% !important;
    /* 追記: はみ出し防止 */
    max-width: 100% !important;
    /* 追記: paddingを含めて100%にする */
    box-sizing: border-box !important;
    /* 追記: 余分な左余白を消す */
    margin: 0 !important;
    padding: 14px !important;
    border: 2px solid #e1e4e8 !important;
    border-radius: 8px !important;
    font-size: 1rem !important;
    transition: all 0.3s !important;
}

#wpmem_login input[type="text"]:focus,
#wpmem_login input[type="password"]:focus,
.wpmem_login input[type="text"]:focus,
.wpmem_login input[type="password"]:focus {
    border-color: #0073aa !important;
    outline: none !important;
    box-shadow: 0 0 0 4px rgba(0, 115, 170, 0.1) !important;
}

#wpmem_login input[type="submit"],
.wpmem_login input[type="submit"] {
    width: 100% !important;
    padding: 16px !important;
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 1.2rem !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: transform 0.2s, box-shadow 0.2s !important;
    margin-top: 10px !important;
}

#wpmem_login input[type="submit"]:hover,
.wpmem_login input[type="submit"]:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 15px rgba(0, 115, 170, 0.3) !important;
}

#wpmem_login .rememberme,
.wpmem_login .rememberme,
div.rememberme,
p.rememberme {
    display: flex !important;
    flex-wrap: nowrap !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 5px !important;
    margin-top: 15px !important;
    font-size: 0.95rem !important;
    color: #646970 !important;
    width: auto !important;
    max-width: 100% !important;
    overflow: visible !important;
}

#wpmem_login .rememberme label,
.wpmem_login .rememberme label,
.rememberme label {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    white-space: nowrap !important;
    line-height: 1 !important;
}

#wpmem_login .rememberme input[type="checkbox"],
.wpmem_login .rememberme input[type="checkbox"],
.rememberme input[type="checkbox"] {
    margin: 0 !important;
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

/* ログアウトボタン（ヘッダー内） */
.logout-link {
    margin-left: 15px;
    font-size: 0.9rem;
    color: #d63638;
    text-decoration: none;
    border: 1px solid #d63638;
    padding: 4px 12px;
    border-radius: 4px;
    transition: all 0.2s;

    /* 以下を追加：文字を中央に配置する */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: normal;
    vertical-align: middle;
}

.logout-link:hover {
    background: #d63638;
    color: #fff;
}

/* 画面遷移ナビゲーションリンク集 */
.navigation-links {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px dashed #ddd;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #0073aa;
    text-decoration: none;
    font-weight: bold;
    padding: 10px;
    background: #f0f7ff;
    border-radius: 6px;
    transition: background 0.2s;
}

.nav-link:hover {
    background: #e1f0ff;
    text-decoration: underline;
}

.nav-link .dashicons {
    color: #0073aa;
}

/* WordPress Admin Footer Removal */
#wpfooter {
    display: none !important;
}

/* ログイン画面：「ログイン状態を保存する」の2段改行防止（強制横並び） */
#wpmem_login input[type="checkbox"],
.wpmem_login input[type="checkbox"] {
    display: inline-block !important;
    width: auto !important;
    margin: 0 5px 0 0 !important;
    vertical-align: middle !important;
}

#wpmem_login label[for="rememberme"],
.wpmem_login label[for="rememberme"] {
    display: inline-block !important;
    width: auto !important;
    margin: 0 !important;
    font-size: 0.95rem !important;
    font-weight: normal !important;
    vertical-align: middle !important;
}

/* -------------------------------------------
   追加：勤怠システムの画面とログイン画面のときだけサイトのヘッダーを非表示
------------------------------------------- */
body:has(#wpmem_login, .attendance-container) .site-header,
body:has(#wpmem_login, .attendance-container) .siteHeader,
body:has(#wpmem_login, .attendance-container) .site-header-logo,
body:has(#wpmem_login, .attendance-container) .site-header-sub,
body:has(#wpmem_login, .attendance-container) .global-nav,
body:has(#wpmem_login, .attendance-container) header,
body:has(#wpmem_login, .attendance-container) #masthead,
body:has(#wpmem_login, .attendance-container) .navbar,
body:has(#wpmem_login, .attendance-container) nav {
    display: none !important;
}

/* ついでに、ヘッダーを消したことで上に隙間が空きすぎる場合の調整 */
body:has(#wpmem_login, .attendance-container) {
    padding-top: 0 !important;
}

/* -------------------------------------------
   追加：表側（フロント）の画面を、裏側（管理画面）のデザインに完全に揃える
------------------------------------------- */
/* ① 画面の一番下の土台をグレー(#f1f1f1)にする */
body:has(.attendance-container) {
    background-color: #f1f1f1 !important;
}

/* ② 勤怠システム内のフォント全体を、管理画面と同じ標準フォントに寄せる */
.attendance-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
}

/* ③ テーマ（Lightning等）が勝手に作っている「白い箱」や「余白」を徹底的に透明化し、元のグレーを透かして裏側と全く同じ状態にする */
body:has(.attendance-container) .site,
body:has(.attendance-container) .site-content,
body:has(.attendance-container) .site-main,
body:has(.attendance-container) .entry-content,
body:has(.attendance-container) .entry-header,
body:has(.attendance-container) .content-area,
body:has(.attendance-container) #primary,
body:has(.attendance-container) #main {
    background: transparent !important;
    background-color: transparent !important;
    padding: 0 !important;
    margin: 0 auto !important;
    border: none !important;
    box-shadow: none !important;
    max-width: none !important;
}

/* ④ プルダウンやテキストボックスは、従来の使いやすい大きさのまま、クリック時の青い枠線デザインだけを採用 */
.attendance-container select:focus,
.attendance-container textarea:focus,
.attendance-container input[type="text"]:focus {
    border-color: #2271b1 !important;
    box-shadow: 0 0 0 1px #2271b1 !important;
    outline: none !important;
}

/* 月別勤怠画面のボタンとテーブルの間の余白 */
.table-actions {
    margin-bottom: 25px;
}

/* -------------------------------------------
   追加：WordPress上部の黒いメニューバー（管理バー）を非表示
------------------------------------------- */
#wpadminbar {
    display: none !important;
}

/* 管理バー非表示に伴う、WordPress標準の上部余白（32px）を詰める */
html.wp-toolbar {
    padding-top: 0 !important;
}

/* 環境によっては html に margin-top が付与されるためリセット */
html {
    margin-top: 0 !important;
}

#adminmenumain {
    display: none !important;
}

/* 左メニュー非表示に伴い、メインコンテンツの左側余白を詰める */
#wpcontent,
#wpfooter {
    margin-left: 0 !important;
}

/* -------------------------------------------
   タイムカード方式 (v1.3.0) 追加スタイル
------------------------------------------- */
.is-hidden {
    display: none !important;
}

.time-label {
    font-weight: bold;
    min-width: 60px;
}

.time-registered-label {
    flex: 1;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #46b450;
    background: #e7f4e8;
    border-radius: 4px;
    padding: 5px;
    border: 1px solid #c3e6cb;
}

#punch-in-section .btn {
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    box-shadow: 0 4px 15px rgba(0, 115, 170, 0.3);
}

#punch-out-section .btn {
    background: linear-gradient(135deg, #d63638 0%, #9e2a2c 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(214, 54, 56, 0.3);
}

/* モバイル調整 */
@media (max-width: 768px) {
    .time-registered-label {
        font-size: 1.3rem;
    }
}