/* GRUNDLÄGGANDE STYLING */
#viktomvandlare-verktyg {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f8f9fa;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    max-width: 700px;
    margin: 20px auto;
    color: #343a40;
}

.verktyg-header {
    text-align: center;
    margin-bottom: 24px;
}

.verktyg-header h2 {
    margin: 0 0 8px 0;
    color: #212529;
    font-size: 28px;
}

.verktyg-header p {
    margin: 0;
    color: #6c757d;
    font-size: 16px;
}

/* INDATA OCH GRID */
.omvandlare-grid {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr 2fr;
    gap: 16px;
    align-items: end;
}

.indata-grupp {
    display: flex;
    flex-direction: column;
}

.indata-grupp label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #495057;
}

.indata-grupp input,
.indata-grupp select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 16px;
    background-color: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.indata-grupp input:focus,
.indata-grupp select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.byt-knapp-grupp {
    display: flex;
    align-items: end;
    justify-content: center;
}



    
    .swap-icon {
        width: 40px;
        height: 40px;
        transition: transform 0.3s ease;
    }
    #bytEnheter:hover .swap-icon {
        transform: rotate(90deg);
    }

#bytEnheter {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ced4da;
    background-color: #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}
#bytEnheter svg {
    width: 20px;
    height: 20px;
    color: #495057;
    transition: transform 0.3s ease-in-out;
}

#bytEnheter:hover {
    background-color: #e9ecef;
}
#bytEnheter:hover svg {
    transform: rotate(180deg);
}
#bytEnheter:active {
    transform: translateY(1px);
}

/* RESULTATSEKTION */
#resultat-sektion {
    margin-top: 32px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

#resultat-sektion.resultat-dold {
    opacity: 0;
    transform: translateY(10px);
    max-height: 0;
    overflow: hidden;
    margin-top: 0;
}

.huvud-resultat-box {
    background: linear-gradient(135deg, #005cbf, #007bff);
    color: #fff;
    padding: 24px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 32px;
}

#resultat-text {
    margin: 0;
    font-size: 18px;
    opacity: 0.9;
}

#resultat-varde {
    display: block;
    font-size: 40px;
    font-weight: bold;
    margin-top: 8px;
}

.detaljer-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 8px;
}

.detaljer-header h3 {
    margin: 0;
    font-size: 20px;
    color: #343a40;
}

/* VISUELL GRAF */
.graf-container {
    width: 100%;
    margin-bottom: 32px;
}
.graf-stapel-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}
.graf-etikett {
    width: 140px;
    flex-shrink: 0;
    font-size: 14px;
    color: #495057;
    text-align: right;
    padding-right: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.graf-stapel {
    height: 30px;
    border-radius: 4px;
    transition: width 0.5s ease-in-out;
    background-color: #007bff;
    color: white;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    min-width: 35px; /* So text is visible on very small bars */
}

#fran-stapel { background: #007bff; }
#till-stapel { background: #17a2b8; }


/* DETALJERAD RESULTATTABELL */
.detaljer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.detalj-kort {
    background-color: #fff;
    padding: 16px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    text-align: center;
}

.detalj-kort .enhet {
    display: block;
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 4px;
}

.detalj-kort .varde {
    display: block;
    font-size: 20px;
    font-weight: 600;
    color: #343a40;
}

/* TOOLTIP */
.tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tooltip-ikon {
    width: 20px;
    height: 20px;
    background-color: #6c757d;
    color: white;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    cursor: help;
    text-align: center;
    line-height: 20px;
}
.tooltip .tooltip-text {
    visibility: hidden;
    width: 220px;
    background-color: #343a40;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 140%;
    left: 50%;
    margin-left: -110px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 13px;
    font-weight: normal;
}
.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #343a40 transparent transparent transparent;
}
.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* MOBILANPASSNING */
@media (max-width: 600px) {
    #viktomvandlare-verktyg {
        padding: 16px;
    }
    .omvandlare-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
    }
    .omvandlare-grid .indata-grupp:nth-child(1) { grid-column: 1 / 3; }
    .omvandlare-grid .indata-grupp:nth-child(2) { grid-column: 1 / 2; }
    .omvandlare-grid .byt-knapp-grupp { grid-column: 2 / 3; grid-row: 2 / 3; }
    .omvandlare-grid .indata-grupp:nth-child(4) { grid-column: 1 / 3; }

    #bytEnheter { margin-left: auto; }
    
    #resultat-varde { font-size: 32px; }
    .detaljer-grid { grid-template-columns: 1fr 1fr; }
    .graf-etikett { width: 100px; font-size: 13px; }
}




table {
            border-collapse: collapse;
            width: 100%;
            margin: 20px 0;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }
        th {
            background-color: #f2f2f2;
        }
        tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        .note {
            background-color: #e7f3fe;
            padding: 15px;
            border-left: 6px solid #2196F3;
            margin: 20px 0;
        }




        .weight-conversion-faq {
  font-family: 'Segoe UI', Arial, sans-serif;
  max-width: 800px;
  margin: 20px auto;
  padding: 20px;
  background-color: #f9f9f9;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.weight-conversion-faq h4 {
  color: #2c3e50;
  border-bottom: 2px solid #3498db;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.faq-item {
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.faq-question {
  font-weight: 600;
  color: #3498db;
  margin-bottom: 5px;
}

.faq-answer {
  padding-left: 20px;
}

.divider {
  height: 1px;
  background-color: #ddd;
  margin: 20px 0;
}

.conversion-tip {
  background-color: #e6f7ff;
  padding: 15px;
  border-radius: 5px;
  border-left: 4px solid #3498db;
}

.conversion-tip ul {
  margin-top: 10px;
  padding-left: 20px;
}

.conversion-tip li {
  margin-bottom: 5px;
}