/* 
 * Liros Boat Calculator CSS
 * Färgschema:
 * - Primärfärg: #003087
 * - Bakgrundsfärg: #f9f9f9
 * - Textfärg: #333
 */

/* ===== GRUNDLÄGGANDE LAYOUTSTRUKTUR ===== */
.liros-boat-calculator {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    font-family: Arial, sans-serif;
    padding: 20px;
    color: #333;
    box-sizing: border-box;
}

/* ===== SÖKSEKTIONEN ===== */
.liros-search-container {
    margin-bottom: 30px;
}

.liros-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.liros-search-title h3 {
    color: #003087;
    margin: 0;
}

.liros-not-in-list a {
    color: #003087;
    text-decoration: none;
    font-weight: 500;
    transition: text-decoration 0.2s;
}

.liros-not-in-list a:hover {
    text-decoration: underline;
}

/* Sökfält och rensningsknapp */
.liros-search-input-container {
    position: relative;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

#liros-boat-search {
    flex-grow: 1;
    padding: 12px 40px 12px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#liros-boat-search:focus {
    outline: none;
    border-color: #003087;
    box-shadow: 0 0 0 2px rgba(0, 48, 135, 0.2);
}

/* Rensa-knapp */
.liros-clear-button {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: #777;
    padding: 5px;
    transition: color 0.3s, transform 0.3s;
    z-index: 10;
    border-radius: 50%;
}

.liros-clear-button:hover {
    color: #003087;
    transform: translateY(-50%) rotate(90deg);
}

.liros-clear-button:focus {
    outline: none;
}

.liros-clear-button svg {
    display: block;
    width: 18px;
    height: 18px;
}

.liros-clear-button:hover,
.liros-clear-button:active,
.liros-clear-button:focus {
    background-color: transparent;
}

/* ===== SÖKRESULTAT ===== */
#liros-search-results {
    width: 100%;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: absolute;
    z-index: 1000;
    left: 0;
    right: 0;
}

.liros-results-count {
    padding: 10px 15px;
    background-color: #f5f7fa;
    color: #003087;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid #eaecf0;
}

.liros-results-list {
    max-height: 250px;
    overflow-y: auto;
}

.liros-search-result {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.liros-search-result:hover {
    background-color: rgba(0, 48, 135, 0.05);
}

.liros-search-result:last-child {
    border-bottom: none;
}

.liros-no-results {
    padding: 15px;
    color: #666;
    text-align: center;
    font-style: italic;
}

/* ===== DATAVISNING: BÅTDATA OCH TÅGVIRKESDATA ===== */
#liros-boat-data {
    margin-top: 30px;
    background-color: #f9f9f9;
    border-radius: 5px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Gemensamma stilar för sektionsrubriker */
#liros-boat-specs h3,
#liros-rope-data h3,
#liros-boat-details h3 {
    color: #003087;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #003087;
}

/* Gemensamma stilar för sektioner */
#liros-boat-specs,
#liros-rope-data,
#liros-boat-details {
    margin-bottom: 30px;
}

/* Gemensamma tabellstilar */
#liros-boat-specs table,
#liros-rope-data table,
#liros-boat-details table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 4px;
    overflow: hidden;
}

#liros-boat-specs th,
#liros-rope-data th,
#liros-boat-details th {
    background-color: #003087;
    color: white;
    padding: 12px 8px;
    text-align: left;
    font-weight: 500;
}

#liros-boat-specs td,
#liros-rope-data td,
#liros-boat-details td {
    border: 1px solid #eaecf0;
    padding: 10px 8px;
    text-align: left;
}

/* Varvade rader */
#liros-boat-specs tr:nth-child(even),
#liros-rope-data tr:nth-child(even),
#liros-boat-details tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* Specifikt för tågvirkesdata */
#liros-rope-data td[rowspan] {
    background-color: #f0f4fa;
    vertical-align: middle;
    font-weight: 500;
    border-right: 2px solid #003087;
}

#liros-rope-data tr:nth-child(odd) td:not([rowspan]) {
    background-color: #f8f9fa;
}

#liros-rope-data tr:nth-child(even) td:not([rowspan]) {
    background-color: #ffffff;
}

/* ===== BÅTTYPER ===== */
.liros-sailing-types {
    margin-top: 40px;
    margin-bottom: 30px;
}

.liros-sailing-types h3 {
    color: #003087;
    margin-bottom: 20px;
    text-align: center;
    font-size: 22px;
}

.liros-sailing-type-buttons {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.liros-sailing-type {
    flex: 1;
    min-width: 30%;
    text-align: center;
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.liros-sailing-type:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.liros-sailing-type.active {
    border-color: #003087;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 48, 135, 0.2);
}

.liros-sailing-type img {
    width: auto;
    height: 150px;
    max-width: 100%;
    object-fit: contain;
    margin: 0 auto;
    display: block;
}

.liros-sailing-type h4 {
    margin: 0;
    padding: 15px 10px;
    background-color: rgba(0, 48, 135, 0.9);
    color: white;
    font-weight: 500;
    font-size: 18px;
}

.liros-sailing-type.active::after {
    content: "✓";
    position: absolute;
    top: 10px;
    right: 10px;
    width: 25px;
    height: 25px;
    background-color: #003087;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* ===== POPUP ===== */
#liros-contact-popup {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
}

.liros-popup-content {
    background-color: white;
    margin: 15% auto;
    padding: 30px;
    border: none;
    width: 80%;
    max-width: 500px;
    text-align: center;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.liros-popup-content h3 {
    color: #003087;
    margin-top: 0;
    margin-bottom: 20px;
}

.liros-close-popup {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #777;
    transition: color 0.2s;
}

.liros-close-popup:hover {
    color: #003087;
}

#liros-close-popup-btn {
    padding: 12px 25px;
    margin-top: 20px;
    background-color: #003087;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#liros-close-popup-btn:hover {
    background-color: #002b70;
}

/* ===== TOOLTIP ===== */
.liros-function-name {
    position: relative;
    cursor: pointer;
    display: inline-block;
    border-bottom: 1px dotted #999;
}

.liros-function-name .tooltip-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background-color: #0073aa;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    text-align: center;
    line-height: 16px;
    margin-left: 4px;
}

.liros-tooltip-container {
    display: none;
    position: relative;
    margin: 15px 0;
    padding: 15px 20px;
    background-color: #f1f8fc;
    border-left: 4px solid #0073aa;
    border-radius: 3px;
    max-width: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.liros-tooltip-container h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #0073aa;
    font-size: 16px;
    padding-right: 25px;
}

.liros-tooltip-container p {
    margin-bottom: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.liros-tooltip-close {
    position: absolute;
    top: 12px;
    right: 12px;
    cursor: pointer;
    font-size: 20px;
    color: #999;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    transition: color 0.2s;
}

.liros-tooltip-close:hover {
    color: #333;
}

/* ===== LADDNINGS- OCH STATUSINDIKATIONER ===== */
.liros-loading {
    text-align: center;
    padding: 20px;
    color: #003087;
}

.liros-loading:after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 3px solid rgba(0, 48, 135, 0.3);
    border-radius: 50%;
    border-top-color: #003087;
    animation: spin 1s ease-in-out infinite;
    vertical-align: middle;
}

.liros-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.liros-loading-spinner {
    border: 4px solid rgba(0, 48, 135, 0.3);
    border-radius: 50%;
    border-top: 4px solid #003087;
    width: 40px;
    height: 40px;
    animation: liros-spin 1s linear infinite;
}

.liros-boat-data.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Felmeddelanden */
.liros-error {
    background-color: #fff1f0;
    color: #d9534f;
    border-left: 4px solid #d9534f;
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 4px 4px 0;
}

/* Friskrivning */
.liros-disclaimer {
    margin-top: 2rem;
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-left: 4px solid #0073aa;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.6;
}

.liros-disclaimer p {
    margin: 0.5rem 0;
}

.liros-product-link {
    color: #0073aa;
    text-decoration: none;
    font-weight: bold;
    border-bottom: 1px dotted #0073aa;
    transition: all 0.2s ease;
}

.liros-product-link:hover {
    color: #00a0d2;
    border-bottom-color: #00a0d2;
}

/* Animationer */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes liros-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ===== RESPONSIV DESIGN ===== */
@media (max-width: 768px) {

    /* Layout */
    .liros-boat-calculator {
        padding: 10px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .liros-search-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .liros-not-in-list {
        margin-top: 10px;
    }

    /* Båttyper */
    .liros-sailing-type-buttons {
        flex-direction: column;
    }

    .liros-sailing-type {
        flex: 0 0 100%;
    }

    /* Sektionsrubriker på mobil */
    #liros-boat-specs h3,
    #liros-rope-data h3,
    #liros-boat-details h3 {
        font-size: 18px;
        margin-bottom: 10px;
        padding-bottom: 5px;
    }

    /* Tabellayout */
    #liros-boat-data {
        padding: 10px;
        margin-left: -10px;
        margin-right: -10px;
        width: calc(100% + 20px);
    }

    .table-responsive {
        width: 100%;
        margin-bottom: 20px;
        overflow-x: visible;
    }

    /* Mobiltabellstruktur */
    .mobile-table {
        width: 100%;
        margin-bottom: 20px;
    }

    .mobile-row {
        border: 1px solid #ddd;
        border-radius: 5px;
        margin-bottom: 10px;
        background-color: #fff;
        overflow: hidden;
    }

    .mobile-cell {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 12px;
        border-bottom: 1px solid #eee;
    }

    .mobile-cell:last-child {
        border-bottom: none;
    }

    .mobile-label {
        font-weight: bold;
        width: 40%;
    }

    .mobile-value {
        width: 60%;
        text-align: right;
    }

    /* Båtspecifikationstabellen */
    #liros-boat-specs table,
    #liros-rope-data table,
    #liros-boat-details table {
        display: flex;
        flex-direction: column;
    }

    #liros-boat-specs thead,
    #liros-rope-data thead,
    #liros-boat-details thead {
        display: none;
    }

    #liros-boat-specs tbody,
    #liros-boat-details tbody {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
    }

    #liros-rope-data tbody {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    #liros-boat-specs tr,
    #liros-boat-details tr {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        margin-bottom: 5px;
    }

    #liros-rope-data tr {
        display: flex;
        flex-wrap: wrap;
        margin-bottom: 10px;
        border: 1px solid #ddd;
        border-radius: 4px;
        overflow: hidden;
    }

    /* Gemensamma cellstilar */
    #liros-boat-specs td,
    #liros-boat-details td {
        display: flex;
        flex-basis: 50%;
        flex-grow: 1;
        box-sizing: border-box;
        padding: 10px;
        border: 1px solid #ddd;
        position: relative;
        min-height: 50px;
        align-items: center;
    }

    #liros-rope-data td {
        display: flex;
        width: 100%;
        padding: 10px;
        border-bottom: 1px solid #ddd;
        box-sizing: border-box;
        align-items: center;
    }

    /* Hantera rowspan-celler */
    #liros-rope-data td[rowspan] {
        width: 100%;
        background-color: #003087;
        color: white;
        font-weight: bold;
        padding: 10px 15px;
        border-bottom: none;
        border-radius: 4px 4px 0 0;
        text-align: center;
    }

    /* Etiketter före värdet */
    #liros-boat-specs td:before,
    #liros-boat-details td:before {
        content: attr(data-label);
        font-weight: bold;
        margin-right: 10px;
        flex-basis: 50%;
    }

    #liros-rope-data td:not([rowspan]):before {
        content: attr(data-label);
        font-weight: bold;
        margin-right: 10px;
        flex-basis: 50%;
    }

    /* Tydligare datapresentation i mobil */
    #liros-boat-specs td,
    #liros-rope-data td:not([rowspan]),
    #liros-boat-details td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: 1px solid #eee;
        margin-bottom: 2px;
        padding: 8px;
    }
}