/* =============================
   写メ日記投稿システム CSS
   ============================= */

.shamemail-wrap {
    max-width: 700px;
    margin: 0 auto;
    font-family: sans-serif;
}

/* フィールド */
.shamemail-field {
    margin-bottom: 20px;
}
.shamemail-field label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
}
.shamemail-field .required {
    color: #e00;
    margin-left: 4px;
}
.shamemail-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}
.shamemail-textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    resize: vertical;
}
.shamemail-char-count {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}
.shamemail-char-count.over {
    color: #e00;
    font-weight: bold;
}

/* ボタン */
.shamemail-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    color: #333;
    margin-right: 8px;
}
.shamemail-btn-primary {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}
.shamemail-btn-primary:hover {
    background: #005f8a;
}
.shamemail-btn-danger {
    background: #dc3232;
    color: #fff;
    border-color: #dc3232;
}
.shamemail-btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* エラー */
.shamemail-errors {
    background: #fff3f3;
    border: 1px solid #e00;
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 20px;
}
.shamemail-error {
    color: #e00;
    margin: 4px 0;
}
.shamemail-success {
    color: #007a00;
    font-weight: bold;
}

/* 確認画面 */
.shamemail-confirm-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}
.shamemail-confirm-table th,
.shamemail-confirm-table td {
    padding: 10px 14px;
    border: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
}
.shamemail-confirm-table th {
    background: #f5f5f5;
    width: 100px;
}

/* 送信完了 */
.shamemail-complete {
    text-align: center;
    padding: 40px;
    background: #f0f9f0;
    border-radius: 8px;
}

/* 履歴テーブル */
.shamemail-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.shamemail-history-table th,
.shamemail-history-table td {
    padding: 8px 10px;
    border: 1px solid #ddd;
    text-align: left;
}
.shamemail-history-table th {
    background: #f5f5f5;
}
.shamemail-row-failed {
    background: #fff3f3;
}

/* 予約一覧 */
.shamemail-scheduled-item {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.shamemail-scheduled-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.shamemail-scheduled-time {
    color: #0073aa;
    font-weight: bold;
}
.shamemail-scheduled-title {
    flex: 1;
}
.shamemail-scheduled-actions {
    margin-top: 10px;
}

/* 送信失敗通知 */
.shamemail-fail-notice {
    background: #fff3f3;
    border: 1px solid #dc3232;
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.shamemail-fail-notice .close-btn {
    cursor: pointer;
    font-size: 18px;
    color: #999;
    background: none;
    border: none;
    padding: 0 4px;
}
.shamemail-fail-notice .close-btn:hover {
    color: #333;
}

/* 本文50文字未満の警告 */
.shamemail-body-warning {
    color: #dc3232;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 8px;
    padding: 6px 10px;
    background: #fff3f3;
    border-left: 3px solid #dc3232;
    border-radius: 2px;
}

/* 出勤告知等はカウント対象外である旨の常時表示テキスト */
.shamemail-body-notice {
    color: #996f00;
    font-size: 12px;
    margin-bottom: 12px;
    padding: 6px 10px;
    background: #fff8e5;
    border-left: 3px solid #e0a800;
    border-radius: 2px;
}

/* 送信中スピナー */
.shamemail-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.6);
    border-top-color: #fff;
    border-radius: 50%;
    animation: shamemail-spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}
@keyframes shamemail-spin {
    to { transform: rotate(360deg); }
}
    max-width: 200px;
    margin-top: 10px;
    border-radius: 4px;
}

/* 選択時のファイル判定エラー */
.shamemail-media-error { color: #c0392b; font-weight: bold; margin: 6px 0 0; }

/* -------------------------------------------------------
 * 送信履歴：結果表示と閲覧モーダル（v1.6.0）
 * ------------------------------------------------------- */
.shamemail-result-failed-sites {
    color: #c00;
    font-size: 12px;
}
.shamemail-history-view {
    padding: 4px 12px;
    border: 1px solid #0073aa;
    border-radius: 4px;
    background: #fff;
    color: #0073aa;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.shamemail-history-view:hover,
.shamemail-history-view:focus {
    background: #0073aa;
    color: #fff;
}

/* 背景のスクロールを止める */
body.shamemail-modal-open {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
    overflow: hidden;
}

.shamemail-modal[hidden] {
    display: none !important;
}
.shamemail-modal {
    position: fixed;
    inset: 0;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 2147483000; /* テーマのヘッダー・管理バーより前面 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
}
.shamemail-modal-backdrop {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(0, 0, 0, 0.6);
}
.shamemail-modal-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 640px;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px); /* iPhoneのアドレスバーの出入りに追従 */
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    box-sizing: border-box;
}
/* ✕を含む上部の帯は固定。下の本体だけスクロールする */
.shamemail-modal-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 8px 16px;
    border-bottom: 1px solid #ddd;
    background: #fff;
}
.shamemail-modal-heading {
    font-weight: bold;
    font-size: 15px;
}
.shamemail-modal-close {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    color: #333;
    cursor: pointer;
    border-radius: 50%;
}
.shamemail-modal-close:hover,
.shamemail-modal-close:focus {
    background: #f0f0f0;
}
.shamemail-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 16px;
}
.shamemail-modal-message {
    margin: 12px 0;
    color: #666;
}
.shamemail-view-title {
    margin: 0 0 6px;
    font-size: 17px;
    word-break: break-word;
}
.shamemail-view-meta,
.shamemail-view-result {
    margin: 0 0 6px;
    font-size: 13px;
    color: #555;
}
.shamemail-view-media {
    margin: 12px 0;
    text-align: center;
    background: #f5f5f5;
    border-radius: 6px;
}
/* 縦長の画像でも本文がすぐ見えるよう、高さは画面の約6割まで */
.shamemail-view-media img,
.shamemail-view-media video {
    display: block;
    max-width: 100%;
    max-height: 60vh;
    max-height: 60dvh;
    width: auto;
    height: auto;
    margin: 0 auto;
}
.shamemail-view-media video {
    width: 100%;
    background: #000;
}
.shamemail-view-body {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
    font-size: 14px;
}

/* -------------------------------------------------------
 * 送信履歴：女性用の結果表示・月別件数、管理者の成功切り替え（v1.7.0）
 * ------------------------------------------------------- */
.shamemail-result-ok {
    color: #1a7f37;
    font-weight: bold;
    white-space: nowrap;
}
.shamemail-result-ng {
    color: #c00;
    font-weight: bold;
    white-space: nowrap;
}
.shamemail-result-contact {
    color: #c00;
    font-size: 12px;
}
.shamemail-month-summary {
    margin: 0 0 20px;
    padding: 14px 16px;
    border: 1px solid #cfe3f0;
    border-radius: 8px;
    background: #f3f9fd;
}
.shamemail-month-summary p {
    margin: 0;
}
.shamemail-month-summary-main {
    font-size: 15px;
}
.shamemail-month-summary-count {
    font-size: 28px;
    color: #0073aa;
    margin: 0 2px 0 6px;
    line-height: 1.2;
}
.shamemail-month-summary-sub {
    margin-top: 4px !important;
    font-size: 13px;
    color: #555;
}
.shamemail-month-heading {
    margin: 20px 0 8px;
    padding-left: 8px;
    border-left: 4px solid #0073aa;
    font-size: 16px;
}
.shamemail-result-form {
    margin: 6px 0 0;
}

/* -------------------------------------------------------
 * 送信履歴（全員）：女性別の投稿数（v1.8.0）
 * ------------------------------------------------------- */
.shamemail-admin-summary {
    margin: 16px 0 24px;
    max-width: 720px;
}
.shamemail-admin-summary-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 8px;
}
.shamemail-admin-summary-head h2 {
    margin: 0;
    font-size: 16px;
}
.shamemail-admin-summary-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}
.shamemail-admin-summary-tools label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.shamemail-admin-summary-table th.num,
.shamemail-admin-summary-table td.num {
    text-align: right;
    width: 70px;
}
.shamemail-admin-summary-table .shamemail-summary-failed {
    color: #c00;
    font-weight: bold;
}
.shamemail-admin-summary-table tr.shamemail-summary-selected td {
    background: #e7f3fb;
}
.shamemail-summary-toggle-wrap {
    margin: 8px 0 0;
}
.shamemail-summary-filter-status {
    margin: 8px 0 0;
    padding: 6px 10px;
    background: #fff8e5;
    border-left: 4px solid #dba617;
}
.shamemail-summary-filter-status[hidden] {
    display: none;
}
