/* ===========================================
   GALLERIX MAP DESIGNER - Stylesheet
   Baserat pa gallerix.se/posterkarta
   =========================================== */

:root {
    --poster-scale: 1;
    --poster-border: calc(16px * var(--poster-scale));
    --poster-poster: calc(20px * var(--poster-scale));
    --poster-classic: calc(24px * var(--poster-scale));
    --poster-classic-inner: calc(18px * var(--poster-scale));
    --poster-classic-outer: calc(2px * var(--poster-scale));
    --poster-classic-inner-border: calc(4px * var(--poster-scale));
}

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700&display=swap');

/* ===========================================
   FONTS - Gotham for poster labels
   =========================================== */
@font-face {
    font-family: 'PD-Gotham-Medium';
    src: url('../fonts/Gotham-Medium.eot');
    src: local(''), url('../fonts/Gotham-Medium.woff') format('woff'), url('../fonts/Gotham-Medium.ttf') format('truetype'), url('../fonts/Gotham-Medium.svg') format('svg');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'PD-Gotham-Light';
    src: url('../fonts/gotham-light-webfont.woff2') format('woff2'), url('../fonts/gotham-light-webfont.woff') format('woff'), url('../fonts/Gotham-Light.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'PD-Gotham-Book';
    src: url('../fonts/Gotham Book Regular.otf');
    font-weight: normal;
    font-style: normal;
}

/* ===========================================
   BASE
   =========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #292b2c;
    background-color: #f5f3ec;
    display: flex;
    flex-direction: row-reverse;
    min-height: 100vh;
}

/* ===========================================
   SIDEBAR
   =========================================== */
.sidebar {
    width: 460px;
    min-width: 460px;
    background: #fff;
    padding: 25px 30px;
    overflow-y: auto;
    border-left: 1px solid #e0e0e0;
    box-shadow: -14px 0 18px -18px rgba(0,0,0,0.28);
}

.sidebar h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 25px;
    color: #292b2c;
    text-transform: uppercase;
}

/* ===========================================
   FORM FIELDS
   =========================================== */
.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #87857f;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.field input,
.field select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d1d1;
    border-radius: 3px;
    background: #fff;
    color: #292b2c;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: #333744;
}

.field input:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

/* Input with button (location + GPS) */
.input-with-btn {
    display: flex;
    gap: 8px;
}

.input-with-btn input {
    flex: 1;
}

.btn-gps {
    padding: 10px 14px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-gps:hover {
    background: #333744;
}

.gps-icon {
    width: 16px;
    height: 16px;
}

/* Section titles */
.section-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #87857f;
    margin: 22px 0 10px 0;
    text-transform: uppercase;
}

/* ===========================================
   BUTTONS
   =========================================== */
.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 12px;
    border: 1px solid #d1d1d1;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    color: rgba(51,55,68,0.7);
    transition: all 0.15s ease-in-out;
    /* Lika bredd pa alla knappar */
    flex: 1 1 0;
    min-width: 0;
    /* Centrera text */
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    border-color: #999;
}

.btn.active {
    background: #333744;
    color: #fff;
    border-color: #333744;
}

/* Color buttons */
.color-btn {
    width: 38px;
    height: 38px;
    border: 2px solid #d1d1d1;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.color-btn:hover {
    border-color: #666;
}

.color-btn.active {
    border-color: #333744;
    box-shadow: 0 0 0 2px #333744;
}

/* Checkbox row */
.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    cursor: pointer;
    margin-top: 2px;
}

.checkbox-row label {
    font-size: 11px;
    color: #87857f;
    margin: 0;
    cursor: pointer;
    line-height: 1.4;
}

/* Order button */
.btn-order {
    width: 100%;
    padding: 15px 20px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    margin-top: 25px;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-order:hover {
    background: #333744;
}

.btn-order-icon {
    width: 20px;
    height: 20px;
}

/* ===========================================
   PREVIEW AREA
   =========================================== */
.preview-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: #858585;
}

/* ===========================================
   POSTER
   =========================================== */
.poster {
    background: #fff;
    /* Skugga for djup */
    box-shadow:
        0 20px 60px rgba(0,0,0,0.35),
        0 8px 25px rgba(0,0,0,0.2),
        14px 0 8px -8px rgba(0,0,0,0.28),
        -14px 0 8px -8px rgba(0,0,0,0.28);
    display: flex;
    flex-direction: column;
    position: relative;
    /* Tavelram - den yttre traramen for visualisering */
    border: var(--poster-border) solid #000;
}

.poster.portrait {
    width: calc(795px * var(--poster-scale));
    height: calc(1113px * var(--poster-scale));
}

.poster.landscape {
    width: calc(1113px * var(--poster-scale));
    height: calc(795px * var(--poster-scale));
}

/* Tavelram farger */
.poster.framecolor-black {
    border-color: #000;
}

.poster.framecolor-white {
    border-color: #fff;
    box-shadow:
        0 20px 60px rgba(0,0,0,0.35),
        0 8px 25px rgba(0,0,0,0.2),
        inset 0 0 0 1px rgba(0,0,0,0.1);
}

.poster-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin: 0;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Border elements */
.main-border,
.outer-border,
.inner-border {
    position: absolute;
    pointer-events: none;
}

.main-border {
    inset: 0;
    z-index: 2;
}

.outer-border {
    z-index: 3;
}

.inner-border {
    z-index: 4;
}

/* Map container */
.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    z-index: 1;
    isolation: isolate;
}

#map {
    width: 100%;
    height: 100%;
}

/* Poster text/label - default (i normal flow under kartan) */
.poster-text {
    padding: 15px 20px;
    text-align: center;
    background: #fff;
    position: relative;
    z-index: 10;
    user-select: none;
    pointer-events: none;
}

.poster-text h2 {
    font-size: 20px;
    letter-spacing: 3px;
    margin: 0 0 4px 0;
    text-transform: uppercase;
    font-weight: 700;
    color: #292b2c;
}

.poster-text h3 {
    font-size: 13px;
    letter-spacing: 2px;
    margin: 0 0 8px 0;
    color: #666;
    font-weight: 400;
    text-transform: uppercase;
}

.poster-text p {
    font-size: 10px;
    letter-spacing: 1px;
    color: #888;
    margin: 0;
}

/* ===========================================
   LEAFLET OVERRIDES
   =========================================== */
.leaflet-control-attribution,
.leaflet-control-zoom {
    display: none;
}

/* ===========================================
   FRAME STYLES (Passepartout inuti postern)
   =========================================== */

/* Borderless - Ingen passepartout */
.poster.frame-borderless .main-border,
.poster.frame-borderless .outer-border,
.poster.frame-borderless .inner-border {
    display: none;
}

/* Poster - Vit passepartout utan linjer */
.poster.frame-poster .main-border {
    border: var(--poster-poster) solid #fff;
}

.poster.frame-poster .outer-border,
.poster.frame-poster .inner-border {
    display: none;
}

/* Classic - Vit passepartout med dubbla svarta linjer */
.poster.frame-classic .main-border {
    border: var(--poster-classic) solid #fff;
}

.poster.frame-classic .outer-border {
    inset: var(--poster-classic);
    border: var(--poster-classic-outer) solid #000;
}

.poster.frame-classic .inner-border {
    inset: var(--poster-classic-inner);
    border: var(--poster-classic-inner-border) solid #000;
}

/* ===========================================
   THEMES
   Baserat pa gallerix.se/posterkarta stilar
   =========================================== */

/* Basic - Enkel vit bakgrund, centrerad text */
.poster.theme-basic .poster-text {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 12px 16px 36px;
    background: #fff;
    text-align: center;
}

.poster.theme-basic .poster-text h2 {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.15em;
    margin: 0;
}

.poster.theme-basic .poster-text h3 {
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.05em;
    line-height: 1.4;
    margin: 0 0 2px 0;
}

.poster.theme-basic .poster-text p {
    font-size: 8px;
    font-weight: 300;
    margin: 0;
}

/* Original - Gradient-fade + underline under titel */
.poster.theme-original .poster-text {
    position: absolute;
    width: 100%;
    bottom: 0;
    left: 0;
    z-index: 1000;
    font-size: 10px;
    padding: 12.5em 3.6em 4em;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #fff 50%);
    text-align: center;
}

.poster.theme-original .poster-text h2 {
    font-family: 'PD-Gotham-Medium', Arial, sans-serif;
    font-size: 4em;
    font-weight: 700;
    line-height: 1.05;
    margin: 0;
}

.poster.theme-original .poster-text h2::after {
    content: "";
    display: block;
    margin: 0.05em auto;
    width: 70%;
    height: 0.02em;
    background: #000;
}

.poster.theme-original .poster-text h3 {
    font-family: 'PD-Gotham-Light', Arial, sans-serif;
    display: inline-block;
    font-size: 2.6em;
    font-weight: 400;
    letter-spacing: 0.05em;
    line-height: 1.4;
    margin: 0 0 0.8em 0;
}

.poster.theme-original .poster-text p {
    font-family: 'PD-Gotham-Book', Arial, sans-serif;
    font-size: 1em;
    font-weight: 300;
    letter-spacing: 0.05em;
    margin: 0;
}

/* Modern - Vansterjusterad med border-top linje */
.poster.theme-modern .poster-text {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 9px 40px 32px;
    background: #fff;
    text-align: left;
    border-top: 3px solid #000;
}

.poster.theme-modern .poster-text h2 {
    font-size: 21px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0.05em;
    margin: 0;
    text-align: left;
}

.poster.theme-modern .poster-text h3 {
    font-size: 8px;
    font-weight: 300;
    letter-spacing: 0.05em;
    line-height: 1.4;
    margin: 0 0 9px 0;
    text-align: left;
}

.poster.theme-modern .poster-text p {
    font-size: 7px;
    font-weight: 300;
    margin: 0;
    text-align: left;
}

/* Boxed - Text i centrerad ruta som overlappar kartan */
.poster.theme-boxed .poster-text {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    padding: 16px 36px;
    background: #fff;
    text-align: center;
    width: fit-content;
    min-width: 50%;
}

/* Nitar - endast synliga for Boxed */
.nail-img {
    display: none;
}

.poster.theme-boxed .nail-img {
    display: block;
    position: absolute;
    width: 4px;
    height: 4px;
    background-image: url(../img/nail.svg);
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    z-index: 10;
}

.poster.theme-boxed .nail-img-top-left {
    top: 8px;
    left: 8px;
}

.poster.theme-boxed .nail-img-top-right {
    top: 8px;
    right: 8px;
}

.poster.theme-boxed .nail-img-bottom-left {
    bottom: 8px;
    left: 8px;
}

.poster.theme-boxed .nail-img-bottom-right {
    bottom: 8px;
    right: 8px;
}

.poster.theme-boxed .poster-text h2 {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0.1em;
    margin: 0;
}

.poster.theme-boxed .poster-text h3 {
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 0.05em;
    line-height: 1.4;
    margin: 0 0 9px 0;
    color: #000;
}

.poster.theme-boxed .poster-text p {
    font-size: 7px;
    font-weight: 300;
    margin: 0;
}

/* Gin - Gradient-fade + linjer vid sidan av underrubrik */
.poster.theme-gin .poster-text {
    position: absolute;
    width: 100%;
    bottom: 0;
    left: 0;
    z-index: 1000;
    padding: 100px 24px 36px;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #fff 50%);
    text-align: center;
}

.poster.theme-gin .poster-text h2 {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.08em;
    margin: 0;
    font-family: Georgia, 'Times New Roman', serif;
}

.poster.theme-gin .poster-text h3 {
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 0.18em;
    line-height: 1.4;
    margin: 0 0 8px 0;
    display: inline-block;
    position: relative;
    padding: 0 16px;
    max-width: 51%;
}

.poster.theme-gin .poster-text h3::before,
.poster.theme-gin .poster-text h3::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 32px;
    height: 1px;
    background: #000;
}

.poster.theme-gin .poster-text h3::before {
    right: 100%;
}

.poster.theme-gin .poster-text h3::after {
    left: 100%;
}

.poster.theme-gin .poster-text p {
    font-size: 9px;
    font-weight: 300;
    letter-spacing: 0.08em;
    margin: 0;
}

/* ===========================================
   RESPONSIVE
   Breakpoints: 1200px, 767px, 544px, 420px
   (matchat mot gallerix.se/posterkarta)
   =========================================== */

/* Mindre desktop */
@media (max-width: 1200px) {
    :root {
        --poster-scale: 0.8;
    }
    .sidebar {
        width: 400px;
        min-width: 400px;
        padding: 20px 25px;
    }
}

/* Tablet - stapla vertikalt */
@media (max-width: 767px) {
    body {
        flex-direction: column-reverse;
    }

    .sidebar {
        width: 100%;
        min-width: 100%;
        border-left: none;
        border-top: 1px solid #e0e0e0;
        max-height: none;
    }

    .preview-area {
        padding: 25px 15px;
        min-height: 480px;
    }

    :root {
        --poster-scale: 0.58;
    }

    /* Mindre text pa poster */
    .poster-text h2 {
        font-size: 18px !important;
        letter-spacing: 2px !important;
    }

    .poster-text h3 {
        font-size: 11px !important;
    }

    .poster-text p {
        font-size: 8px !important;
    }

    /* Sidebar justeringar */
    .btn-group {
        gap: 6px;
    }

    .btn {
        padding: 8px 10px;
        font-size: 12px;
        line-height: 1.2;
    }

    .color-btn {
        width: 32px;
        height: 32px;
    }

    /* Dölj GPS-text på mobil */
    .gps-text {
        display: none;
    }
}

/* Mobil - liten */
@media (max-width: 544px) {
    .preview-area {
        padding: 20px 10px;
        min-height: 400px;
    }

    :root {
        --poster-scale: 0.46;
    }

    .sidebar {
        padding: 15px 20px;
    }

    .sidebar h1 {
        font-size: 16px;
        margin-bottom: 20px;
    }

    .section-title {
        font-size: 11px;
        margin: 18px 0 8px 0;
    }

    .field label {
        font-size: 11px;
    }

    .field input,
    .field select {
        padding: 10px 12px;
        font-size: 13px;
    }

    .btn-order {
        padding: 12px 15px;
        font-size: 13px;
    }
}

/* Mobil - extra liten */
@media (max-width: 420px) {
    .poster.portrait {
        width: 200px;
        height: 280px;
    }

    .poster.landscape {
        width: 280px;
        height: 200px;
    }

    .poster {
        border-width: 8px;
    }

    .poster-text {
        padding: 8px 12px !important;
    }

    .poster-text h2 {
        font-size: 14px !important;
    }

    .poster-text h3 {
        font-size: 9px !important;
    }

    .btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .color-btn {
        width: 28px;
        height: 28px;
    }
}
