/* ------------------------------ HORSE INFO PAGE ------------------------------ */
.DetailsContainer {
    display: flex;
    flex-direction: column;
    padding: 10px;
    gap: 20px;
    width: 100%;
}

.horseExtraContent {
    width: 100%;
}

.top-side {
    text-align: center;
}

.top-side h1 {
    font-size: 2em;
}

.top-side h3 {
    padding-bottom: 10px;
}

.top-side input {
    border: 1px solid #ccc;
    text-align: center;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 1em;
    font-family: inherit;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-top: 5px;
    margin-bottom: 10px;
    width: 60%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.top-side input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.edit-and-delete-buttons {
    display: flex;
    justify-content: end;
}

.edit-btn, .delete-btn {
    margin-left: 4px;
    cursor: pointer;
}

.details-container {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.left-side {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.horseImage {
    width: 100%;
    max-width: 700px;
    aspect-ratio: 6 / 5; /* maintains a 700x500 shape */
    object-fit: cover;
    border-radius: 8px;
    display: block;
}


.skillsAndJumps {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 15px;
}

.skillBox {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #f4f4f4;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
}

.skillIcon {
    width: 24px;
    height: 24px;
    object-fit: cover;
}

.skillLevel {
    font-size: 1em;
    color: #555;
    font-weight: bold;
}

.skillBox:not(:last-child) {
    margin-right: 10px;
}

.right-side {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.right-side h3{
    text-align: start;
    padding: 0;
    margin: 0;
    font-size: 25px;
}

.horseDetails p {
    font-size: 1.2em;
    color: #555;
}

.tietoBoxit {
    display: flex;
    justify-content: center;
    gap: 20px;
    width: 100%;
}

.hevosen-tieto-otsikot {
    padding: 0;
    margin-top: 0;
}

.hevosen-tieto-teksti {
    margin-top: -7px;
    padding: 0 0 5px;
}

.historia-ja-luonne {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
}

.historia-ja-luonne > div {
    flex: 2;
}

.custom-divider {
    border: none;
    border-top: 2px solid #eaeaea;
    width: 100%;
}

/* ------------------------------ OMISTAJA ------------------------------ */

.owner-content {
    background: white;
    padding: 30px;
    width: 95%;
    max-width: 500px;
    border-radius: 12px;
    overflow-y: auto;
    max-height: 90vh;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    font-family: 'Segoe UI', sans-serif;
}

.owner-management {
    display: flex;
    padding-bottom: 10px;
    flex-direction: column;
    align-items: center; /* Vertically center contents */
    justify-content: center; /* Horizontally center contents */
    position: relative;
}


.hevosenOmistajuusTitle {
    padding-bottom: 0;
    margin-bottom: 0;
    font-size: 1.3em;
}

.omistajienTitle {
    font-size: 1.1em;
    text-align: center;
    font-weight: normal;
}

.omistajienNimet {
    text-align: center;
    padding-bottom: 10px;
}

.owner-management input {
    width: 300px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
}

.owner-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-width: 400px;
    margin: 10px auto;
}

.owner-list li {
    min-width: 300px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f9f9f9;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 1rem;
    transition: background-color 0.2s ease;
}

.owner-list li:hover {
    background-color: #e6f7ff;
}

.ownerLink {
    color: #007acc;
    text-decoration: none;
    flex-grow: 1;
}

.ownerLink:hover {
    text-decoration: underline;
}

.remove-owner {
    background-color: #ff4d4f;
    border: none;
    color: white;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease;
    font-size: 0.9rem;
}

.remove-owner:hover {
    background-color: #d9363e;
}

.owner-search-wrapper {
    position: relative;
    width: 300px; /* same as input width */
    margin: 0 auto; /* center horizontally if needed */
    margin-bottom: 70px;
}

.owner-search-wrapper input {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0; /* no margin */
    padding-bottom: 8px; /* optional for height */
}

.suggestions-list {
    position: absolute;
    top: 100%; /* directly below input */
    left: 0;
    width: 100%;
    margin-top: 0; /* no gap */
    padding: 0;
    background: white;
    border: 1px solid #ccc;
    max-height: 150px;
    overflow-y: auto;
    list-style: none;
    z-index: 10000;
}

#stableTooltipPlaceholder {
    margin-left: -6px;
}

.red-alert {
    background-color: #f45252;
}

.red-alert:hover {
    background-color: #fd9696;
}

.stable-alert {
    margin-left: 10px;
}

.hidden {
    display: none;
}

/* ------------------------------ TERVEYSTIEDOT ------------------------------ */

.vaccination-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
}

.rokotukset-title {
    padding-bottom: 5px;
    padding-top: 10px;
    font-weight: bold;
}

.vaccination-left {
    display: flex;
    align-items: center;
    vertical-align: middle;
}

.vaccination-right {
    text-align: right;
    white-space: nowrap;
    font-size: 14px;
    color: #555;
    padding-left: 10px;
}

.vaccination-entry input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 4px;
    outline: none;
    cursor: default;
    background-color: #fff;
    position: relative;
}

.vaccination-entry input[type="checkbox"]:checked {
    background-color: #38b2ac;
    border-color: #319795;
}

.vaccination-entry input[type="checkbox"]:checked::after {
    content: "✔";
    color: white;
    position: absolute;
    font-size: 14px;
    top: -1px;
    left: 3px;
}

.vaccination-label {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
}

.vaccination-status {
    text-align: center;
}

.rokotus-container {
    border: 1px solid #ccc;
    border-radius: 10px;
    background-color: #ebf6ff;
    padding: 15px;
    margin: 10px;
}

.health-history-entry {
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    margin-bottom: 10px;
    background-color: #fff;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
}

.health-history-entry:hover {
    background-color: #f1f5f9;
}

.health-history-entry.expanded {
    border-color: #3182ce;
}

.operation-title {
    font-size: 18px;
    color: #2b6cb0;
}

.operation-meta,
.operation-short,
.hidden-details p {
    font-size: 14px;
    color: #333;
}

.hidden-details {
    margin-top: 10px;
    border-top: 1px solid #e2e8f0;
    padding-top: 8px;
}

.terveystiedot-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    align-items: flex-start;
}

.terveystiedot-left,
.terveystiedot-right {
    flex: 1;
}

.terveystiedot-left {
    max-width: 50%;
    display: flex;
    flex-direction: column;
}

.terveystiedot-right {
    max-width: 50%;
}

/* 🎯 Subtle inline-painike kasvattajuuden poistamiseen */
.btn-remove-breeder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 3px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 500;
    font-family: inherit;

    /* Haalea ja sulautuva ulkoasu oletuksena */
    color: #a0aec0;
    background-color: #edf2f7;
    border: 1px solid #e2e8f0;

    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
}

/* Hover-efekti: Muuttuu punaiseksi vasta kun hiiri viedään päälle */
.btn-remove-breeder:hover {
    color: #fff;
    background-color: #e53e3e;
    border-color: #e53e3e;
}

/* Aktiivinen klikkaus-efekti */
.btn-remove-breeder:active {
    transform: scale(0.96);
}



/* ------------------------------ SUKUPUU ------------------------------ */

.pedigree {
    display: grid;
    grid-template-columns: repeat(4, 220px); /* 4 generations */
    grid-auto-rows: 80px;                   /* each box height */
}

/* All horse boxes */
.horse {
    border: 1px solid #aaaaaa;
    padding: 6px;
    background: #fcf8ff;
    text-align: center;
    font-size: 14px;
    line-height: 1.3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.horse strong {
    font-size: 16px;
    font-weight: bold;
    color: #222;
    display: block;
    margin-bottom: 2px;
}


/* Make each generation take correct row spans */
.g1 { grid-column: 1; grid-row: 1 / span 8; }  /* proband spans 8 rows */
.g2:nth-of-type(2) { grid-column: 2; grid-row: 1 / span 4; }
.g2:nth-of-type(3) { grid-column: 2; grid-row: 5 / span 4; }

.g3:nth-of-type(4) { grid-column: 3; grid-row: 1 / span 2; }
.g3:nth-of-type(5) { grid-column: 3; grid-row: 3 / span 2; }
.g3:nth-of-type(6) { grid-column: 3; grid-row: 5 / span 2; }
.g3:nth-of-type(7) { grid-column: 3; grid-row: 7 / span 2; }

.mare {
    background: #fdf1f7;  /* light pink */
    border-color: rgba(207, 89, 133, 0.49);
}

.stallion {
    background: #f0f3fd;  /* light pink */
    border-color: rgba(77, 100, 177, 0.45);
}

.title-container {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.horse-extra-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, padding 0.5s ease, opacity 0.5s ease;
    padding: 0;
    opacity: 0;
    width: 100%;
}

.horse-extra-content.show {
    max-height: 2000px; /* Adjust based on your content size */
    padding: 10px 0;
    opacity: 1;
}

.more-info-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 20px;
    width: 100%;
    margin: 30px 0 20px 0; /* 🌟 Adds clear margin: 30px top, 20px bottom */
    clear: both; /* Prevents any floating elements above from crashing into it */
}

/* Base / Inactive State */
.more-info-buttons button {
    width: 250px;
    height: 50px;
    font-size: 1.1rem;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;

    background-color: #23496a;
    color: #ffffff;
    border: 2px solid #23496a;
    font-weight: 500;
    position: relative;

    transition: all 0.2s ease-in-out;
}

/* Inactive Hover */
.more-info-buttons button:hover:not(.active):not(:disabled):not(.disabled) {
    background-color: #1e3f5b;
    border-color: #1e3f5b;
    color: #ffffff;
}

/* Active State */
.more-info-buttons button.active {
    background-color: #0b2a40;
    color: #ffffff;
    font-weight: 700;
    border-color: #0b2a40;

    transform: translateY(-2px); /* 🌟 Changed scale() to translateY() to stop layout shifts */
    box-shadow: 0 6px 15px rgba(11, 42, 64, 0.25);
}

/* Accent Bottom Line on Active Tab */
.more-info-buttons button.active::after {
    content: "";
    position: absolute;
    bottom: 4px; /* 🌟 Adjusted so it fits inside the button radius */
    left: 15%;
    width: 70%;
    height: 3px;
    border-radius: 4px;
}

/* 🔒 Disabled State */
.more-info-buttons button:disabled,
.more-info-buttons button.disabled {
    background-color: #e2e8f0;
    color: #94a3b8;
    border-color: #cbd5e1;
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
    transform: none;
}


.family-tree {
    display: flex;
    flex-direction: row; /* Align generations horizontally (left to right) */
    justify-content: center;
    gap: 30px; /* Space out the generations */
    overflow-x: auto; /* Add horizontal scroll if necessary */
    margin-bottom: 1rem;
}

.member {
    text-align: center;
    border: 1px solid #000;
    padding: 10px;
    border-radius: 5px;
    background-color: #f2f2f2;
    width: 200px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Vertically center the content */
    align-items: center; /* Horizontally center the content */
}

.current {
    font-weight: bold;
    background-color: #c5dff4;
}

.generation p {
    padding: 0;
    margin: 0;
}


.foals-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.foals-table th,
.foals-table td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: left;
}

.foals-table th {
    background-color: #f4f4f4;
}

.createHorseForm #text {
    padding-bottom: 20px;
}


/* ----------------------- PHONE SCREEN ----------------------------- */
@media screen and (max-width: 1070px) {
    .edit-and-delete-buttons {
        display: flex;
        justify-content: center;
    }
    .horseImage {
        justify-content: center;
    }
    .details-container {
        display: block;
    }
    .tietoBoxit {
        padding-top: 20px;
        display: flex;
        flex-direction: column;
        gap: 20px;
        align-items: center;
    }
    .competitionResults {
        width: 100%;
        display: flex;
        justify-content: center;
    }
    .right-side {
        padding-top: 10px;
    }
    .family-tree {
        justify-content: start;
    }
    .member {
        width: 150px;
    }
}

@media screen and (max-width: 699px) {
    .historia-ja-luonne {
        flex-direction: column;
        gap: 0;
    }
}

/* Container Spacing */
.owner-management {
    padding: 5px 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Modern Tab Bar Design */
.modal-tabs {
    display: flex;
    justify-content: center;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 25px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    color: #718096;
    cursor: pointer;
    position: relative;
    bottom: -2px; /* Pulls tab precisely flush onto the accent line */
    border-bottom: 2px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
    color: #1e3a8a;
}

.tab-btn.active {
    color: #1e40af; /* Deep blue highlight state matching your modal's aesthetic */
    border-bottom: 2px solid #1e40af;
}

/* Content Panel Visibility */
.tab-content-wrapper {
    min-height: 240px;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.2s ease-out;
}

.tab-panel.active {
    display: block;
}

/* Form Section Title */
.panel-section-title {
    font-size: 14px;
    color: #4a5568;
    font-weight: 500;
    text-align: center;
    margin: 0 0 20px 0;
    letter-spacing: 0.3px;
}

/* Sleek Inputs Style */
.full-width-input {
    width: 100%;
    height: 42px;
    padding: 10px 14px;
    font-size: 15px;
    color: #2d3748;
    background-color: #ffffff;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    box-sizing: border-box;
    transition: all 0.15s ease;
}

.full-width-input:focus {
    outline: none;
    border-color: #1e40af;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15);
}

.full-width-input::placeholder {
    color: #a0aec0;
}

/* Form Row Matrix Grid */
.imaginary-form-layout {
    display: flex;
    flex-direction: column;
}

.form-group {
    width: 100%;
}

.form-row-split {
    display: flex;
    gap: 16px;
}

.flex-field {
    flex: 1;
}

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 6px;
}

/* Perfect Horizontal Checkbox Fix */
.form-group-checkbox {
    margin-top: 8px;
    padding: 4px 0;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 10px; /* Snaps input and label text right next to each other */
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: #1e40af; /* Color matches active theme system */
}

.checkbox-custom-text {
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
}

/* Live Search Dropdown Overlays */
.owner-search-wrapper {
    position: relative;
}

.dynamic-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 45px;
    z-index: 1000;
    background-color: #ffffff;
    list-style: none;
    padding: 6px 0;
    margin: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.suggestion-item {
    padding: 10px 14px;
    font-size: 14px;
    color: #2d3748;
    cursor: pointer;
}

.suggestion-item:hover {
    background-color: #f7fafc;
    color: #1e40af;
}

.no-results-item {
    padding: 10px 14px;
    font-size: 14px;
    color: #718096;
    font-style: italic;
}

/* Active Previews Card Box */
.selection-preview-box {
    margin-top: 20px;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 16px;
    background-color: #f0f4f8;
    border-left: 4px solid #1e40af;
    border-radius: 0 6px 6px 0;
    display: none;
}

.selection-preview-box.visible-preview {
    display: block;
}

.highlighted-selection {
    color: #1e40af;
    margin-left: 4px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Flex arrangement layout inside active preview block */
.preview-content-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Clear Selection X Action Design */
.clear-selection-btn {
    background: none;
    border: none;
    color: #e53e3e;
    font-size: 22px;
    line-height: 1;
    font-weight: bold;
    cursor: pointer;
    padding: 0 4px;
    margin: 0;
    transition: color 0.15s ease, transform 0.1s ease;
}

.clear-selection-btn:hover {
    color: #9b2c2c;
    transform: scale(1.15);
}

.clear-selection-btn:focus {
    outline: none;
}

/* 🎯 ASEMOINTI: Kaikki sukupuulaatikot (g1, g2, g3, g4) toimivat asemoinnin pohjana */
.family-tree .horse {
    position: relative;
    overflow: hidden;
    min-height: 50px;
}

/* 🎯 PAIKKAMUUTOS: Muokkaa-painike */
.family-tree .edit-parent-btn {
    position: absolute;
    top: 70%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);

    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-in-out;

    background: rgba(44, 62, 80, 0.95);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    white-space: nowrap;
    z-index: 5;
}

/* 🎯 PAIKKAMUUTOS: Lisää-painike */
.family-tree .add-parent-hover-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);

    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-in-out;

    background: rgba(39, 174, 96, 0.95);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    white-space: nowrap;
    z-index: 5;
}

/* Hover-efektit itse painikkeiden päälle mentäessä */
.family-tree .edit-parent-btn:hover {
    background: #2c3e50;
    transform: translate(-50%, -50%) scale(1.05);
}

.family-tree .add-parent-hover-btn:hover {
    background: #27ae60;
    transform: translate(-50%, -50%) scale(1.05);
}

/* 🎯 HOVER-AKTIVOINTI KAIKILLE SUKUPOLVILLE (g2, g3, g4) */
.family-tree .horse:hover .edit-parent-btn,
.family-tree .horse:hover .add-parent-hover-btn {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.mare td {
    background: #fdf1f7;
}

.stallion td {
    background: #f0f3fd;
}