/* ============================================
   基本スタイル
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f5f5;
    overflow: hidden;
    height: 100vh;
}

/* ============================================
   ヘッダー（メンバー一覧）
   ============================================ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    z-index: 100;
    display: flex;
    align-items: stretch;
    height: 70px;
}

.members {
    display: inline-flex;
    padding: 12px 8px;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    align-items: center;
}

/* ============================================
   メンバーコンポーネント
   ============================================ */

.member {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin: 0 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.avatar {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.status-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
}

/* ステータス色 */
.status-in {
    background: #4caf50;
}

.status-away {
    background: #ff9800;
}

.status-incollege {
  background: #ff3b3b;
}

.status-outside {
    background: #9e9e9e;
}

.member-name {
    margin-top: 4px;
    font-size: 11px;
    color: #666;
    max-width: 70px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   カレンダーコンテナ
   ============================================ */

.calendar-container {
    margin-top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.calendar {
    display: flex;
    min-width: max-content;
}

/* ============================================
   カレンダー内：時間列
   ============================================ */

.time-column {
    width: 50px;
    flex-shrink: 0;
    background: #fafafa;
    border-right: 1px solid #e0e0e0;
}

.time-slot {
    height: 60px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 4px 8px 0 0;
    font-size: 11px;
    color: #999;
}

/* ============================================
   カレンダー内：メンバー列
   ============================================ */

.member-column {
    width: 80px;
    flex-shrink: 0;
    border-right: 1px solid #e0e0e0;
    position: relative;
}

.member-column.highlight {
    background: rgba(33, 150, 243, 0.1);  /* 薄い背景色 */
    border-left: 3px solid #2196f3;      /* 左線でアクティブ表示 */
}

.member-slot {
    height: 60px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background 0.2s;
}

.member-slot:hover {
    background: #f9f9f9;
}

/* ============================================
   イベント・予定表示
   ============================================ */

.event {
    position: absolute;
    left: 2px;
    right: 2px;
    padding: 4px;
    border-radius: 4px;
    font-size: 10px;
    color: white;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.9;
}

.event:hover {
    opacity: 1;
}

.event-text {
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-time {
    font-size: 9px;
    opacity: 0.9;
}

/* ============================================
   ヘッダーボタン（新規メンバー追加）
   ============================================ */

.create-btn {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #4caf50;
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    position: fixed;
    z-index: 200;
}

.create-btn:hover {
    background: #45a049;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.create-btn:active {
    transform: scale(0.95);
}

/* デスクトップ版：IoTボタンの上隣に表示 */
@media (min-width: 1024px) {
    .create-btn {
        display: flex;
        bottom: 86px;
        right: 20px;
    }
}

/* ============================================
   制御ボタン（ロック・エアコン・照明）
   ============================================ */

.control-btn {
    position: fixed;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 200;
}

.control-btn_icon {
    font-size: 3rem;
}

.control-btn:active {
    transform: scale(0.95);
}

/* ロックボタン */
.lock-btn {
    bottom: 20px;
    right: 20px;
}

.lock-btn.locked {
    background: #f44336;
}

.lock-btn.unlocked {
    background: #4caf50;
}

/* エアコンボタン */
.aircon-btn {
    bottom: 20px;
    left: 20px;
}

.aircon-btn.on {
    background: #2196f3;
}

.aircon-btn.off {
    background: #bdbdbd;
}

/* 照明ボタン */
.light-btn {
    bottom: 86px;
    left: 20px;
}

.light-btn.on {
    background: #ffc107;
}

.light-btn.off {
    background: #bdbdbd;
}

/* モーダルトリガーボタン */
.modal-trigger {
    bottom: 20px;
    right: 20px;
    background: #9c27b0;
    width: 64px;
    height: 64px;
}

.modal-icon {
    margin : 0 auto;
    display: flex;
    font-size: 32px;
}

/* hidden クラス */
.hidden {
    display: none !important;
}

/* PCレスポンシブで非表示（1024px以上） */
.hide-on-desktop {
    display: flex !important;
}

@media (min-width: 1024px) {
    .hide-on-desktop {
        display: none !important;
    }
}

/* ============================================
   モーダル
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 300px;
    overflow: hidden;
}

.modal-header {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 16px;
    display: flex;
    justify-content: space-around;
    gap: 8px;
}

.modal-btn {
    position: static !important;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

/* ============================================
   アイコン
   ============================================ */

.icon {
    width: 28px;
    height: 28px;
    fill: white;
}

.add-member-icon {
    width: 28px;
    height: 28px;
    fill: white;
}

/* デスクトップアカウント作成ボタンのアイコンスタイル */
.create-btn .icon {
    width: 32px;
    height: 32px;
    fill: white;
}

/* ============================================
   現在時刻マーカー
   ============================================ */

.current-time-marker {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #f44336;
    z-index: 50;
    pointer-events: none;
}

.current-time-marker::before {
    content: '';
    position: absolute;
    left: 0;
    top: -4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f44336;
}

/* ============================================
   レスポンシブデザイン（1024px以上：デスクトップ）
   ============================================ */

@media (min-width: 1024px) {
    /* ヘッダーをサイドバーに変更 */
    .header {
        top: 0;
        left: 0;
        bottom: 0;
        width: 140px;
        height: 100vh;
        position: fixed;
        border-right: 1px solid #e0e0e0;
        background: white;
        z-index: 100;
        display: flex;
        flex-direction: column;
    }

    .members {
        display: flex;
        flex-direction: column;
        padding: 16px 8px;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .member {
        margin: 10px 0;
    }

    /* ユーザー作成ボタンをサイドバー下部に配置 */
    .create-btn {
        flex-shrink: 0;
        margin: 8px;
        width: 48px;
        height: 48px;
    }

    /* カレンダーをサイドバーの右に配置 */
    .calendar-container {
        margin-top: 0;
        margin-left: 140px;
        height: 100vh;
        overflow-x: auto;
        overflow-y: auto;
    }

    .calendar {
        min-width: 1000px;
    }

    /* 制御ボタンの位置を微調整
    .lock-btn {
        right: 20px;
        bottom: 20px;
    }

    .aircon-btn {
        left: 20px;
        bottom: 20px;
    }

    .light-btn {
        left: 20px;
        bottom: 86px;
    } */
}