/* General Page Layout */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    color: #333;
    min-width: 1100px; /* fits 13" MacBook browser width comfortably */
}
/* Better sizing model */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Header Section with H1 and Form */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 98%;
    margin: 0;
    padding: 16px 12px 16px 12px;
    background: linear-gradient(to bottom, #3a3a3a, #5a5a5a); /* Gradient from left to right */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* h1 {
    color: #e0e0e0;
    font-size: 2.5em;
    margin: 0;
} */

/* Form Section */
.form-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 1 auto; /* shrink to content by default */
    justify-content: flex-start;
}
/* Tighter spacing for the main controls row (share + URL + buttons) */
.form-section.form-main {
    gap: 8px;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    flex: 1 1 auto; /* allow growing */
}
.header > .form-section:last-child {
    flex: 0 0 auto;
}

.form-section #uri {
    width: 50%; /* default when not in grid */
    min-width: 480px;
    padding: 10px 10px 10px 12px; /* tighter, cleaner line */
    margin-left: 0;
    margin-right: 0; /* rely on container gap */
    border-radius: 1px;
    border: 1px solid #ccc;
    background-color: #fff;
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    font-size: 1.1em;
}
.form-main #uri {
    flex: 1 1 auto;
    width: auto;
    min-width: 420px;
}

.form-section #clan_parser {
    width: 30%; /* Narrower to fit header */
    min-width: 220px;
    padding: 15px 0 15px 20px;
    margin-left: 10px;
    border-radius: 1px;
    border: 1px solid #ccc;
    background-color: #fff;
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 1.2em;
    margin-right: 10px;
}

.form-section button {
    padding: 15px 20px;
    border: none;
    background-color: #888; /* Metallic gray */
    color: #fff;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 1.2em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.form-section button:hover {
    background-color: #666; /* Darker metallic gray */
}

/* Compact icon-only button (e.g., share) */
.form-section .icon-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0; /* hide any text spacing */
}
.form-section .icon-btn svg {
    width: 70%;
    height: 70%;
}
.form-section .icon-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Keep header controls on a single line */
.header {
    flex-wrap: nowrap;
}

/* Refresh control with inline checkbox */
.refresh-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.refresh-full {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: #eaeaea;
    font-size: 0.95em;
    line-height: 1;
    user-select: none;
}
.refresh-full input[type='checkbox'] {
    width: 14px;
    height: 14px;
    margin: 0;
}
.refresh-full span {
    display: block;
    margin-top: 2px;
}

/* Full-Window Layout for Tables */
.result-section {
    display: flex;
    justify-content: space-around; /* Spread tables out */
    align-items: stretch; /* Ensures both tables stretch to the same height */
    flex-grow: 0.9;
    width: 100%;
    padding: 20px;
}

.result-container {
    display: flex;
    gap: 20px;
    width: 100%;
}

.team-table-wrapper {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    flex: 1;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.players-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    flex-grow: 1; /* Allows the table to stretch to fill the available space */
}

/* Metallic headers */
.players-table th,
.players-table td {
    padding-top: 4px;
    padding-left: 0px;
    padding-right: 1px;
    padding-bottom: 4px;
    border: 1px solid #ddd;
    color: #333;
    font-size: 0.9em;
}

.players-table th {
    background-color: #888; /* Metallic gray */
    color: white;
    font-weight: bold;
}

.players-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.players-table tr:hover {
    background-color: #e1e9ef;
}

h3 {
    margin-bottom: 0;
    padding-bottom: 0;
}

.muertos {
    position: absolute;
    color: rgb(150, 2, 2);
    left: 0;
    top: 50%;
    transform: translateY(-50%); /* Vertically centers the element */
}

.team-title {
    position: relative;
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
    text-align: center;
}

.copy-button {
    margin-top: 10px;
    padding: 10px 15px;
    background-color: #888; /* Metallic gray */
    color: #fff;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.copy-button:hover {
    background-color: #666; /* Darker metallic gray */
}

.hidden-textarea {
    display: none;
}

.spinner {
    border: 6px solid #f3f3f3; /* Light grey */
    border-top: 6px solid #3498db; /* Blue */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;

    /* Positioning */
    position: fixed; /* Fixed position relative to the viewport */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Center the spinner */
    z-index: 9999; /* Ensure it appears above other elements */
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .result-container {
        flex-direction: column;
    }

    .team-table-wrapper {
        max-width: 100%;
        margin-bottom: 20px;
    }

    .form-section input[type='text'] {
        width: 90%;
        min-width: unset; /* Removes the min-width on small screens */
    }
}

.team-text-box {
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ccc;
    padding: 10px;
}
textarea {
    width: 100%;
    height: 50px;
    resize: none;
}
.player-entry {
    display: inline-block;
    width: calc(33.33% - 10px);
    margin-bottom: 1px;
    padding: 1px;
    box-sizing: border-box;
}
.player-table {
    display: flex;
    flex-wrap: wrap;
}

/* Nick tooltip (hover details) */
.nick-tooltip {
    position: absolute;
    background: #ffffff;
    color: #222;
    border: 1px solid #bfc7cf;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    pointer-events: none;
}
.nick-tooltip .label {
    color: #555;
}
.nick-tooltip .value {
    font-weight: bold;
    margin-left: 6px;
}

/* Runes in tooltip */
.rune-container {
    margin-top: 4px;
    display: inline-flex;
    gap: 4px;
}
.rune-item {
    position: relative;
    width: 30px;
    height: 30px;
    display: inline-block;
}
.rune-item img {
    display: block;
    width: 30px;
    height: 30px;
}
.rune-count {
    position: absolute;
    right: -2px;
    bottom: -2px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 10px;
    padding: 0 3px;
    border-radius: 3px;
}

.team {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    padding: 10px;
    height: 100%;
}

.tooltip {
    position: absolute;
    background-color: #333;
    color: #fff;
    padding: 5px;
    border-radius: 5px;
    z-index: 1000;
}
