@charset "utf-8";

/* 演題先生 スタイルシート (A4固定レイアウト対応・最終版) */

/* 共通スタイル */
.edss-my-abstract-list,
.edss-submission-form,
.edss-confirm-page,
.edss-management-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ★★★ここから修正★★★ */
/* テーブルやフィルターフォームのレスポンシブ対応 */
/* 親要素にoverflowを指定し、中のテーブルは元のレイアウトを維持する方式に変更 */
.edss-my-abstract-list,
.filter-section {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* for smooth scrolling on iOS */
}
/* ★★★ここまで修正★★★ */


/* テーブルスタイル */
.edss-abstract-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    /* ★追加: テーブルが縮まないように最小幅を指定 */
    /* min-width: 600px; */
}
.edss-abstract-table th,
.edss-abstract-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}
.edss-abstract-table th {
    background-color: #f8f9fa;
    font-weight: bold;
}
.edss-abstract-table tr:hover {
    background-color: #f5f5f5;
}

/* フォームスタイル */
.form-table th {
    width: 200px;
    padding: 15px 10px;
    vertical-align: top;
}
.form-table td {
    padding: 15px 10px;
}
.required {
    color: #d63638;
    font-weight: bold;
    margin-left: 3px;
}
.form-actions {
    margin: 30px 0;
    text-align: center;
}
.form-actions .button, .form-actions a.button {
    margin: 0 10px;
    padding: 8px 20px;
    min-width: 120px;
}

/* 文字数カウンター */
.char-counter {
    font-size: 0.9em;
    text-align: right;
    padding: 3px 6px;
    border-radius: 3px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 12px 12px;
}
.over-limit {
    border-color: #d63638 !important;
    background-color: #ffeaea !important;
}

/* --- 確認画面・印刷プレビュー用スタイル --- */

/* A4サイズを縮小表示させるためのラッパー */
.edss-preview-wrapper {
    margin: 20px auto;
    /* 修正: max-widthはそのままに、可変幅に対応できるようwidthを追加 */
    max-width: 210mm;
    width: 100%;
}

/* A4用紙の本体 */
.edss-preview-container {
    /* ★修正: 元の見た目を維持しつつ、縮小の基点のみ変更 */
    background: white;
    border: 1px solid #ddd;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    width: 210mm;
    height: 297mm;
    padding: 20mm;
    box-sizing: border-box;
    font-family: "Noto Serif JP", "MS Mincho", "Hiragino Mincho ProN", serif;
    color: #000;
    /* 縮小の基点を左上にする */
    transform-origin: top left;
}

/* 画面表示時のみ縮小処理を適用 */
@media screen {
    /* 修正: JavaScriptで計算した高さに追従するように修正 */
    .edss-preview-wrapper.is-scaled {
        height: var(--scaled-height, 297mm);
        margin-bottom: 20px; /* 元の余白を維持 */
        transition: height 0.1s ease-out;
    }
}

/* 上部情報（2カラムレイアウト） */
.post-overview {
    display: flex;
    margin-bottom: 10pt;
    padding-bottom: 8pt;
    border-bottom: 1pt solid #000;
    font-size: 6.5pt;
    font-family: "IBM Plex Sans JP", sans-serif;
    line-height: 1.4;
    width: 100%;
    overflow: hidden;
}
.overview-left {
    flex: 2;
    padding-right: 10pt;
    columns: 40mm;
    width: 40mm;
}
.overview-right {
    flex: 1;
    padding-left: 10pt;
}
.overview-item {
    margin-bottom: 1pt;
    display: flex;
    justify-content: space-between;
}
.overview-item strong {
    font-weight: bold;
    /* width: 40%; */
    white-space: nowrap;
    text-align: justify;
    text-align-last: justify;
    margin-right: 4pt;
}

/* 演題内容表示 */
.abstract-content {
    line-height: 1.6;
}

/* 各項目のコンテナ */
.content-item-wrapper {
    margin-bottom: 2mm;
    page-break-inside: avoid;
    position: relative;
}

/* 各項目のタイトル (枠の内側、左上) */
.content-item-wrapper h3 {
    font-size: 7pt;
    font-weight: normal !important;
    margin: 0 !important;
    padding: 0 0 2pt 0;
    color: #000 !important;
    position: absolute;
    top: 0.25mm;
    left: 1mm;
}
.content-item-wrapper h3::after {
    display: none !important;
}

/* 各項目の枠線 */
.content-box {
    border: 1pt solid #000;
    padding: 4mm 2mm 2mm;
    min-height: 10mm;
    font-size: 10.5pt;
}
.content-box.title-box {
    border-width: 2pt;
    font-size: 11pt;
    font-weight: bold;
    text-align: left;
    line-height: 1.4em;
    display: flex;
    height: 10mm;
    position: relative;
    overflow: hidden;
}
.content-box div {
    font-size: 10.5pt;
    line-height: 1.5;
}

.main-text .content-box {
    height: 90mm;
    overflow: hidden;
}

/* ルビスタイル */
ruby {
    ruby-position: over;
}
ruby rt {
    font-size: 0.6em;
    line-height: 1;
}

/* 上付き文字（所属機関番号） */
sup {
    font-size: 0.7em;
    vertical-align: super;
    line-height: 0;
    margin-left: 1px;
}

/* 管理画面スタイル */
.management-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #0073aa;
    /* ★追加: 幅が狭いときに折り返すようにする */
    flex-wrap: wrap;
    gap: 15px;
}

.acf-input-wrap:has(+ .char-counter) input,
textarea:has(+ .char-counter) {
  border-radius: 12px 12px 0 0;
}
textarea+.char-counter {
  margin-top: -8px;
  display: block;
}
.acf-field input[type=text], .acf-field input[type=password], .acf-field input[type=date], .acf-field input[type=datetime], .acf-field input[type=datetime-local], .acf-field input[type=email], .acf-field input[type=month], .acf-field input[type=number], .acf-field input[type=search], .acf-field input[type=tel], .acf-field input[type=time], .acf-field input[type=url], .acf-field input[type=week], .acf-field textarea, .acf-field select {
    padding: .6em !important;
}

/* --- 印刷対応（最終調整版） --- */
@media print {
    /* ページのヘッダー、フッター、サイドバーなど、印刷に不要な共通要素を非表示 */
    header, footer, nav, aside, .sidebar, .god-post_title {
        display: none !important;
    }
    /* プラグインの操作パネル（ボタンや検索フォーム）を非表示 */
    .management-header,
    .filter-section,
    .form-actions,
    .tb_turn_on {
        display: none !important;
    }

    /* ★追加: テーマのページタイトルや不要なラッパーを非表示にする */
    .entry-header, /* 一般的なテーマのタイトルラッパー */
    .post-title, /* h1など */
    .page-title {
        display: none !important;
    }
    .themify_builder_content-2235 .tb_y79s768,
    .edss-management-page {
        margin: 0 !important;
        padding: 0 !important;
    }
    .row_inner {
        max-width: 100% !important;
    } 
    
    /* ★追加: テーマが設定する可能性のある余白や幅を強制的にリセット */
    body, #content, #primary, .site-content, .entry-content, .page-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* A4プレビューのラッパーと本体のスタイルを印刷用に調整 */
    .edss-preview-wrapper {
        margin: 0 !important;
        max-width: none !important;
        width: 100% !important;
    }
    .edss-preview-container {
        border: none !important;
        box-shadow: none !important;
        margin: 0 0 10mm 0 !important;
        transform: scale(1) !important;
        width: 100% !important;
        height: auto !important;
        /* ★修正: 印刷時は内側のパディングをなくす */
        padding: 0 !important;
        /* 各演題が新しいページから始まるようにする */
        page-break-after: always;
    }
    
    /* 最後に印刷される演題の後には改ページしない */
    .abstract-item-wrapper:last-child .edss-preview-container {
        page-break-after: auto;
    }
    
    /* 印刷時のページ設定 */
    @page {
        size: A4 portrait;
        margin: 20mm 15mm;
    }
}

/* ボタンスタイル調整 */
.button-small {
    padding: 4px 8px;
    font-size: 12px;
    height: auto;
    line-height: 1.4;
}

/* フォーカス表示 */
.button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* エラー表示 */
.error {
    border-color: #d63638 !important;
    box-shadow: 0 0 5px rgba(214, 54, 56, 0.3) !important;
}


/* 添付ファイル確認画面 */
.attachments-wrapper .content-box {
    display: flex;
    justify-content: space-evenly;
    gap: 2mm;
}
.attachments-wrapper .content-box .attachment-preview img {
    display: block;
    cursor: pointer;
    border: 1px solid #ddd;
    width: auto;
    max-height: 30mm;
}
.content-box .attachment-label {
    font-size: 8pt;
}
.attachment-preview a {
    display: block;
}
.attachment-preview a img {
    cursor: pointer;
}

/* --- 演題登録フォームのACF親グループ名のみを非表示にする --- */
#abstract-submission-form .acf-field-group > .acf-label {
    display: none;
}

/* --- メニュー項目の表示条件（最終修正版） --- */

/* 「ログアウト時のみ」のルールが設定されたメニューは、ログイン時に非表示 */
body.user-logged-in li.visibility-logged_out {
    display: none !important;
}

/* 「ログイン時のみ」のルールが設定されたメニューは、ログアウト時に非表示 */
body.user-logged-out li.visibility-logged_in {
    display: none !important;
}

/* 「編集者権限以上」のルールが設定されたメニューは、編集者でも管理者でもない場合に非表示 */
body:not(.user-role-editor):not(.user-role-administrator) li.visibility-editor {
    display: none !important;
}

/* 「管理者権限のみ」のルールが設定されたメニューは、管理者でない場合に非表示 */
body:not(.user-role-administrator) li.visibility-admin {
    display: none !important;
}


/* --- 送信ボタンのスピナー表示 --- */
.form-actions .button.is-processing {
    position: relative;
    color: transparent !important; /* 元のテキストを透明にする */
    pointer-events: none; /* さらなるクリックを防ぐ */
}

.form-actions .button.is-processing::after {
    content: '\f110'; /* Font Awesomeのスピナーアイコンのコード */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;

    /* アイコンの位置とアニメーション */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff; /* アイコンの色（ボタンの背景による） */
    font-size: 1.2em;
    
    animation: fa-spin 1s infinite linear;
}

/* ボタンが .button-primary の場合、アイコンの色を調整 */
.form-actions .button.button-primary.is-processing::after {
    color: #fff;
}
/* 通常ボタンの場合、アイコンの色を調整 */
.form-actions .button:not(.button-primary).is-processing::after {
    color: #555;
}

@keyframes fa-spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}


/* 管理画面用バリデーションスタイル */
.date-validation-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 8px;
    border-radius: 4px;
    margin-top: 5px;
    font-size: 12px;
}

input[type="datetime-local"].error {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.edss-abstract-table date {
    font-size: .8em;
    display: block;
}
.edss-abstract-table .operations {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    flex-direction: row;
    gap: 5px;
}

.edss-abstract-table .title-wrapper {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
    align-items: center;
}

.edss-abstract-table .title-wrapper .status {
    background-color: #888;
    padding: .3em .8em;
    font-size: .8em;
    font-weight: 500;
    line-height: 1;
    color: #fff;
    border-radius: 50px;
    width: 6em;
    text-align: center;
}
.edss-abstract-table .title-wrapper .post-title {
    font-size: 1.2em;
    font-weight: bold;
    line-height: 1.5em;
    display: inline-block;
    border: none;
    margin: 0;
    padding: 0;
}

/* --- ステータスバッジのスタイル --- */
.edss-abstract-table .status-badge {
    display: inline-block;
    padding: .3em .8em;
    font-size: .8em;
    font-weight: 500;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 50px;
    width: 6em;
}
.edss-abstract-table .status-badge i {
    margin-right: 4px;
}

.edss-abstract-table .status-draft {
    background-color: #f0ad4e; /* オレンジ */
}
.edss-abstract-table .status-private {
    background-color: #5cb85c; /* 緑 */
}
.edss-abstract-table .status-publish {
    background-color: #0275d8; /* 青 */
}
.edss-abstract-table .status-unknown {
    background-color: #888; /* グレー */
}

.button.preview {
    background-color: #29a978;
}

.button.edit {
    background-color: #d59a34;
}

.button.delete {
    background-color: #d95a5a;
}