* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0a0e14 0%, #1a202c 100%);
    min-height: 100vh;
    padding: 20px;
    color: #e2e8f0;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

.header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #4299e1 0%, #38b2ac 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.header p {
    font-size: 1.2rem;
    color: #a0aec0;
    font-weight: 400;
}

.input-section {
    background: #1a202c;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    margin-bottom: 30px;
    border: 1px solid #2d3748;
}

.input-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 10px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-label::before {
    content: '';
    width: 4px;
    height: 16px;
    background: linear-gradient(180deg, #4299e1 0%, #38b2ac 100%);
    border-radius: 2px;
}

.form-input, .form-select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #2d3748;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #0d1117;
    color: #e2e8f0;
    font-family: inherit;
}

.form-input:hover, .form-select:hover {
    background: #2d3748;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #4299e1;
    background: #0d1117;
    box-shadow: 0 0 0 4px rgba(66, 153, 225, 0.15);
    transform: translateY(-1px);
}

.input-hint {
    font-size: 0.85rem;
    color: #a0aec0;
    margin-top: 6px;
    font-style: italic;
}

.query-btn {
    width: 100%;
    padding: 16px 32px;
    background: linear-gradient(135deg, #4299e1 0%, #38b2ac 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.3);
}

.query-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.query-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(66, 153, 225, 0.4);
}

.query-btn:hover::before {
    left: 100%;
}

.query-btn:active {
    transform: translateY(0);
}

.loading {
    text-align: center;
    padding: 60px 40px;
    background: #1a202c;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    margin-bottom: 30px;
    border: 1px solid #2d3748;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #4a5568;
    border-top-color: #63b3ed;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    color: #e2e8f0;
    font-size: 1.2rem;
    font-weight: 500;
}

.result-section {
    background: #1a202c;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    margin-bottom: 30px;
    border: 1px solid #2d3748;
}

.result-header {
    margin-bottom: 30px;
    padding-bottom: 24px;
    border-bottom: 2px solid #4a5568;
}

.result-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.result-header h2 {
    color: #e2e8f0;
    font-size: 2rem;
    margin: 0;
    font-weight: 700;
}

.download-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.download-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.csv-btn {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.csv-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(72, 187, 120, 0.4);
}

.json-btn {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.json-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(66, 153, 225, 0.4);
}

.info-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding: 16px;
    background: #0d1117;
    border-radius: 12px;
    border: 1px solid #2d3748;
}

.location-info, .source-info, .period-info, .address-info {
    font-size: 0.95rem;
    color: #a0aec0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.location-info span:first-child, .source-info span:first-child, .period-info span:first-child, .address-info span:first-child {
    font-weight: 700;
    color: #e2e8f0;
}

.main-table-container {
    overflow-x: auto;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    margin-top: 24px;
    border: 1px solid #2d3748;
}

.main-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    min-width: 900px;
    background: #1a202c;
}

.main-data-table th {
    background: linear-gradient(135deg, #4299e1 0%, #38b2ac 100%);
    color: white;
    padding: 16px 14px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
    position: relative;
}

.main-data-table th:first-child {
    border-radius: 16px 0 0 0;
}

.main-data-table th:last-child {
    border-radius: 0 16px 0 0;
}

.main-data-table th .unit {
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 400;
    display: block;
    margin-top: 4px;
    font-style: italic;
}

.main-data-table th .source-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.25);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    margin-left: 8px;
    font-style: normal;
}

.main-data-table td {
    padding: 14px 14px;
    border-bottom: 1px solid #2d3748;
    color: #cbd5e0;
    text-align: center;
    transition: background-color 0.2s;
}

.main-data-table tbody tr {
    transition: all 0.2s ease;
}

.main-data-table tbody tr:hover td {
    background: #2d3748;
}

.main-data-table tbody tr:last-child td {
    border-bottom: none;
}

.main-data-table tbody tr:last-child:hover td {
    border-radius: 0 0 16px 16px;
}

.main-data-table tfoot {
    background: linear-gradient(135deg, rgba(99, 179, 237, 0.15) 0%, rgba(72, 187, 120, 0.15) 100%);
}

.main-data-table tfoot td {
    padding: 18px 14px;
    font-weight: 700;
    color: #e2e8f0;
    border-top: 2px solid #2d3748;
}

.main-data-table tfoot td .unit {
    font-size: 0.85rem;
    font-weight: 500;
    color: #a0aec0;
    margin-left: 6px;
}

.log-section {
    background: #0d1117;
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    margin-top: 30px;
    border: 1px solid #2d3748;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #1a202c;
}

.log-header h3 {
    color: #63b3ed;
    font-size: 1.3rem;
    margin: 0;
    font-weight: 600;
}

.log-actions {
    display: flex;
    gap: 10px;
}

.copy-log-btn, .clear-log-btn {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.copy-log-btn {
    background: #63b3ed;
    color: #1a202c;
    border: none;
}

.copy-log-btn:hover {
    background: #4299e1;
    transform: translateY(-1px);
}

.copy-log-btn.copied {
    background: #68d391;
}

.clear-log-btn {
    background: #2d3748;
    color: #e2e8f0;
    border: 1px solid #4a5568;
}

.clear-log-btn:hover {
    background: #4a5568;
}

.log-content {
    background: #0d1117;
    border-radius: 12px;
    padding: 20px;
    max-height: 350px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Monaco', 'Consolas', 'Liberation Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.8;
}

.log-content::-webkit-scrollbar {
    width: 8px;
}

.log-content::-webkit-scrollbar-track {
    background: #1a202c;
    border-radius: 4px;
}

.log-content::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

.log-content::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

.log-content p {
    margin: 6px 0;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
}

.log-content .log-info {
    color: #63b3ed;
}

.log-content .log-success {
    color: #68d391;
}

.log-content .log-error {
    color: #fc8181;
}

.log-content .log-warning {
    color: #f6e05e;
}

.log-content .log-url {
    color: #b794f4;
    word-break: break-all;
    font-size: 0.85rem;
}

.footer {
    text-align: center;
    margin-top: 40px;
    padding: 24px;
    color: #718096;
    font-size: 0.95rem;
}

.footer a {
    color: #4299e1;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.footer a:hover {
    color: #38b2ac;
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .header p {
        font-size: 1rem;
    }

    .input-section, .result-section {
        padding: 20px;
        border-radius: 16px;
    }

    .input-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .result-header-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .result-header h2 {
        font-size: 1.5rem;
    }

    .info-row {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }

    .location-info, .source-info, .period-info, .address-info {
        font-size: 0.9rem;
    }

    .main-data-table {
        font-size: 0.85rem;
    }

    .main-data-table th,
    .main-data-table td {
        padding: 10px 8px;
    }

    .spinner {
        width: 50px;
        height: 50px;
    }

    .loading p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.6rem;
    }

    .download-btn {
        width: 100%;
        justify-content: center;
    }

    .log-header {
        flex-direction: column;
        gap: 12px;
    }

    .log-actions {
        width: 100%;
    }

    .copy-log-btn, .clear-log-btn {
        flex: 1;
        text-align: center;
    }
}
