:root {
    --primary-color: #e74c3c;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #c0392b;
    --warning-color: #f39c12;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --border-color: #bdc3c7;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    color: var(--dark-color);
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow-hover);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, var(--primary-color), #c0392b);
    color: white;
    padding: 12px 15px;
    text-align: center;
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

header h1 i {
    font-size: 1.4rem;
}

.subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* タブナビゲーション */
.tab-navigation {
    display: flex;
    background: var(--light-color);
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--dark-color);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tab-btn:hover {
    background: rgba(231, 76, 60, 0.1);
}

.tab-btn.active {
    background: white;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.tab-btn i {
    font-size: 1rem;
}

/* タブコンテンツ */
.tab-content {
    display: none;
    padding: 12px 15px;
    animation: fadeIn 0.4s ease;
}

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

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

/* カード */
.card {
    background: white;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card h2, .card h3 {
    color: var(--dark-color);
    margin-bottom: 10px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card h2 i, .card h3 i {
    color: var(--primary-color);
    font-size: 0.9rem;
}

/* アップロードエリア */
.upload-area {
    text-align: center;
    padding: 20px;
}

#csvFile {
    display: none;
}

.upload-label {
    display: block;
    padding: 40px 30px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.upload-label:hover {
    border-color: var(--primary-color);
    background: rgba(231, 76, 60, 0.05);
}

.upload-label i {
    font-size: 3rem;
    color: var(--primary-color);
    display: block;
    margin-bottom: 12px;
}

.upload-label span {
    font-size: 1rem;
    color: var(--dark-color);
}

/* ボタン */
.btn {
    padding: 8px 20px;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

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

.btn-danger:hover:not(:disabled) {
    background: #a93226;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.3);
}

/* ステータスメッセージ */
.status-message {
    margin-top: 15px;
    padding: 10px 12px;
    border-radius: 5px;
    display: none;
    font-size: 0.9rem;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.status-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    display: block;
}

/* プレビューセクション */
.preview-section {
    margin-top: 20px;
}

.preview-info {
    background: var(--light-color);
    padding: 10px 12px;
    border-radius: 5px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.preview-info p {
    margin: 3px 0;
}

/* フィルター */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.85rem;
}

.filter-group select,
.filter-group input[type="text"],
.filter-group input[type="date"],
.date-input {
    padding: 7px 10px;
    border: 1.5px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.filter-group select:focus,
.filter-group input[type="text"]:focus,
.filter-group input[type="date"]:focus,
.date-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.date-input {
    cursor: pointer;
}

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

.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 10px;
    border-radius: 6px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-3px);
}

.summary-card:nth-child(2) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.summary-card:nth-child(3) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.summary-card:nth-child(4) {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.summary-icon {
    font-size: 1.3rem;
    opacity: 0.9;
}
}

.summary-content h3,
.summary-info h3 {
    font-size: 0.65rem;
    margin-bottom: 2px;
    opacity: 0.9;
}

.summary-value {
    font-size: 0.9rem;
    font-weight: 700;
}

/* チャートグリッド */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 15px;
}

.chart-card {
    min-height: 400px;
}

.chart-select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    background: white;
    color: var(--dark-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.chart-select:hover {
    border-color: var(--primary-color);
}

.chart-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

/* テーブル */
.table-container {
    overflow-x: auto;
}

/* 日付グループ */
.date-group {
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    background: white;
}

.date-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    transition: background 0.3s ease;
    user-select: none;
}

.date-header:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3c8f 100%);
}

.date-content {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

.date-title {
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
    gap: 8px;
}
    gap: 10px;
    font-size: 1.1rem;
}

.date-title i {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.date-title i.fa-chevron-down {
    transform: rotate(0deg);
}

.date-title i.fa-chevron-right {
    transform: rotate(0deg);
}

.date-summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 8px;
    border-radius: 15px;
}

.summary-item i {
    font-size: 0.75rem;
}

.date-delete-btn {
    background: rgba(231, 76, 60, 0.9);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

.date-delete-btn:hover {
    background: rgba(192, 57, 43, 1);
    transform: scale(1.05);
}

.date-delete-btn:active {
    transform: scale(0.95);
}

.date-delete-btn i {
    font-size: 0.75rem;
}

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

thead {
    background: var(--dark-color);
    color: white;
}

th, td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
}

tbody tr:hover {
    background: rgba(231, 76, 60, 0.05);
}

tbody tr:last-child td {
    border-bottom: none;
}

.delete-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background 0.3s ease;
}

.delete-btn:hover {
    background: #a93226;
}

/* データコントロール */
.data-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.data-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#searchInput {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    min-width: 250px;
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ページネーション */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    padding: 20px;
}

.pagination-info {
    padding: 15px;
    background: var(--light-color);
    border-radius: 6px;
    margin-bottom: 15px;
    font-weight: 600;
}

/* ローディングオーバーレイ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        max-height: 2000px;
        transform: translateY(0);
    }
}

.loading-overlay p {
    color: white;
    font-size: 1.2rem;
    margin-top: 20px;
}

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

    .tab-btn {
        font-size: 0.85rem;
        padding: 15px 10px;
    }

    .tab-btn span {
        display: none;
    }

    .tab-content {
        padding: 15px;
    }

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

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

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

    .data-header {
        flex-direction: column;
        align-items: stretch;
    }

    .data-controls {
        flex-direction: column;
    }

    #searchInput {
        width: 100%;
    }

    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    header {
        padding: 20px 15px;
    }

    header h1 {
        font-size: 1.5rem;
        flex-direction: column;
    }

    .card {
        padding: 15px;
    }

    .upload-label {
        padding: 40px 20px;
    }

    .upload-label i {
        font-size: 3rem;
    }
}

/* 天気・気温列のスタイル */
.date-content table th:nth-child(2),
.date-content table th:nth-child(3),
.date-content table td:nth-child(2),
.date-content table td:nth-child(3) {
    text-align: center;
    white-space: nowrap;
}

.date-content table th:nth-child(2),
.date-content table td:nth-child(2) {
    min-width: 80px;
    font-weight: 600;
}

.date-content table th:nth-child(3),
.date-content table td:nth-child(3) {
    min-width: 60px;
    font-weight: 600;
    color: #e74c3c;
}

/* 天気に応じた色分け（日本語表記） */
.date-content table td:nth-child(2) {
    font-weight: bold;
}

/* デフォルトスタイルは既存の設定を使用 */

