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

:root {
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-bg: #1e293b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ヘッダー */
header {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 12px;
}

.timestamp {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-family: monospace;
}

/* セクション共通 */
section {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
}

section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

/* ステータスグリッド */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.status-card {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.status-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.status-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.loading {
    color: var(--warning-color);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 統計グリッド */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 3rem;
    line-height: 1;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.stat-new {
    border-color: var(--primary-color);
}
.stat-new .stat-value {
    color: var(--primary-color);
}

.stat-used {
    border-color: var(--success-color);
}
.stat-used .stat-value {
    color: var(--success-color);
}

.stat-skip {
    border-color: var(--warning-color);
}
.stat-skip .stat-value {
    color: var(--warning-color);
}

.stat-total {
    border-color: var(--secondary-color);
}
.stat-total .stat-value {
    color: var(--secondary-color);
}

/* アクションボタン */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.action-btn {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.action-btn:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

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

.btn-icon {
    font-size: 2.5rem;
}

.btn-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn-scan {
    border-color: var(--primary-color);
}
.btn-scan:hover {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.btn-build {
    border-color: var(--warning-color);
}
.btn-build:hover {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.btn-refresh {
    border-color: var(--success-color);
}
.btn-refresh:hover {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.btn-catalog {
    border-color: var(--secondary-color);
}
.btn-catalog:hover {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
}

/* プロジェクト一覧 */
.projects-list {
    display: grid;
    gap: 12px;
}

.project-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    transition: all 0.2s ease;
}

.project-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.project-name {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--text-primary);
}

.project-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.project-meta {
    margin-bottom: 8px;
}

.project-modified {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.project-path {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
    background: rgba(0, 0, 0, 0.05);
    padding: 6px 10px;
    border-radius: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.empty-hint {
    font-size: 0.875rem;
    margin-top: 8px;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    border: none;
    padding: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.catalog-content {
    padding: 24px;
}

.catalog-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.catalog-table th {
    background: var(--dark-bg);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
}

.catalog-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}

.catalog-table tr:hover {
    background: #f8fafc;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

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

.badge-used {
    background: var(--success-color);
    color: white;
}

.badge-skip {
    background: var(--warning-color);
    color: white;
}

/* 通知 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    display: none;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

.notification.show {
    display: block;
}

.notification.success {
    background: var(--success-color);
    color: white;
}

.notification.error {
    background: var(--danger-color);
    color: white;
}

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

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* フッター */
footer {
    text-align: center;
    padding: 20px;
    color: white;
    font-size: 0.875rem;
}

/* 管理ダッシュボード追加スタイル */
.header {
    background: white;
    padding: 20px 30px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 0;
}

.header-info {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.main-content {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 24px;
}

.main-content h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.main-content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

.bg-secondary {
    background: #f8fafc;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    section {
        padding: 16px;
    }

    section h2 {
        font-size: 1.25rem;
    }

    .stats-grid,
    .actions-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-icon {
        font-size: 2.5rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .modal-content {
        max-height: 95vh;
    }

    .catalog-table {
        font-size: 0.75rem;
    }

    .catalog-table th,
    .catalog-table td {
        padding: 8px;
    }

    .notification {
        left: 10px;
        right: 10px;
        top: 10px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 20px;
    }

    header h1 {
        font-size: 1.25rem;
    }

    .subtitle {
        font-size: 0.875rem;
    }

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

    .project-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}
