/* リセットCSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基本スタイル */
body {
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

/* ヘッダー */
header {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    color: #4a5568;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1rem;
    color: #718096;
}

/* 手順説明セクション */
.instructions-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #667eea;
}

.instructions-header {
    text-align: center;
    margin-bottom: 20px;
}

.instructions-header h3 {
    font-size: 1.3rem;
    color: #4a5568;
    margin: 0;
}

.instructions-toggle {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.toggle-icon {
    font-size: 1rem;
    transition: transform 0.3s ease;
    display: none;
}

.instructions-toggle.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.instructions-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 140px;
    padding: 15px 10px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 12px;
    border: 2px solid #e2e8f0;
}

.step-number {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 10px;
}

.step-content {
    font-size: 0.9rem;
    color: #4a5568;
    line-height: 1.4;
}

.step-content strong {
    color: #2d3748;
}

.step-arrow {
    font-size: 1.5rem;
    color: #667eea;
    font-weight: bold;
    margin: 0 5px;
}

/* 入力セクション */
.input-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.input-container {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 10px;
    color: #4a5568;
    font-size: 1.1rem;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    resize: vertical;
    transition: border-color 0.3s ease;
}

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

/* 期間選択スタイル */
.period-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.period-selector label {
    font-size: 1rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 0;
    white-space: nowrap;
}

.period-dropdown {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
    min-width: 120px;
}

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

/* タブスタイル */
.tabs-container {
    margin-bottom: 20px;
}

.tabs-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.tab-buttons {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    gap: 5px;
}

.tab-button {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #718096;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tab-button:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: bold;
}

.tab-button .close-btn {
    margin-left: 8px;
    color: #a0aec0;
    font-weight: bold;
    font-size: 1.2rem;
    line-height: 1;
}

.tab-button .close-btn:hover {
    color: #e53e3e;
}

.add-tab-btn {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-left: 10px;
}

.add-tab-btn:hover {
    background: #5a67d8;
}

.tabs-content {
    position: relative;
}

.tab-content {
    display: none;
}

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

.tab-status {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.tab-status.success {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.tab-status.error {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #fc8181;
}

.tab-status.warning {
    background: #fefcbf;
    color: #744210;
    border: 1px solid #f6e05e;
}

.analyze-btn {
    width: 100%;
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

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

/* 結果セクション */
.results-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* サマリーカード */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.summary-card h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.summary-card p {
    font-size: 1.5rem;
    font-weight: bold;
}

/* チャートコンテナ */
.chart-container {
    margin-bottom: 30px;
}

.chart-container h2 {
    text-align: center;
    margin-bottom: 10px;
    color: #4a5568;
    font-size: 1.8rem;
}

.chart-description {
    text-align: center;
    margin-bottom: 20px;
    color: #718096;
    font-size: 1rem;
    font-style: italic;
}

.chart-container canvas {
    max-height: 800px;
    min-height: 200px;
}

/* チャートヘッダー */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.chart-title-section {
    flex: 1;
}

.chart-title-section h2 {
    margin: 0 0 10px 0;
}

.chart-title-section .chart-description {
    margin: 0;
}

/* ダウンロードボタン */
.download-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
    white-space: nowrap;
}

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

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

.download-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}


/* エラーセクション */
.error-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.error-message {
    text-align: center;
    color: #e53e3e;
}

.error-message h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.error-message p {
    margin-bottom: 10px;
}

/* プライバシー通知 */
.privacy-notice {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 25px;
    border-radius: 15px;
    margin: 30px 0;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    border-left: 4px solid #4fd1c5;
}

.privacy-notice h3 {
    color: #2d3748;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.privacy-notice p {
    color: #4a5568;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.privacy-notice ul {
    list-style-type: none;
    padding-left: 0;
}

.privacy-notice li {
    padding: 6px 0;
    color: #4a5568;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.privacy-notice li:before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* フッター */
footer {
    color: rgba(255, 255, 255, 0.9);
    padding: 30px 20px;
    margin-top: 40px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-section {
    display: flex;
    align-items: center;
}

.copyright {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.8;
}

.footer-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

.footer-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    color: white;
}

.link-icon {
    font-size: 1.1rem;
}

.github-icon {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.footer-link:hover .github-icon {
    transform: scale(1.1);
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .input-section,
    .results-section,
    .error-section {
        padding: 20px;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .analyze-btn {
        font-size: 1.1rem;
    }
    
    .period-selector {
        gap: 10px;
    }
    
    .tab-button {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .download-btn {
        align-self: flex-end;
        font-size: 0.8rem;
        padding: 8px 12px;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .footer-links {
        gap: 16px;
    }
    
    .footer-link {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
    
    .instructions-section {
        padding: 20px;
    }
    
    .toggle-icon {
        display: inline-block !important;
    }
    
    .instructions-steps {
        flex-direction: column;
        gap: 10px;
        max-height: 1000px;
        overflow: hidden;
        transition: max-height 0.3s ease, opacity 0.3s ease;
        opacity: 1;
    }
    
    .instructions-steps.collapsed {
        max-height: 0;
        opacity: 0;
        margin-top: 0;
    }
    
    .step {
        min-width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .step-arrow {
        transform: rotate(90deg);
        font-size: 1.2rem;
    }
}

/* ローディングアニメーション */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a67d8;
}
