/* リセットと基本スタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --secondary-color: #64748B;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --border-color: #E2E8F0;
    --bg-light: #F8FAFC;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

/* ローディング */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading.hidden {
    display: none;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* コンテナ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ヘッダー */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
}

.header h1 {
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.header h1 i {
    margin-right: 10px;
}

/* ページ表示制御 */
.page {
    display: block;
}

.page.hidden {
    display: none;
}

/* カード */
.card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-lg);
}

.card-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--text-primary);
}

.section-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
    border-left: 4px solid var(--primary-color);
    padding-left: 12px;
}

/* フォーム */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.required {
    color: var(--danger-color);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

textarea.form-control {
    resize: vertical;
}

/* 日付・時間範囲セレクター */
.date-range-selector,
.time-range-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.date-input-group,
.time-input-group {
    flex: 1;
    min-width: 150px;
}

.date-input-group label,
.time-input-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.date-separator,
.time-separator {
    font-weight: 600;
    color: var(--text-secondary);
    padding-top: 20px;
}

/* ボタン */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.btn i {
    font-size: 1.1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-large {
    width: 100%;
    justify-content: center;
    padding: 16px 32px;
    font-size: 1.1rem;
}

/* イベントヘッダー */
.event-header {
    margin-bottom: 20px;
}

.event-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.event-description {
    color: var(--text-secondary);
    margin-bottom: 15px;
    line-height: 1.6;
}

.event-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 12px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.event-info span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.event-info i {
    color: var(--primary-color);
}

/* 操作説明 */
.instructions {
    background: var(--bg-light);
    border-left: 4px solid var(--primary-color);
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
}

.instructions p {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    padding: 5px 0;
    padding-left: 20px;
    position: relative;
    color: var(--text-secondary);
}

.instructions li:before {
    content: "•";
    position: absolute;
    left: 5px;
    color: var(--primary-color);
    font-weight: bold;
}

/* カレンダーグリッド */
.calendar-grid {
    overflow: auto;
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 600px;
    position: relative;
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.calendar-table th,
.calendar-table td {
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: center;
    user-select: none;
}

.calendar-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
    z-index: 20;
}

.calendar-table .time-header {
    background: var(--bg-light);
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
    min-width: 80px;
    position: sticky;
    left: 0;
    z-index: 15;
}

.calendar-table thead .time-header {
    z-index: 25;
}

.calendar-table .date-header {
    min-width: 100px;
    padding: 12px 8px;
}

.time-slot {
    cursor: pointer;
    transition: background-color 0.2s;
    height: 35px;
    position: relative;
}

.time-slot:hover {
    background: rgba(255, 193, 7, 0.2);
}

.time-slot.selected {
    background: #FFC107;
    color: #1E293B;
    font-weight: 600;
}

.time-slot.selected:hover {
    background: #FFB300;
}

/* 複数参加者の表示用 */
.time-slot .participant-names {
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.3;
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.time-slot.occupied-1 {
    background: rgba(16, 185, 129, 0.2);
    color: #065F46;
}

.time-slot.occupied-2 {
    background: rgba(16, 185, 129, 0.4);
    color: #065F46;
}

.time-slot.occupied-3 {
    background: rgba(16, 185, 129, 0.6);
    color: #064E3B;
}

.time-slot.occupied-4 {
    background: rgba(16, 185, 129, 0.8);
    color: white;
}

.time-slot.occupied-5plus {
    background: rgba(16, 185, 129, 1);
    color: white;
}

.time-slot.selected.occupied-1,
.time-slot.selected.occupied-2,
.time-slot.selected.occupied-3,
.time-slot.selected.occupied-4,
.time-slot.selected.occupied-5plus {
    background: #FFC107;
    color: #1E293B;
}

/* 参加者リスト */
.participants-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.participant-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.participant-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}

.participant-name {
    font-weight: 600;
    color: var(--text-primary);
}

.participant-slots {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

/* レスポンシブ */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .card {
        padding: 20px;
    }

    .card-title {
        font-size: 1.5rem;
    }

    .date-range-selector,
    .time-range-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .date-separator,
    .time-separator {
        padding-top: 0;
        text-align: center;
    }
}
