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

body {
    /*background-color: #f5f7fa;*/
    background: radial-gradient(
        circle 1000px,
        rgb(203, 248, 239),
        rgb(72, 134, 204)
    );
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    overflow-x: auto;  /* Move scroll to body level */
    padding: 0 1rem;  /* Add some padding to prevent container from touching edges */
}

.container {
    min-width: 1200px;  /* Changed from max-width to min-width */
    width: fit-content;  /* Allow container to grow with content */
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.reference-species {
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
}

.label-input-container label {
    margin-right: 1rem;
    font-weight: 500;
    color: #2c3e50;
}

.label-input-container input {
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    width: 100px;
}

#csv-upload {
    border: none;
    width: 200px;
}

.reference-species button {
    font-size: 15px;
    padding: 8px 18px;
    max-width: 200px;
}

.matrix-table {
    min-width: 100%;  /* Changed from width to min-width */
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 2rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.matrix-table th,
.matrix-table td {
    border: 1px solid #e2e8f0;
    padding: 8px;
    text-align: center;
    min-width: 40px;
    max-width: none;
}

.matrix-table th {
    background-color: #f1f5f9;
    font-weight: 600;
    color: #334155;
}

.matrix-table input {
    width: calc(100% - 16px);
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    transition: border-color 0.2s;
    font-size: 14px;
    text-align: center;
}

.matrix-table input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.matrix-table input.binary {
    min-width: 40px;
    max-width: none;
    width: calc(100% - 10px);
    text-align: center;
    font-weight: 500;
    font-size: clamp(14px, 1.5vw, 18px);
}

.matrix-table input.species-name {
    min-width: 80px;
    max-width: none;
    width: calc(100% - 10px);
    font-weight: 1000;
    font-size: clamp(12px, 1.2vw, 16px);
}

.matrix-table input.character,
.matrix-table input.state {
    min-width: 80px;
    max-width: none;
    width: calc(100% - 10px);
    font-size: clamp(14px, 1.2vw, 16px);
}

.buttons-and-status {
    display: flex;
    justify-content: space-between;
}

.status-message {
    visibility: hidden;
    width: 50%;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 25px;
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
    border-radius: 8px;
    background: #f8fafc;
    color: red;
}

.buttons {
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    width: 12.5rem;
}

button {
    padding: 10px 20px;
    background-color: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
    flex: 0 0 calc(50% - 0.5rem);
}

button:hover {
    background-color: #2563eb;
}

#remove-column,
#remove-row {
    background-color: #ef4444;
}

#remove-column:hover,
#remove-row:hover {
    background-color: #dc2626;
}

.results {
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
    border-radius: 8px;
    background: #f8fafc;
}

.results h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #334155;
    font-weight: 600;
}

.results-content {
    min-height: 100px;
    padding: 1rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-family:'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}

.results-content p {
    font-size: 20px;
}

.results-content ul {
    list-style: none;
    font-size: 19px;
}

.results-content li {
    padding: 5px 0;
}

/* Hover effects */
.matrix-table tr:hover {
    background-color: #f8fafc;
}

.matrix-table td:hover {
    background-color: #f1f5f9;
}

.title-section {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #e2e8f0;
}

.title-section h1 {
    color: #334155;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.title-section p {
    color: #64748b;
    font-size: 1.1rem;
    font-weight: 400;
}

.credit {
    background-color: rgb(236, 236, 236);
    width: fit-content;
    font-size: 1.5rem;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.credit .links {
    display: flex;
    justify-content: space-evenly;
}

.credit a {
    text-decoration: none;
    color: black;
    font-size: 1.3rem;
    margin-top: 10px;
}

.credit a:hover {
    color: #3b82f6;
    text-decoration: underline;
}

.tree-results {
    width: 70%;
    margin-left: auto;
    margin-right: auto;
    display: none;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    min-height: 300px;
    margin-top: 2rem;
    margin-bottom: 2rem;
    background: #f8fafc;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tree-container {
    margin-left: auto;
    margin-right: auto;
    margin-top: 5rem;
    margin-bottom: 2rem;
    background: #eff1f6;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.save-tree {
    margin: 20px;
    visibility: hidden;
}

.save-tree-wrapper {
    background: #eff1f6;
    padding: 1px;
    display: inline-block;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-right: 2rem;
    margin-bottom: 2rem;
    visibility: hidden;
}