* {
    box-sizing: border-box;
}

body.esm-public-body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    /* トップページ（テーマの front-page.css）と同じ背景色 */
    background: #f6f7f9;
    color: #1f2328;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.esm-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.esm-form-wrapper {
    background: #fff;
    border: 1px solid #e4e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
    overflow: hidden;
}

/* 以前の青紫のグラデーション帯の配置は残し、色をトップページのアクセント（赤）にそろえる */
.esm-event-header {
    background: linear-gradient(135deg, #cf2030 0%, #9e1a27 100%);
    color: #fff;
    padding: 30px;
    text-align: center;
}

.esm-event-title {
    margin: 0 0 20px;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
}

.esm-event-info {
    margin-bottom: 15px;
    text-align: left;
}

.esm-event-info-label {
    font-size: 11px;
    opacity: 0.8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
    text-align: center;
}

.esm-event-info-dates {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.esm-date-list-item {
    font-size: 15px;
    font-weight: 600;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.esm-date-list-item .esm-date-label-sub {
    font-size: 13px;
    font-weight: 400;
    opacity: 0.8;
}

.esm-event-info-meta {
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    gap: 20px;
}

.esm-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

.esm-info-label {
    font-size: 11px;
    opacity: 0.8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.esm-info-value {
    font-size: 15px;
    font-weight: 600;
}

.esm-date-label-sub {
    font-size: 13px;
    font-weight: 400;
    opacity: 0.8;
}

.esm-event-description {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    margin-top: 15px;
    text-align: left;
}

.esm-event-description p:first-child {
    margin-top: 0;
}

.esm-event-description p:last-child {
    margin-bottom: 0;
}

.esm-form {
    padding: 30px;
}

.esm-form-group {
    margin-bottom: 25px;
}

.esm-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.esm-required {
    color: #e53e3e;
}

.esm-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
    padding-right: 40px;
}

.esm-select:focus {
    outline: none;
    border-color: #cf2030;
    box-shadow: 0 0 0 3px rgba(207, 32, 48, 0.12);
}

.esm-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
    background: #fff;
}

.esm-input:focus {
    outline: none;
    border-color: #cf2030;
    box-shadow: 0 0 0 3px rgba(207, 32, 48, 0.12);
}

.esm-input:disabled {
    background: #f7fafc;
    color: #666;
}

.esm-loading {
    font-size: 14px;
    color: #666;
    font-style: italic;
    margin-top: 10px;
}

.esm-category-display {
    background: #f7fafc;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 16px;
    color: #333;
    border: 2px solid #e2e8f0;
}

.esm-existing-response {
    background: #fffbeb;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #92400e;
    border: 2px solid #fcd34d;
}

.esm-radio-group {
    display: grid;
    gap: 12px;
}

.esm-radio-label {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.esm-radio-label:hover {
    border-color: #cbd5e0;
    background: #f7fafc;
}

.esm-radio-label input[type="radio"] {
    margin: 0 12px 0 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.esm-radio-label input[type="radio"]:checked {
    accent-color: #cf2030;
}

.esm-radio-label:has(input:checked) {
    border-color: #cf2030;
    background: #fff6f6;
}

.esm-radio-attend:has(input:checked) {
    border-color: #48bb78;
    background: #f0fff4;
}

.esm-radio-absent:has(input:checked) {
    border-color: #f56565;
    background: #fff5f5;
}

.esm-radio-text {
    font-size: 16px;
    font-weight: 500;
}

.esm-form-actions {
    margin-top: 30px;
}

.esm-button {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.esm-button-primary {
    background: linear-gradient(135deg, #cf2030 0%, #9e1a27 100%);
    color: #fff;
}

.esm-button-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(207, 32, 48, 0.25);
}

.esm-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.esm-result {
    padding: 30px;
}

.esm-message {
    padding: 30px;
    border-radius: 8px;
    text-align: center;
}

.esm-message h1,
.esm-message h2 {
    margin-top: 0;
}

.esm-message-success {
    background: #f0fff4;
    color: #22543d;
    border: 2px solid #9ae6b4;
}

.esm-message-info {
    background: #ebf8ff;
    color: #2c5282;
    border: 2px solid #90cdf4;
}

.esm-message-error {
    background: #fff5f5;
    color: #742a2a;
    border: 2px solid #fc8181;
}

@media (max-width: 640px) {
    body.esm-public-body {
        padding: 10px;
    }

    .esm-event-header {
        padding: 20px;
    }

    .esm-event-title {
        font-size: 20px;
    }

    .esm-form {
        padding: 20px;
    }

    .esm-info-item {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .esm-event-title {
        font-size: 18px;
    }

    .esm-info-value {
        font-size: 14px;
    }

    .esm-select,
    .esm-input,
    .esm-radio-text,
    .esm-button {
        font-size: 14px;
    }
}

/* --- 日程ごとの出欠 --- */
.esm-dates-bulk-actions {
    display: flex;
    gap: 8px;
}

.esm-button-small {
    width: auto;
    padding: 8px 16px;
    font-size: 14px;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s;
}

.esm-button-small:hover {
    background: #e2e8f0;
}

.esm-date-responses-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.esm-date-response-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.esm-date-response-label {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.esm-date-response-row .esm-radio-group {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

.esm-date-response-row .esm-radio-label {
    padding: 8px 14px;
    font-size: 14px;
}

@media (max-width: 640px) {
    .esm-date-response-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .esm-date-response-row .esm-radio-group {
        width: 100%;
    }
}

/* ------------------------------------------------------------------
   日程ごとの定員表示（満席 / 残席）
   ------------------------------------------------------------------ */
.esm-seat-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
    vertical-align: middle;
    white-space: nowrap;
}

.esm-seat-available {
    background: #e6fffa;
    color: #234e52;
    border: 1px solid #81e6d9;
}

.esm-seat-full {
    background: #fff5f5;
    color: #742a2a;
    border: 1px solid #fc8181;
}

/* 満席の日程は「参加」を選べない */
.esm-radio-label.esm-radio-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.esm-radio-label.esm-radio-disabled input {
    cursor: not-allowed;
}

/* 回答期限後の案内（閲覧のみ） */
.esm-message-notice {
    background: #fffbea;
    color: #6b4e00;
    border: 1px solid #f6d55c;
    border-radius: 6px;
    /* .esm-message の中央寄せ・大きめ余白を、案内文向けに上書きする */
    padding: 14px 16px;
    text-align: left;
}

.esm-message-notice p {
    margin: 0 0 6px;
}

.esm-message-notice p:last-child {
    margin-bottom: 0;
}

/* 入力欄の補足文（カテゴリ未登録者への案内など） */
.esm-field-note {
    margin: 6px 0 0;
    font-size: 13px;
    color: #4a5568;
}

/* カテゴリの表示行と「変更する」リンク */
.esm-category-display-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.esm-link-button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 14px;
    color: #cf2030;
    text-decoration: underline;
    cursor: pointer;
}

.esm-link-button:hover {
    color: #b01b28;
}

#cancel-category-edit {
    margin-top: 8px;
}
