/* グローバルスタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'メイリオ', Meiryo, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* ヘッダー */
header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

header nav {
    margin-top: 15px;
}

.back-button {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid white;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: white;
    color: #667eea;
}

/* メインコンテンツ */
main {
    max-width: 1400px;
    margin: 0 auto;
}

section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.8rem;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

/* 日付セレクター */
.date-selector {
    display: flex;
    align-items: center;
    gap: 15px;
}

.date-selector label {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1rem;
}

.date-selector select {
    padding: 10px 15px;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    background: white;
    transition: all 0.3s ease;
}

.date-selector select:hover {
    border-color: #764ba2;
    box-shadow: 0 2px 8px rgba(102,126,234,0.2);
}

/* サマリーカード */
.summary-card h2 {
    margin-bottom: 20px;
}

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

.stat {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.stat-value {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
}

/* パターングリッド */
.pattern-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.pattern-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.pattern-card:hover {
    border-color: #667eea;
    box-shadow: 0 5px 20px rgba(102,126,234,0.3);
    transform: translateY(-5px);
}

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

.pattern-header h3 {
    color: #667eea;
    font-size: 1.3rem;
}

.pattern-count {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1rem;
}

.pattern-description {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.conditions-summary {
    margin-bottom: 15px;
}

.conditions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.condition-item {
    background: #f5f5f5;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    color: #555;
    border: 1px solid #e0e0e0;
}

.view-button {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-button:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(102,126,234,0.4);
}

/* スクリーニング条件セクション */
.conditions-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.conditions-box {
    background: white;
    border-radius: 10px;
    padding: 20px;
    border: 2px solid #667eea;
}

.conditions-box h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.conditions-box ul {
    list-style: none;
    padding-left: 0;
}

.conditions-box li {
    padding: 10px;
    margin-bottom: 8px;
    background: #f9f9f9;
    border-left: 4px solid #667eea;
    border-radius: 5px;
    font-size: 1rem;
}

/* テーブルスタイル */
.stocks-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.table-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.table-controls label {
    font-weight: bold;
    color: #667eea;
}

.table-controls select {
    padding: 8px 12px;
    border: 2px solid #667eea;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    background: white;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

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

thead th {
    padding: 15px;
    text-align: left;
    font-weight: bold;
    font-size: 0.95rem;
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: #f5f7fa;
}

tbody td {
    padding: 12px 15px;
    font-size: 0.95rem;
}

tbody td.ticker {
    font-weight: bold;
    color: #667eea;
}

tbody td.number {
    text-align: right;
    font-family: 'Courier New', monospace;
}

tbody td.sector {
    color: #666;
    font-size: 0.9rem;
}

/* フッター */
footer {
    text-align: center;
    color: white;
    margin-top: 40px;
    padding: 20px;
    opacity: 0.8;
}

footer p {
    margin: 5px 0;
}

/* エラー表示 */
.error {
    background: #fee;
    color: #c00;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #c00;
    font-weight: bold;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

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

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

    .stocks-section .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    table {
        font-size: 0.85rem;
    }

    thead th, tbody td {
        padding: 10px 8px;
    }
}

/* DataTables カスタムスタイル */
.dataTables_wrapper {
    padding: 20px;
    background: white;
    border-radius: 8px;
}

.dataTables_filter input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-left: 8px;
}

.dataTables_length select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 0 8px;
}

.dataTables_info {
    padding: 10px 0;
    color: #666;
}

.dataTables_paginate {
    padding: 10px 0;
}

.dataTables_paginate .paginate_button {
    padding: 6px 12px;
    margin: 0 2px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

.dataTables_paginate .paginate_button:hover {
    background: #667eea;
    color: white !important;
    border-color: #667eea;
}

.dataTables_paginate .paginate_button.current {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    border-color: #667eea;
}

.dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

table.dataTable thead th {
    cursor: pointer;
}

table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    opacity: 0.5;
}

/* 右寄せ列 */
.dt-right {
    text-align: right !important;
}

/* ティッカーリンク */
.ticker a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.ticker a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.ticker a:visited {
    color: #667eea;
}
