/* Web Workers サンプル用スタイル */

body {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #f8f9fa;
    color: #333;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.5em;
    border-bottom: 3px solid #e74c3c;
    padding-bottom: 10px;
}

h2 {
    color: #34495e;
    border-left: 5px solid #e74c3c;
    padding-left: 15px;
    margin-top: 30px;
    margin-bottom: 20px;
}

h3 {
    color: #2c3e50;
    margin-top: 25px;
    margin-bottom: 15px;
}

.container {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

/* 情報セクション */
.info-section {
    background-color: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
}

.info-section ul {
    margin: 10px 0;
    padding-left: 20px;
}

.info-section li {
    margin-bottom: 5px;
}

/* ワーカーセクション */
.worker-section,
.calculation-section,
.parallel-section,
.error-section {
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
    background-color: #fafafa;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #e74c3c;
    box-shadow: 0 0 5px rgba(231, 76, 60, 0.3);
}

/* ボタングループ */
.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    min-width: 120px;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

button:not(.danger) {
    background-color: #e74c3c;
    color: white;
}

button:not(.danger):hover {
    background-color: #c0392b;
}

button.danger {
    background-color: #d32f2f;
    color: white;
}

button.danger:hover {
    background-color: #b71c1c;
}

/* 進捗バー */
.progress-section {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

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

.progress-text {
    text-align: center;
    font-weight: bold;
    color: #555;
}

/* 出力セクション */
.output-section {
    margin-top: 20px;
    border: 1px solid #d0d0d0;
    border-radius: 5px;
    background-color: white;
}

.output-display {
    max-height: 250px;
    overflow-y: auto;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
}

.output-item {
    margin-bottom: 8px;
    padding: 5px 8px;
    background-color: white;
    border-radius: 3px;
    border-left: 3px solid #e74c3c;
}

.output-item.error {
    border-left-color: #d32f2f;
    background-color: #ffebee;
    color: #d32f2f;
}

.timestamp {
    color: #666;
    font-weight: bold;
}

.error-display .output-item {
    border-left-color: #d32f2f;
}

/* ワーカー状態表示 */
.workers-status {
    margin-top: 20px;
}

.workers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.worker-status {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    text-align: center;
}

.worker-id {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 8px;
}

.worker-state {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 8px;
}

.worker-state.running {
    background-color: #fff3cd;
    color: #856404;
}

.worker-state.completed {
    background-color: #d4edda;
    color: #155724;
}

.worker-result {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #666;
}

/* ステータスメッセージ */
.status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    font-weight: bold;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: 300px;
    word-wrap: break-word;
}

.status.success {
    background-color: #27ae60;
    color: white;
    opacity: 1;
}

.status.error {
    background-color: #e74c3c;
    color: white;
    opacity: 1;
}

/* アニメーション効果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.output-item {
    animation: fadeIn 0.3s ease;
}

.worker-status {
    animation: fadeIn 0.3s ease;
}

/* スクロールバーのスタイリング */
.output-display::-webkit-scrollbar {
    width: 6px;
}

.output-display::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.output-display::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.output-display::-webkit-scrollbar-thumb:hover {
    background: #555;
}

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

    h1 {
        font-size: 2em;
    }

    .container {
        padding: 15px;
    }

    .button-group {
        flex-direction: column;
    }

    button {
        width: 100%;
        margin-bottom: 5px;
        min-width: unset;
    }

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

    .status {
        position: relative;
        top: auto;
        right: auto;
        margin: 20px 0;
    }
}


/* アクセシビリティ */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #e74c3c;
    outline-offset: 2px;
}

/* 空の状態スタイル */
.output-display:empty::before {
    content: '出力はここに表示されます...';
    color: #999;
    font-style: italic;
    display: block;
    text-align: center;
    padding: 20px;
}

/* 警告表示 */
.warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

/* エラー表示 */
.error-display {
    background-color: #ffebee;
    border-color: #f8d7da;
}