/* ===================================
   リセット & ベーススタイル
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f7fa;
    overflow-x: hidden;
}

/* ===================================
   ログイン画面（初期表示・全画面表示）
   =================================== */
#loginPage {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.5s ease-in-out;
}

/* ログイン後は完全非表示 */
#loginPage.hidden {
    display: none !important;
}

.login-container {
    background: white;
    border-radius: 20px;
    padding: 50px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.6s ease-out;
}

.login-logo {
    font-size: 64px;
    color: #667eea;
    margin-bottom: 20px;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 10px;
}

.login-subtitle {
    font-size: 14px;
    color: #718096;
    margin-bottom: 30px;
}

#loginForm .form-group {
    margin-bottom: 25px;
    text-align: left;
}

#loginForm label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 8px;
}

#loginForm label i {
    margin-right: 5px;
    color: #667eea;
}

#loginForm input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

#loginForm input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.login-note {
    margin-top: 25px;
    font-size: 13px;
    color: #718096;
}

.login-note i {
    color: #667eea;
    margin-right: 5px;
}

/* ===================================
   メイン画面（初期非表示）
   =================================== */
#mainApp {
    display: none;
    min-height: 100vh;
}

/* ログイン後に表示 */
#mainApp.show {
    display: flex !important;
}

/* ===================================
   サイドバー
   =================================== */
#sidebar {
    width: 260px;
    background: linear-gradient(180deg, #2d3748 0%, #1a202c 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
}

.sidebar-header h2 i {
    margin-right: 10px;
    color: #667eea;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-size: 13px;
}

.user-info i {
    font-size: 20px;
    color: #667eea;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: #cbd5e0;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    font-size: 15px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

.nav-item i {
    font-size: 18px;
    width: 20px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout {
    width: 100%;
    padding: 12px;
    background: rgba(220, 38, 38, 0.8);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
}

.btn-logout:hover {
    background: rgba(220, 38, 38, 1);
}

/* ===================================
   メインコンテンツエリア
   =================================== */
#mainContent {
    margin-left: 260px;
    padding: 30px;
    flex: 1;
    min-height: 100vh;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.4s ease-in-out;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 10px;
}

.page-header h1 i {
    margin-right: 12px;
    color: #667eea;
}

.page-header p {
    font-size: 16px;
    color: #718096;
}

/* ===================================
   フォーム
   =================================== */
.form-container {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.form-section {
    margin-bottom: 35px;
    padding-bottom: 35px;
    border-bottom: 2px solid #e2e8f0;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section h2 {
    font-size: 20px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section h2 i {
    color: #667eea;
}

.form-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    margin: 25px 0 15px 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 8px;
}

.required {
    color: #e53e3e;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

/* ===================================
   ボタン
   =================================== */
.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

/* ===================================
   テーブル
   =================================== */
.table-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
    margin-bottom: 30px;
}

.table-container h3 {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 15px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: #f7fafc;
}

.data-table th {
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
}

.data-table th:hover {
    background: #edf2f7;
}

.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #e2e8f0;
}

.data-table tbody tr:hover {
    background: #f7fafc;
}

.data-table .amount {
    font-weight: 600;
}

.data-table .amount.positive {
    color: #38a169;
}

.data-table .amount.negative {
    color: #e53e3e;
}

/* ===================================
   検索バー
   =================================== */
.search-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.search-bar input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
}

.search-bar input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ===================================
   アサインメンバーセレクター
   =================================== */
.member-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.member-selector select {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
}

.assigned-members {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 50px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    border: 2px dashed #e2e8f0;
}

.assigned-members.empty::before {
    content: "メンバーを追加してください";
    color: #a0aec0;
    font-size: 14px;
}

.member-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.member-badge .remove-member {
    cursor: pointer;
    font-size: 16px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.member-badge .remove-member:hover {
    opacity: 1;
}

/* オートコンプリートドロップダウン */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 4px;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f7fafc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: #f7fafc;
}

.autocomplete-item.active {
    background: #edf2f7;
}

.autocomplete-item-name {
    font-weight: 600;
    color: #2d3748;
}

.autocomplete-item-details {
    font-size: 12px;
    color: #718096;
}

/* オートコンプリートセクション */
.autocomplete-section {
    border-top: 1px solid #e2e8f0;
    padding-top: 8px;
}

.autocomplete-section:first-child {
    border-top: none;
    padding-top: 0;
}

.autocomplete-section-title {
    padding: 8px 16px 4px 16px;
    font-size: 11px;
    font-weight: 700;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 提案メンバーボタン */
.suggested-member-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.suggested-member-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.suggested-member-btn i {
    font-size: 11px;
}

/* ===================================
   予算設定セクション
   =================================== */
.budget-expenses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.budget-summary {
    display: flex;
    gap: 30px;
    margin: 20px 0;
    padding: 20px;
    background: #f7fafc;
    border-radius: 8px;
}

.budget-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.budget-item span:first-child {
    font-size: 13px;
    color: #718096;
}

.budget-item .amount {
    font-size: 20px;
    font-weight: 700;
}

.budget-item .amount.positive {
    color: #38a169;
}

.budget-item .amount.negative {
    color: #e53e3e;
}

.budget-total {
    margin-top: 25px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 8px;
}

.budget-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 15px;
}

.budget-row.total {
    border-top: 2px solid #e2e8f0;
    margin-top: 10px;
    padding-top: 15px;
    font-size: 18px;
    font-weight: 700;
}

/* ===================================
   管理者ページ - タブ
   =================================== */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.tab-btn {
    padding: 12px 24px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease-in-out;
}

/* フェーズタブ（標準工数設定用） */
.phase-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0;
}

.phase-tab-btn {
    background: transparent;
    border: none;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    color: #718096;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    position: relative;
    top: 2px;
}

.phase-tab-btn:hover {
    color: #667eea;
    background: #f7fafc;
}

.phase-tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
}

.phase-tab-btn i {
    margin-right: 6px;
}

.phase-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.phase-content.active {
    display: block;
}

/* ===================================
   標準工数テーブル
   =================================== */
.standard-hours-table-container {
    overflow-x: auto;
    margin: 20px 0;
}

.standard-hours-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    white-space: nowrap;
}

.standard-hours-table thead {
    background: #f7fafc;
    position: sticky;
    top: 0;
}

.standard-hours-table th {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.standard-hours-table th.fixed-column {
    position: sticky;
    left: 0;
    background: #f7fafc;
    z-index: 2;
    text-align: left;
}

.standard-hours-table td {
    padding: 8px;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.standard-hours-table td.fixed-column {
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
    font-weight: 500;
    text-align: left;
    padding-left: 12px;
}

.standard-hours-table input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.standard-hours-table input:focus {
    outline: none;
    border-color: #667eea;
}

.help-text {
    padding: 12px;
    background: #edf2f7;
    border-left: 4px solid #667eea;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #4a5568;
}

/* ===================================
   トースト通知
   =================================== */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 24px;
    background: #2d3748;
    color: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 10000;
    max-width: 400px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: #38a169;
}

.toast.error {
    background: #e53e3e;
}

.toast.warning {
    background: #dd6b20;
}

/* ===================================
   アニメーション
   =================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   レスポンシブデザイン
   =================================== */
@media (max-width: 768px) {
    #sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    #mainContent {
        margin-left: 0;
        padding: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .search-bar,
    .member-selector,
    .form-actions {
        flex-direction: column;
    }

    .budget-summary {
        flex-direction: column;
        gap: 15px;
    }

    .tabs {
        flex-direction: column;
    }

    .standard-hours-table-container {
        font-size: 12px;
    }

    .standard-hours-table input {
        width: 60px;
    }
}
