/* ============================
   Grundlayout
   ============================ */
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: #f4f4f4;
}

h1, h2 {
    margin: 0 0 10px 0;
}

/* ============================
   Titel + bild
   ============================ */
.image-container img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.image-container h1 {
    font-size: 32px;
}
.header-left {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ============================
   Sektioner (Cards)
   ============================ */
.section-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 18px;
    margin: 20px 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* Titelrad för accordion */
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.section-card.collapsed .section-content {
    display: none;
}

.full {
    width: 100%;
    box-sizing: border-box;
}

/* Inputs */
input, textarea, button {
    width: 100%;
    padding: 10px;
    margin-top: 6px;
    margin-bottom: 14px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 16px;
}

/* ============================
   Bottenmeny
   ============================ */
#bottomNav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.15);
    z-index: 999;
}

#bottomNav button {
    background: none;
    border: none;
    font-size: 24px;
}
#reportList {
  scroll-margin-top: 80px;
}
/* DESKTOP – allt över 600 px brett */
/* ===============================
   MOBIL (<= 600px)
   =============================== */
@media (max-width: 600px) {

    body {
        font-size: 18px;
        padding-bottom: 80px;
    }
    .image-container {
    text-align: center;
    padding: 20px 10px;
    }
    .image-container img {
        width: 260px;
    }

    h1 { font-size: 26px; }
    h2 { font-size: 20px; }

    input, textarea, button {
        font-size: 18px;
        padding: 12px;
        border-radius: 12px;
    }

    .section-card {
        padding: 18px;
        margin: 18px 10px;
        border-radius: 16px;
        box-shadow: 0 6px 14px rgba(0,0,0,0.12);
    }
    .section-title {
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
    }

    .section-title .arrow {
        transition: transform 0.3s ease;
    }

    /* När sektionen är ÖPPEN */
    .section-card:not(.collapsed) .arrow {
         transform: rotate(180deg);
    }
}

/* ===============================
   TABLET / SMALL DESKTOP (>= 601px)
   =============================== */
@media (min-width: 601px) {
    .section-card {
        margin: 20px auto;
        max-width: 900px;
    }
}

/* ===============================
   DESKTOP (>= 1024px)
   =============================== */
@media (min-width: 1024px) {

    .image-container {
        max-width: 900px;
        margin: 30px auto 40px;
        padding: 0 10px;

        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 20px;

        text-align: left;
    }

    .image-container h1 {
        margin: 0;
        font-size: 32px;
    }

    .image-container img {
        width: 160px;
        height: auto;
        display: block;
    }


    /* ============================
   Hjälpknapp – Masterservice
   ============================ */

    .header-actions {
    display: flex;
    justify-content: flex-end;
    margin: 10px 0 20px;
    }

    .help-btn {
    background: linear-gradient(135deg, #0b3c5d, #1f5f8b);
    color: #fff;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    }

    .help-btn:hover {
    background: linear-gradient(135deg, #124d77, #2976aa);
    transform: translateY(-1px);
    }
    /* Dölj pilen */
    .section-title span {
        display: none !important;
    }

    /* Ingen accordion på desktop */
    .section-title {
        cursor: default !important;
    }
    .section-card.collapsed .section-content {
        display: block !important;
    }

    /* ---- Rubriker inuti sektionerna ---- */
    h2 {
        margin-top: 0;
        font-size: 24px;
        border-bottom: none;
        padding-bottom: 0;
        color: inherit;
    }

    /* Dölj bottenmenyn helt på desktop */
    #bottomNav {
        display: none !important;
    }

    /* Centrera header lika brett som formuläret */
    .image-container {
        max-width: 900px;
        margin: 30px auto 40px auto;

        /* NYTT: radvis layout, snygg desktopstil */
        display: flex;
        justify-content: space-between;
        align-items: center;

        padding: 0 10px;
    }

    .image-container h1 {
        font-size: 32px;
        margin: 0;
    }

    .image-container img {
        width: 160px;
        height: auto;
    }
}
/* Begränsa preview-bilder globalt */
.preview-block img {
    width: 100%;
    max-width: 300px;
    height: auto;
    display: block;
    margin: 10px auto;
    border-radius: 6px;
}
.preview-img {
    width: 100%;
    max-width: 300px;
    height: auto;
    display: block;
    margin: 10px auto;
    border-radius: 6px;
}
.preview-drag-wrapper {
    border: 1px dashed transparent;
    padding: 5px;
}

.preview-drag-wrapper.drag-over {
    border-color: #007bff;
    background: #eef6ff;
}
#toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    min-width: 250px;
    padding: 14px 20px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 9999;
}

/* olika typer */
#toast.success {
    background: #4CAF50;
}

#toast.error {
    background: #e74c3c;
}

#toast.show {
    opacity: 1;
    transform: translateY(0);
}
#loader {
    position: fixed;
    bottom: 70px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #333;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 9999;
}

#loader.show {
    opacity: 1;
    transform: translateY(0);
}

.spinner {
    width: 16px;
    height: 16px;
    border: 3px solid #ccc;
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.flash-highlight {
    animation: highlightFade 1s ease;
}

@keyframes highlightFade {
    0% { background-color: #fff3a0; }
    100% { background-color: transparent; }
}
.load-btn.active {
    background-color: #4CAF50;
    color: white;
    font-weight: bold;
}
.modal {
    display: none; /* ✅ gömd från början */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;

    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 10px;
    width: 300px;
}
.flash-highlight {
    animation: highlightFade 1s ease;
}

@keyframes highlightFade {
    0% { background-color: #fff3a0; }
    100% { background-color: transparent; }
}
#settingsBtn {
    position: fixed;
    top: 15px;
    right: 15px;

    width: 45px;
    height: 45px;
    border-radius: 50%;

    border: none;
    background: #4CAF50;
    color: white;

    font-size: 20px;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    z-index: 10000;
}

#settingsBtn:hover {
    transform: rotate(45deg);
    transition: 0.3s;
    
#settingsBtn {
    backdrop-filter: blur(5px);
}

}
.thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ccc;
}
.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ddd;
    color: #666;
    font-size: 20px;
}
.editor-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);

  display: none;
  align-items: center;
  justify-content: center;

  z-index: 9999;
}

.editor-toolbar {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: #111;
  flex-wrap: wrap;
  align-items: center;
}

#editorCanvas {
  flex: 1;
  width: 100%;
  height: auto;
  background: #fff;
}
.editor-toolbar button {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 6px;
  background: #333;
  color: white;
  border: none;
  cursor: pointer;
}

.editor-toolbar button:hover {
  background: #555;
}
.editor-toolbar input[type="range"] {
  width: 120px;
}

.editor-toolbar input[type="color"] {
  width: 40px;
  height: 30px;
  padding: 0;
  border: none;
}
.editor-box {
  background: #1a1a1a;
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  height: 85%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.editor-canvas-wrapper {
  flex: 1;
  overflow: auto;
  background: #222;
  display: flex;
  justify-content: center;
  align-items: center;
}
#editorCanvas {
  max-width: 100%;
  height: auto;
  background: white;
}
#editorCanvas {
  touch-action: none;
}

.section-content {
    display: flex !important;
    gap: 35px;
    flex-wrap: wrap; /* viktigt på mobil */
}

.section-content a {
    display: inline-block;
    padding: 10px 16px;
    background-color: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
}
.section-content a:hover {
    background-color: #45a049;
}
.section-card.collapsed > *:not(.section-title) {
    display: none;
}
@media (max-width: 1023px) {
    .section-card.collapsed > :not(.section-title) {
        display: none !important;
    }
}
.report-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
    padding: 10px 5px;
    border-bottom: 1px solid #ddd;
}

.report-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
}

/* Badge (antal rapporter) */
.report-badge {
    background: #4CAF50;
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 14px;
    min-width: 30px;
    text-align: center;
}
#openMeasureBtn {
    background: #4CAF50;   /* samma gröna */
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

/* hover-effekt */
#openMeasureBtn:hover {
    background: #43a047;
}
.remove-front-btn,
.remove-image-btn {

    background: #ff4d4d;
    color: white;

    border: none;
    border-radius: 50%;

    width: 28px;
    height: 28px;

    font-size: 14px;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    transition: all 0.2s ease;
}
.remove-front-btn:hover,
.remove-image-btn:hover {
    background: #e53935;
    transform: scale(1.1);
}
.remove-front-btn:active,
.remove-image-btn:active {
    transform: scale(0.9);
}
.remove-front-btn,
.remove-image-btn {
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.remove-front-btn:hover,
.remove-image-btn:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.preview-block {
    position: relative;
}

.remove-front-btn,
.remove-image-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
}
.editor-toolbar button {
    transition: all 0.2s ease;
}

.editor-toolbar button:hover {
    transform: scale(1.1);
}

.editor-toolbar button.active {
    background: #4CAF50;
    color: white;
}
.text-size-control {
    display: flex;
    flex-direction: column;   /* ✅ gör label ovanför */
    gap: 4px;
}

/* ✅ Vit text */
.text-size-control label {
    color: white;
    font-size: 12px;
    font-weight: 600;
}
.textarea-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.textarea-editor {
    background: white;
    width: 90%;
    height: 80%;
    display: flex;
    flex-direction: column;
}

.textarea-editor textarea {
    flex: 1;
    font-size: 18px;
    padding: 10px;
}

.textarea-editor button {
    padding: 15px;
    font-size: 16px;
}