/* ===========================
   Shift Manager Public CSS
   =========================== */

.sm-public-wrap {
    max-width: 720px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Noto Sans JP', sans-serif;
}

/* ヘッダー */
.sm-pub-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.sm-pub-title { margin: 0; font-size: 1.4em; }
.sm-pub-user  { margin: 0; color: #666; font-size: 0.9em; }

/* 月ナビ */
.sm-pub-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}
.sm-nav-btn {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f0f0f0;
    text-decoration: none;
    color: #333;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}
.sm-nav-btn:hover { background: #e0e0e0; }
.sm-nav-disabled { opacity: 0.4; cursor: default; pointer-events: none; }
.sm-nav-label { font-size: 1.2em; font-weight: bold; min-width: 120px; text-align: center; }

/* 凡例 */
.sm-deadline-banner {
    background: #fff8e1;
    border: 1px solid #ffcc80;
    border-left: 4px solid #f57c00;
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: .95em;
    color: #5d4037;
}

.sm-pub-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.82em;
}
.sm-legend { display: flex; align-items: center; gap: 4px; }
.sm-legend::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
}
.sm-legend-selected::before  { background: #2271b1; }
.sm-legend-pending::before   { background: #f0ad4e; }
.sm-legend-approved::before  { background: #5cb85c; }

/* カレンダー */
.sm-pub-calendar {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.sm-pub-cal-head {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #2271b1;
    color: #fff;
}
.sm-pub-cal-dow {
    text-align: center;
    padding: 8px 0;
    font-size: 0.85em;
    font-weight: bold;
}
.sm-dow-sun { color: #ffb3b3; }
.sm-dow-sat { color: #b3d4ff; }

.sm-pub-cal-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.sm-pub-cal-cell {
    min-height: 60px;
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
    padding: 6px 4px 4px;
    position: relative;
    text-align: center;
    font-size: 0.9em;
    transition: background 0.15s;
}
.sm-pub-cal-cell:nth-child(7n) { border-right: none; }

.sm-cell-selectable {
    cursor: pointer;
    touch-action: manipulation;
}
@media (hover: hover) {
    .sm-cell-selectable:hover { background: #f0f7ff; }
}

.sm-cell-day {
    display: block;
    font-size: 1em;
    margin-bottom: 2px;
}
.sm-cell-sun .sm-cell-day { color: #c0392b; }
.sm-cell-sat .sm-cell-day { color: #2271b1; }

.sm-cell-today { background: #fffde7; }
.sm-cell-today .sm-cell-day { font-weight: bold; }

.sm-cell-empty  { background: #fafafa; }
.sm-cell-past   { background: #f5f5f5; color: #bbb; cursor: default; }
.sm-cell-past .sm-cell-day { color: #bbb; }

/* 選択済み */
.sm-cell-selected {
    background: #dbeafe !important;
    border: 2px solid #2271b1;
}
.sm-cell-selected .sm-cell-day { color: #1d4ed8; font-weight: bold; }
.sm-cell-selected::after {
    content: '✔';
    display: block;
    font-size: 0.8em;
    color: #2271b1;
}

/* 申請済み */
.sm-cell-pending  { background: #fff8e1; border: 2px solid #f0ad4e; cursor: pointer; }
.sm-cell-pending .sm-cell-day { color: #b8860b; }

/* 承認済み */
.sm-cell-approved { background: #f0fff4; border: 2px solid #5cb85c; cursor: default; }
.sm-cell-approved .sm-cell-day { color: #276228; }

.sm-cell-tag {
    display: block;
    font-size: 0.68em;
    line-height: 1.2;
    color: #555;
    margin-top: 2px;
}

/* エントリーフォーム */
.sm-pub-entries {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.sm-pub-entries h3 { margin-top: 0; }
.sm-pub-hint { font-size: 0.88em; color: #666; margin-bottom: 16px; }

.sm-entry-row {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #f9fbff;
    position: relative;
}
.sm-entry-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.sm-entry-date-label {
    font-weight: bold;
    font-size: 1em;
}
.sm-entry-remove {
    background: none;
    border: none;
    color: #c0392b;
    cursor: pointer;
    font-size: 1.1em;
    padding: 0 4px;
    line-height: 1;
}
.sm-entry-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}
@media (max-width: 540px) {
    .sm-entry-fields { grid-template-columns: 1fr 1fr; }
}
.sm-entry-fields label { font-size: 0.82em; color: #555; display: block; }
.sm-entry-fields input[type="time"],
.sm-entry-fields input[type="text"],
.sm-entry-fields textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
    margin-top: 2px;
}
.sm-entry-note { grid-column: 1 / -1; }
.sm-entry-note textarea { resize: vertical; min-height: 44px; }

/* ボタン */
.sm-pub-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.sm-btn {
    display: inline-block;
    padding: 10px 22px;
    border: none;
    border-radius: 5px;
    font-size: 0.95em;
    cursor: pointer;
    transition: opacity 0.2s;
}
.sm-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.sm-btn-primary   { background: #2271b1; color: #fff; }
.sm-btn-primary:hover   { background: #1a5a9a; }
.sm-btn-secondary { background: #f0f0f0; color: #333; border: 1px solid #ccc; }
.sm-btn-secondary:hover { background: #e0e0e0; }
.sm-btn-cancel    { background: none; border: 1px solid #c0392b; color: #c0392b; padding: 4px 12px; font-size: 0.82em; border-radius: 4px; }
.sm-btn-cancel:hover { background: #fdf0ee; }

/* 通知 */
.sm-notice {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.95em;
    line-height: 1.6;
}
.sm-notice-success { background: #d4edda; border: 1px solid #5cb85c; color: #155724; }
.sm-notice-error   { background: #f8d7da; border: 1px solid #e74c3c; color: #721c24; }
.sm-notice-warning { background: #fff3cd; border: 1px solid #f0ad4e; color: #856404; }
.sm-notice a { color: inherit; font-weight: bold; }

/* 複数枠 取り消しパネル */
#sm-cancel-panel {
    background: #fff8e1;
    border: 2px solid #f0ad4e;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 14px 0;
}
.sm-cancel-panel-date-label { font-weight: 700; margin-bottom: 10px; font-size: 1.0em; }
.sm-cancel-section-title { font-weight: 600; font-size: 0.88em; color: #666; margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .03em; }
.sm-cancel-slot-list { list-style: none; margin: 0 0 14px; padding: 0; }
.sm-cancel-slot-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #f0e0b0;
}
.sm-cancel-slot-row:last-child { border-bottom: none; }
.sm-cancel-slot-time { font-size: 0.95em; font-weight: 600; }

/* 申請履歴 */
.sm-my-requests-wrap { margin-top: 8px; }
.sm-pub-section-title { font-size: 1.15em; margin-bottom: 12px; }
.sm-no-data { color: #888; font-style: italic; }

.sm-req-list { display: flex; flex-direction: column; gap: 10px; }
.sm-req-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 14px 16px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.sm-req-date  { font-weight: bold; margin-bottom: 4px; }
.sm-req-time  { font-size: 0.9em; color: #444; margin-bottom: 4px; }
.sm-req-type-dot {
    display: inline-block; width: 9px; height: 9px;
    border-radius: 50%; margin-right: 4px; vertical-align: middle;
}
.sm-req-note  { font-size: 0.85em; color: #666; margin-bottom: 6px; }
.sm-req-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.sm-req-date-created { font-size: 0.8em; color: #999; }

.sm-status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: bold;
}
.sm-status-pending  { background: #fff3cd; color: #856404; }
.sm-status-approved { background: #d4edda; color: #155724; }
.sm-status-rejected { background: #f8d7da; color: #721c24; }

/* 受付なし（休業日） */
.sm-cell-closed {
    background: #f0f0f0;
    color: #aaa;
    cursor: not-allowed;
}
.sm-cell-closed .sm-cell-day { color: #bbb; }
.sm-cell-closed .sm-cell-tag { color: #999; font-size: 0.68em; }

/* エントリー行の受付時間ヒント */
.sm-entry-time-hint {
    font-size: 0.8em;
    color: #2271b1;
    background: #e8f4fc;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: auto;
    margin-left: 8px;
}

/* 凡例に休業日を追加 */
.sm-legend-closed::before { background: #d0d0d0; }

/* シフト種別説明バッジ */
.sm-type-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.sm-type-badge {
    display: flex;
    flex-direction: column;
    padding: 6px 12px;
    border-left: 4px solid #2271b1;
    background: #f9fbff;
    border-radius: 0 4px 4px 0;
    font-size: 0.85em;
    line-height: 1.4;
}
.sm-type-badge strong { font-size: 1em; }
.sm-type-badge span   { color: #555; }

/* シフト種別セレクト行 */
.sm-entry-fields-type {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
/* 時間枠セレクトがある場合: slot | type を並べ、備考を全幅に */
.sm-entry-fields-type.sm-has-slot-select {
    grid-template-columns: 1fr 1fr;
}
.sm-entry-fields-type.sm-has-slot-select .sm-entry-note {
    grid-column: 1 / -1;
}
@media (max-width: 540px) {
    .sm-entry-fields-type { grid-template-columns: 1fr; }
    .sm-entry-fields-type.sm-has-slot-select { grid-template-columns: 1fr; }
}
.sm-entry-type-col { display: flex; flex-direction: column; gap: 6px; }
.sm-entry-type-col label { font-size: 0.85em; color: #555; }
.sm-entry-type-col select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
    margin-top: 2px;
}
/* 時間枠セレクト列 */
.sm-entry-slot-col { display: flex; flex-direction: column; gap: 6px; }
.sm-entry-slot-col label { font-size: 0.85em; color: #555; }
.sm-entry-slot-col select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #2271b1;
    border-radius: 4px;
    font-size: 0.95em;
    margin-top: 2px;
    background: #f0f6fc;
}
/* 無効状態のシフト種別セレクト */
.sm-type-select:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* 時間プレビュー */
.sm-time-preview {
    display: inline-block;
    padding: 3px 10px;
    border-left: 3px solid #2271b1;
    background: #e8f4fc;
    border-radius: 0 4px 4px 0;
    font-size: 0.85em;
    color: #1a5a9a;
}

/* 複数申請可能な日のセル */
.sm-cell-multi::after {
    content: '＋';
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 0.75em;
    color: #2271b1;
    opacity: 0.6;
    line-height: 1;
}
.sm-cell-multi:hover::after { opacity: 1; }
