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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 20px;
}

.warning-box {
    background: rgba(255, 193, 7, 0.15);
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 15px;
    text-align: left;
}

.warning-box h3 {
    color: #ffc107;
    margin-bottom: 10px;
    font-size: 1rem;
}

.warning-box ul {
    list-style: none;
    font-size: 0.9rem;
}

.warning-box li {
    margin: 5px 0;
    padding-left: 20px;
    position: relative;
}

.warning-box li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #ffc107;
}

.usage {
    padding: 20px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.usage h2 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 10px;
}

.usage ol {
    margin-left: 25px;
    color: #555;
}

.usage li {
    margin: 5px 0;
}

.collapsible {
    border-bottom: 1px solid #e9ecef;
}

.collapse-btn {
    width: 100%;
    padding: 15px 30px;
    background: white;
    border: none;
    text-align: left;
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.collapse-btn:hover {
    background: #f8f9fa;
}

.collapse-btn .icon {
    margin-right: 10px;
    transition: transform 0.3s;
    display: inline-block;
}

.collapse-btn.collapsed .icon {
    transform: rotate(-90deg);
}

.collapse-content {
    padding: 0 30px 20px;
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.collapse-content.hidden {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.pdf-links {
    list-style: none;
    margin: 15px 0;
}

.pdf-links li {
    margin: 10px 0;
}

.pdf-links a {
    color: #2a5298;
    text-decoration: none;
    padding: 8px 12px;
    display: inline-block;
    border-radius: 4px;
    background: #e8f0fe;
    transition: background 0.2s;
}

.pdf-links a:hover {
    background: #d0e2ff;
}

.note {
    color: #666;
    font-size: 0.85rem;
    font-style: italic;
}

.file-upload-area {
    margin: 15px 0;
}

#file-input {
    display: none;
}

.file-label {
    display: inline-block;
    padding: 12px 24px;
    background: #2a5298;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.file-label:hover {
    background: #1e3c72;
}

.drop-zone {
    margin-top: 15px;
    padding: 40px;
    border: 3px dashed #ccc;
    border-radius: 8px;
    text-align: center;
    color: #666;
    transition: all 0.2s;
}

.drop-zone.drag-over {
    border-color: #2a5298;
    background: #e8f0fe;
    color: #2a5298;
}

.progress-container {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.progress-container h4 {
    margin-bottom: 10px;
    color: #333;
}

.progress-item {
    margin: 10px 0;
}

.progress-item .filename {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 5px;
}

.progress-bar {
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
}

.progress-complete {
    background: #28a745 !important;
}

#data-status {
    margin: 15px 0;
}

.data-year-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 15px 0;
}

.data-year-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.data-year-item.not-loaded {
    border-left-color: #dc3545;
    opacity: 0.6;
}

.data-year-item .year-label {
    font-weight: bold;
}

.data-year-item .status {
    font-size: 0.85rem;
    color: #666;
}

.data-year-item button {
    padding: 4px 8px;
    font-size: 0.8rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.data-year-item button:hover {
    background: #c82333;
}

.data-actions {
    margin-top: 15px;
}

.btn-danger {
    padding: 10px 20px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-primary {
    padding: 10px 20px;
    background: #2a5298;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #1e3c72;
}

.search-area {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
    align-items: flex-end;
}

.search-field {
    flex: 1;
    min-width: 150px;
}

.search-field label {
    display: block;
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 5px;
    font-weight: 500;
}

#search-input,
#school-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

#search-input:focus,
#school-input:focus {
    outline: none;
    border-color: #2a5298;
}

.search-results {
    margin-top: 15px;
    max-height: 500px;
    overflow-y: auto;
}

.result-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 10px 0;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.result-item:hover {
    background: #e8f0fe;
    transform: translateX(5px);
}

.result-item .name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
}

.result-item .affiliation {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

.no-results {
    text-align: center;
    padding: 30px;
    color: #666;
}

.results-section {
    margin-bottom: 15px;
}

.results-section-title {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e9ecef;
}

.result-count {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
}

/* ポップアップ */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup-overlay.show {
    display: flex;
}

.popup-content {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.popup-close:hover {
    color: #333;
}

#popup-body h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 15px;
}

#popup-body .old-names {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.history-list {
    list-style: none;
}

.history-list li {
    padding: 10px;
    border-left: 3px solid #2a5298;
    margin: 10px 0;
    background: #f8f9fa;
}

.history-list .year {
    font-weight: bold;
    color: #2a5298;
}

.history-list .transfer {
    margin-top: 5px;
    color: #555;
}

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

    header h1 {
        font-size: 1.5rem;
    }

    .collapse-btn {
        padding: 12px 15px;
        font-size: 1rem;
    }

    .collapse-content {
        padding: 0 15px 15px;
    }

    .search-area {
        flex-direction: column;
    }

}

.search-area .btn-primary {
    flex-shrink: 0;
}

footer {
    background: #f8f9fa;
    padding: 20px 30px;
    text-align: center;
    border-top: 1px solid #e9ecef;
}

footer .tar-meaning {
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

footer .copyright {
    color: #888;
    font-size: 0.8rem;
}
