body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

h1 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5em;
    font-weight: 300;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* DBファイルパス表示 */
.db-file-path {
    text-align: center;
    font-size: 1.1em;
    color: #495057;
    margin: 10px 0 20px;
    padding: 8px 16px;
    background: #e7f3ff;
    border-radius: 6px;
    border-left: 4px solid #007bff;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.2em;
    font-weight: 600;
    color: #495057;
    margin-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 8px;
}

/* 折りたたみ可能なセクションのスタイル */
.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.2em;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 8px;
    margin-bottom: 15px;
    user-select: none;
}

.collapsible-header:hover {
    color: #007bff;
}

.collapsible-header::after {
    content: 'Down Arrow';
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.collapsible-header.collapsed::after {
    content: 'Right Arrow';
}

.collapsible-content {
    display: block;
    overflow: hidden;
    max-height: 1000px;
    transition: max-height 0.3s ease-in-out;
}

.collapsible-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

#tableList {
    list-style: none;
    padding: 0;
    margin: 0;
}

.table-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.table-item:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-2px);
}

.table-item.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.2);
    transform: translateY(-2px);
}
    
.table-item.active .row-count {
    color: #fff;
}

.row-count {
    font-size: 0.8em;
    color: #6c757d;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: #0056b3;
}

.btn.secondary {
    background-color: #6c757d;
}

.btn.secondary:hover {
    background-color: #5a6268;
}

.btn.small {
    padding: 6px 12px;
    font-size: 0.9em;
}

#quickActions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

#queryInput {
    width: 100%;
    height: 150px;
    padding: 15px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    background: #fff;
    box-sizing: border-box;
    resize: vertical;
}

.query-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    margin-bottom: 20px;
}

.query-controls .btn {
    flex: 1;
}

/* クエリ結果の横スクロールスタイル */
.result-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-top: 10px;
}

.result-table {
    min-width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.result-table th,
.result-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    white-space: nowrap;
}

.result-table th {
    background-color: #e9ecef;
    font-weight: 600;
    color: #495057;
    position: sticky;
    top: 0;
    z-index: 10;
}

.result-table tr:hover {
    background-color: #f8f9fa;
}

/* テーブルスキーマの横スクロールコンテナ */
.schema-table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    max-height: 400px;
    overflow-y: auto;
}

.schema-table {
    min-width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.schema-table th,
.schema-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    white-space: nowrap;
}

.schema-table th {
    background-color: #e9ecef;
    font-weight: 600;
    color: #495057;
    position: sticky;
    top: 0;
    z-index: 10;
}

.schema-table tr:hover {
    background-color: #f8f9fa;
}

/* スクロールバーのスタイリング */
.result-container::-webkit-scrollbar,
.schema-table-container::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.result-container::-webkit-scrollbar-track,
.schema-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.result-container::-webkit-scrollbar-thumb,
.schema-table-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.result-container::-webkit-scrollbar-thumb:hover,
.schema-table-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.result-container::-webkit-scrollbar-corner,
.schema-table-container::-webkit-scrollbar-corner {
    background: #f1f1f1;
}

.loading, .error, .info, .success {
    padding: 20px;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 20px;
}

.loading {
    background: #e9ecef;
    color: #6c757d;
}

.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#dbInfoResult pre {
    background: #e9ecef;
    padding: 15px;
    border-radius: 8px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
}

.stats {
    display: flex;
    justify-content: space-around;
    text-align: center;
    margin: 20px 0;
}

.stat-item {
    flex: 1;
    padding: 15px;
    border-radius: 8px;
    background: #fff;
    margin: 0 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #007bff;
}

.stat-label {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 5px;
}

.query-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.query-header #tableName {
    font-size: 1.1em;
    font-weight: 600;
    color: #007bff;
    background: #e7f3ff;
    padding: 4px 12px;
    border-radius: 4px;
}

.debug-info {
    background: #212529;
    color: #f8f9fa;
    padding: 12px;
    margin: 15px 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 11px;
    border-radius: 8px;
    white-space: pre-wrap;
    border: 1px solid #495057;
}

.debug-info.warning {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8787 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    border: 2px solid #ff4757;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7);
    }
    50% {
        box-shadow: 0 0 20px 10px rgba(255, 71, 87, 0);
    }
}

.port-guide {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.port-guide-content {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

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

.port-guide-content h2 {
    color: #ff6b6b;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.port-guide-content p {
    color: #495057;
    line-height: 1.6;
    margin-bottom: 20px;
}

.port-guide-example {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #007bff;
}

.port-guide-examples {
    background: #e9ecef;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
}

.port-guide-examples code,
.port-guide-example code {
    background: #495057;
    color: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    display: inline-block;
    margin: 2px 0;
}

.port-guide-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.port-guide-buttons .btn {
    flex: 1;
    min-width: 120px;
}

@media (max-width: 768px) {
    .container { padding: 15px; }
    h1 { font-size: 2em; }
    .query-controls { flex-direction: column; }
    .query-controls .btn { width: 100%; }
    .stats { flex-direction: column; }
    .stat-item { margin: 5px 0; }
}