/* ============================================
   マンション修繕計画ガントチャート - メインスタイル
   ============================================ */

/* リセット・基本設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================
   ヘッダー部
   ============================================ */
.app-header {
    background: white;
    color: #333;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-bottom: 1px solid #e0e0e0;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.header-controls {
    display: flex;
    gap: 2rem;
    align-items: center;
}

/* 表示切替ボタン */
.view-mode-buttons {
    display: flex;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 4px;
}

.view-btn {
    background: transparent;
    border: none;
    color: #333;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.view-btn:hover {
    background: rgba(0,0,0,0.05);
}

.view-btn.active {
    background: rgba(0,0,0,0.1);
    font-weight: 600;
}

.view-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 編集ボタン */
.edit-buttons {
    display: flex;
    gap: 0.5rem;
}

.edit-btn {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    color: #333;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.edit-btn:hover:not(:disabled) {
    background: #e0e0e0;
    border-color: #ccc;
}

.edit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   メイン部
   ============================================ */
.app-main {
    flex: 1;
    background: white;
    overflow: hidden;
}

.main-container {
    height: calc(100vh - 140px); /* ヘッダー・フッター分を引く */
    display: flex;
}

/* 左パネル（イベント名） */
.left-panel {
    width: 300px;
    min-width: 250px;
    background: #fafafa;
    border-right: 2px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.panel-header {
    background: #f0f0f0;
    padding: 1rem;
    border-bottom: 1px solid #ddd;
    height: calc(1rem * 2 + 1.1rem + 22px);
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

.panel-header h3 {
    font-size: 1.1rem;
    color: #555;
    margin: 0;
}

.event-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
    scroll-behavior: smooth;
    padding-top: 22px;
}

.event-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 46.2px;
    box-sizing: border-box;
}

.event-item:hover {
    background: #f0f0f0;
}

.event-item.selected {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.event-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.event-icon.completed {
    background: #10b981;
}

.event-icon.in-progress {
    background: #3b82f6;
}

.event-icon.planned {
    background: #6b7280;
}

/* 既存のタイプも新しい配色に合わせて調整 */
.event-icon.construction {
    background: #6b7280;
}

.event-icon.meeting {
    background: #f59e0b;
}

.event-name {
    font-size: 0.9rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 右パネル（ガントチャート） */
.right-panel {
    flex: 1;
    background: white;
    position: relative;
    overflow: hidden;
}

.gantt-container {
    width: 100%;
    height: 100%;
    overflow: auto;
    padding: 1rem;
}

/* ============================================
   フッター部
   ============================================ */
.app-footer {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 1rem 0;
}

.footer-container {
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 1rem !important;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 2rem !important;
}

/* 左端：入出力ボタン（大学提出版） */
.footer-left {
    display: flex !important;
    gap: 1rem !important;
    align-items: center !important;
    order: 1 !important;
    flex-shrink: 0 !important;
    flex-direction: column !important;
}

.demo-info {
    font-size: 11px;
    color: #666;
    font-weight: normal;
    white-space: nowrap;
}

/* 中央：操作説明 */
.footer-center {
    flex: 1 !important;
    padding: 0 2rem !important;
    text-align: left !important;
    order: 2 !important;
}

.instructions {
    font-size: 0.75rem;
    color: #555;
    line-height: 1.4;
}

.instructions span {
    display: inline;
}

/* 右端：ステータス表示 */
.footer-right {
    display: flex !important;
    align-items: center !important;
    margin-left: auto !important;
    order: 3 !important;
    flex-shrink: 0 !important;
}

.status-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.8rem;
    color: #666;
    text-align: right;
}

.status-line {
    display: flex;
    justify-content: flex-end;
}

.io-btn {
    background: #4caf50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.io-btn:hover {
    background: #45a049;
    transform: translateY(-1px);
}

.io-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ドロップゾーン */
.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
    min-width: 200px;
}

.drop-zone:hover {
    border-color: #4caf50;
    background: #f0f8f0;
}

.drop-zone.dragover {
    border-color: #4caf50;
    background: #e8f5e8;
    transform: scale(1.02);
}

.drop-zone p {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: #555;
}

.drop-zone small {
    color: #777;
    font-size: 0.8rem;
}

#browse-link {
    color: #4caf50;
    text-decoration: underline;
    cursor: pointer;
}

#browse-link:hover {
    color: #45a049;
}


#status-text {
    font-weight: 500;
}

/* 進捗表示 */
.progress-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.progress-bar {
    width: 200px;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #45a049);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.8rem;
    color: #666;
    min-width: 40px;
}

/* ============================================
   レスポンシブ対応 - MVP-3強化版
   ============================================ */

/* タブレット表示 */
@media (max-width: 1024px) {
    .left-panel {
        width: 250px;
        min-width: 200px;
    }
    
    .view-mode-buttons {
        flex-wrap: wrap;
    }
    
    .view-btn {
        min-width: 60px;
        padding: 6px 10px;
        font-size: 0.85rem;
    }
}

/* スマートフォン表示 */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        text-align: center;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    /* 表示モードボタンをモバイル用に調整 */
    .view-mode-buttons {
        width: 100%;
        justify-content: space-between;
    }
    
    .view-btn {
        flex: 1;
        min-width: 0;
        padding: 10px 4px;
        font-size: 0.8rem;
    }
    
    /* 日表示と週表示をモバイルでは制限 */
    .view-btn#btn-day,
    .view-btn#btn-week {
        opacity: 0.6;
    }
    
    .main-container {
        flex-direction: column;
        height: auto;
    }
    
    .left-panel {
        width: 100%;
        max-height: 200px;
        overflow-y: auto;
    }
    
    .right-panel {
        min-height: 400px;
    }
    
    .footer-container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .footer-left {
        flex-direction: column;
        align-items: stretch;
    }
    
    .footer-center {
        padding: 0;
        text-align: center;
    }
    
    .instructions {
        font-size: 0.7rem;
    }
    
    .drop-zone {
        min-width: auto;
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    .app-title {
        font-size: 1.2rem;
    }
    
    .view-mode-buttons {
        width: 100%;
    }
    
    .view-btn {
        flex: 1;
        padding: 10px 8px;
        font-size: 0.8rem;
    }
    
    .edit-buttons {
        width: 100%;
        justify-content: center;
    }
}
