/* === Global Reset and Variables === */
:root {
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --bg-hover: #f0f2f5;
    --accent-primary: #3b82f6;
    --accent-secondary: #6366f1;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --success: #10b981;
    --error: #ef4444;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    font-family: 'Segoe UI', sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    font-size: 15px;
}

.main-content {
    width: 100%;
}

/* === Container === */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.25rem;
}

/* === Header === */
.header {
    text-align: center;
    margin-bottom: 1rem;
}

.header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.3rem;
}

.header .subtitle,
.header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0.2rem 0;
}

/* === Path Helper Section === */
.path-helper {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.path-helper h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.path-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
}

.path-box code {
    flex: 1;
    font-family: 'Consolas', monospace;
    font-size: 0.75rem;
    color: var(--accent-primary);
    word-break: break-all;
}

.copy-btn {
    background: var(--accent-gradient);
    border: none;
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.copy-btn:hover {
    opacity: 0.9;
}

.copy-feedback {
    display: inline-block;
    margin-top: 0.3rem;
    font-size: 0.75rem;
    color: var(--success);
}

/* === Upload Section === */
.upload-section {
    background: var(--bg-white);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    margin-bottom: 0.8rem;
    box-shadow: var(--shadow-sm);
}

.upload-section:hover {
    border-color: var(--accent-primary);
}

.upload-section h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.file-input {
    color: var(--text-primary);
    font-size: 0.8rem;
}

.file-input::file-selector-button {
    background: var(--accent-gradient);
    border: none;
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    color: white;
    font-weight: 500;
    font-size: 0.8rem;
    cursor: pointer;
    margin-right: 0.5rem;
}

/* === Loading === */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.cancel-btn {
    background: #ef4444;
    border: none;
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 0.5rem;
}

.cancel-btn:hover {
    background: #dc2626;
}

/* === Error Message === */
.error-message {
    background: #fef2f2;
    border: 1px solid var(--error);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    color: var(--error);
    margin-bottom: 0.8rem;
    font-size: 0.85rem;
}

/* === Results Section === */
.results {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.8rem;
    box-shadow: var(--shadow-sm);
}

.results>h3 {
    font-size: 1rem;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
}

.team-section {
    margin-bottom: 1rem;
}

.team-section:last-child {
    margin-bottom: 0;
}

.team-section h4 {
    font-size: 0.8rem;
    color: var(--accent-secondary);
    margin-bottom: 0.4rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border-color);
}

/* === Table === */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    table-layout: fixed;
}

.col-name {
    width: 25%;
}

.col-uuid {
    width: 45%;
}

.col-platform {
    width: 15%;
}

.col-tracker {
    width: 15%;
}

.col-tracker a {
    color: var(--accent-primary);
    text-decoration: none;
}

.col-tracker a:hover {
    text-decoration: underline;
}

/* Clickable elements hover effect */
/* Clickable elements hover effect */
.col-name[style*="pointer"]:hover,
.col-uuid[style*="pointer"]:hover {
    color: var(--accent-primary);
    background-color: rgba(37, 99, 235, 0.05);
}

.col-uuid {
    width: 45%;
    padding-left: 1rem;
}

/* Tooltip behavior */
.copy-target {
    position: relative;
}

.copy-target::after {
    content: "コピーしました！";
    position: absolute;
    top: -2em;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, top 0.2s;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.copy-target.show-tooltip::after {
    opacity: 1;
    top: -2.5em;
}

thead th {
    text-align: left;
    padding: 0.4rem 0.5rem;
    background: var(--bg-light);
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background: var(--bg-hover);
}

tbody td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:last-child td {
    border-bottom: none;
}

.uuid {
    font-family: 'Consolas', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.name-history-container {
    position: relative;
    display: inline-block;
    margin-left: 0.5rem;
}

.name-history-badge {
    padding: 0.1rem 0.3rem;
    background: #fef3c7;
    border-radius: 4px;
    font-size: 0.7rem;
    color: #92400e;
    cursor: help;
}

.name-history-popup {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 0.8rem;
    border-radius: 6px;
    z-index: 20;
    min-width: 180px;
    margin-bottom: 8px;
    text-align: left;
}

.name-history-popup::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

.name-history-popup::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--border-color) transparent transparent transparent;
}

.name-history-container:hover .name-history-popup {
    display: block;
}

.popup-title {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.4rem;
    margin-bottom: 0.4rem;
}

.popup-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
}

.popup-list li {
    font-size: 0.8rem;
    padding: 0.2rem 0;
    color: var(--text-primary);
    border-bottom: 1px solid #f3f4f6;
}

.popup-list li:last-child {
    border-bottom: none;
}

/* === Blazor Overrides === */
#blazor-error-ui {
    background: var(--error);
    color: white;
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 0.5rem;
    z-index: 1000;
    font-size: 0.8rem;
}

.blazor-error-boundary {
    background: var(--error);
    padding: 0.5rem;
    color: white;
}

.loading-progress {
    position: relative;
    display: block;
    width: 6rem;
    height: 6rem;
    margin: 15vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 0.5rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--accent-primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(15vh + 2.5rem) 0 auto 0;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}