@charset "utf-8";

/* ============================================================
   FORMULÄR – LAYOUT & FÄLT
============================================================ */

form {
    max-width: 850px;
    margin: 0 auto;
    background: #ffffff;
    padding: 30px;
    border-radius: 12px;
}

label {
    margin-bottom: 6px;
    display: block;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 600;
}

/* Wrapper runt varje fält för att hålla felmeddelanden */
.field-wrapper {
    position: relative;
    margin-bottom: 55px;
}

/* Fältfel (ersätter gamla .error) */
.field-error {
    position: absolute;
    left: 0;
    bottom: -20px;
    font-size: 13px;
    color: #d9534f;
    pointer-events: none;
    white-space: nowrap;
}

/* Inputs */
input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
input[type="file"] {
    width: 100%;
    padding: 12px;
    margin-top: 4px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
    box-sizing: border-box;
}

/* Fokus */
input:focus,
textarea:focus {
    outline: none !important;
    border-color: #999 !important;
    box-shadow: none !important;
}

/* Autofyll */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px white inset !important;
    box-shadow: 0 0 0px 1000px white inset !important;
    background-color: white !important;
    color: #000 !important;
}

/* Validering */
.valid-field {
    border-color: #619ec5 !important;
    box-shadow: none !important;
}

.valid-field:focus {
    border-color: #619ec5 !important;
}

.invalid-field {
    border-color: #d9534f !important;
    box-shadow: 0 0 6px #d9534f !important;
}

/* ============================================================
   FILHANTERING
============================================================ */

.file-block {
    padding: 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 12px;
}

.file-block.too-large {
    border: 2px solid #d9534f;
    background: #ffe6e6;
    box-shadow: 0 0 6px #d9534f !important;
}

.fileError {
    font-size: 13px;
    color: #d9534f;
    margin-top: 6px;
    display: block;
}

.file-add-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

#fileCountIndicator {
    font-size: 14px;
    color: #555;
}

#fileRules {
    margin-top: 4px;
    font-size: 13px;
    color: #dadada;
}

#fileRules.error {
    color: #d9534f;
    font-weight: 600;
}

/* Filstorleksinfo */
#fileSizeInfo {
    display: none;
    margin-top: 8px;
    font-size: 14px;
    color: #2d7a2d;
    font-weight: 600;
    margin-bottom: 20px;
}

#fileSizeInfo.show {
    display: block;
}

#fileSizeInfo.error {
    display: block;
    color: #d9534f;
}

.file-size-label {
    font-weight: normal;
    font-size: 13px;
    color: #2d7a2d;
    margin-left: 6px;
}

.file-size-label.error {
    color: #d9534f;
}

/* ============================================================
   KNAPPAR
============================================================ */

.removeFileBtn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 12px;
}

#addFileBtn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
}

#addFileBtn.disabled-btn {
    background-color: #e0e0e0 !important;
    color: #888 !important;
    cursor: not-allowed !important;
    border: 1px solid #ccc !important;
}

button[type="submit"] {
    width: 100%;
    background: #619ec5;
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 20px;
}

button[type="submit"]:hover {
    background: #4f89ad;
}

/* ============================================================
   TVÅKOLUMNSLAYOUT
============================================================ */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 20px;
}

.full-width {
    grid-column: 1 / -1;
}

/* ============================================================
   POSTNUMMER + ORT RAD
============================================================ */

.zipcity-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

/* ============================================================
   RESPONSIV FORM – kompaktare mobilvy
============================================================ */

@media (max-width: 768px) {

    .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .zipcity-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .field-wrapper {
        margin-bottom: 35px;
    }

    form {
        padding: 20px;
    }
}

@media (max-width: 480px) {

    .form-grid {
        gap: 12px;
    }

    .zipcity-row {
        gap: 12px;
    }

    .field-wrapper {
        margin-bottom: 28px;
    }

    form {
        padding: 16px;
    }
}

/* ============================================================
   KOMPAKTARE DESKTOP – endast höjd
============================================================ */

@media (min-width: 769px) {

    .field-wrapper {
        margin-bottom: 40px;
    }

    .form-grid {
        row-gap: 18px;
    }

    .zipcity-row {
        row-gap: 18px;
    }

    form {
        padding-top: 24px;
        padding-bottom: 24px;
    }
}

/* ============================================================
   LOADING OVERLAY
============================================================ */

#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 600;
    z-index: 9999;
}

#loadingOverlay.show {
    display: flex;
}
