/* view-profile.css */

/* Variabler */
:root {
    --primary: #2563eb; /* Blå for lenker og aksenter */
    --accent: #eab308; /* Gul for knapper */
    --accent-dark: #ca8a04; /* Mørkere gul for hover */
    --light-bg: #f9fafb; /* Lys bakgrunn */
    --custom-beige: #DDCDB5;
}

/* Generell layout */
* {
    box-sizing: border-box; /* Sikrer at padding inkluderes i bredde for å unngå overflow */
}
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: var(--custom-beige) !important;
    overflow-x: hidden; /* Klipper horisontal overflow på hele siden */
}

/* Content wrapper */
.content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 1280px; /* max-w-6xl */
    margin: 0 auto;
    padding: 0 16px; /* Redusert padding på mobil */
    box-sizing: border-box;
    flex-wrap: nowrap; /* Forhindrer wrapping */
    overflow-x: hidden; /* Ekstra sikkerhet mot overflow */
}

/* Hovedinnhold */
.main-content {
    flex-grow: 1;
    width: 100%;
    order: 1; /* Sørger for at main-content kommer først */
    margin: 0 auto; /* Midtstiller på mobil */
    max-width: 100%; /* Sikrer ingen overstyring */
    overflow-x: hidden; /* Klipper overflow i hovedinnhold */
}

/* Sidebar */
.sidebar {
    width: 100%;
    max-width: 100%; /* Full bredde på mobil */
    border: 1px solid var(--primary);
    order: 2; /* Sørger for at sidebar kommer etter main-content */
    margin-top: 16px; /* Avstand på mobil */
}

/* Spesifikk styling for profilkort i sidebar */
.sidebar .profil-kort {
    height: auto;
    min-height: 120px;
    padding: 8px;
    border: 1px solid var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

/* Juster bilde i sidebar */
.sidebar .profil-kort img {
    height: 80px;
    width: 100%;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

/* Fjern divider for sidebar-kort */
.sidebar .profil-kort .profile-divider {
    display: none;
}

/* Tilpass tekststørrelser */
.sidebar .profil-kort h3 {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.sidebar .profil-kort p {
    font-size: 0.75rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.sidebar .profil-kort a {
    font-size: 0.75rem;
    color: var(--primary);
    text-decoration: underline;
}

/* Juster verifisert-badge i sidebar */
.sidebar .profil-kort .verifisert-badge {
    font-size: 0.65rem;
    padding: 1px 4px;
}

/* Profil-seksjon */
.profile {
    padding: 16px 0; /* Tilpasset padding for mobil */
    max-width: 100%;
    margin: 0 auto;
}

/* Profil-kort */
.profil-kort {
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 12px; /* Redusert for små skjermer */
    border: 1px solid var(--primary);
    overflow: hidden;
    width: 100%;
    max-width: 100%; /* Full bredde på mobil */
    margin: 0 auto;
    height: auto;
    min-height: auto;
}
.profil-kort img:not(.carousel-thumbnail-item) {
    height: auto;
    max-width: 95%;
    width: 100%;
}
.profil-kort .carousel-thumbnail-item {
    width: 80px; /* Ytterligere redusert for <640px */
    height: 53px; /* Bevar aspekt */
    object-fit: cover;
}
.profil-kort img {
    width: 100%;
    height: auto; /* Endret for bedre responsivitet */
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

/* Profil-kort */
.profil-kort-view {
    background-color: white;
    height: 360px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 12px;
    border: 1px solid var(--primary);
    cursor: pointer;
    overflow: hidden;
}
.profil-kort-view img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

/* Fremhevet-badge for nærliggende profiler */
.nearby-profiles .profil-kort .fremhevet-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    background-color: var(--primary);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}
.fremhevet-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: var(--primary);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Verifisert-badge */
.verifisert-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: #22c55e;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Status-badge */
.status-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}
.status-badge.open {
    background-color: #22c55e;
    color: white;
}
.status-badge.closed {
    background-color: #ef4444;
    color: white;
}

/* Profile-divider og logo */
.profile-divider {
    position: relative;
    height: 2px;
    background-color: #e0e0e0;
    margin: 1rem 0;
}
.logo-wrapper {
    position: absolute;
    top: -1.5rem;
    left: 3%;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.profile-divider .profile-logo {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    z-index: 11;
}

/* Annonser */
.ad-banner .ad-placeholder {
    background-color: #e5e7eb;
    border-radius: 6px;
    padding: 12px; /* Redusert for små skjermer */
    text-align: center;
    font-size: 0.875rem;
    margin: 0 auto;
    max-width: 100%;
}

/* YouTube-video */
.ad-placeholder .youtube-video {
    position: relative;
    width: 100%;
    max-width: 100%; /* Tilpasset */
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}
.ad-placeholder .youtube-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 6px;
}
.ad-placeholder:has(.youtube-video) {
    background: none;
    padding: 0;
    height: auto;
}

/* Kart */
#map {
    height: 200px; /* Ytterligere redusert for <640px */
    width: 100%;
    border-radius: 8px;
}

/* Knapper */
.claim-profile-button, .send-message-button, .register-salon-button {
    background-color: var(--accent);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
    width: 100%; /* Full bredde på mobil for bedre touch */
    text-align: center;
}
.claim-profile-button:hover, .send-message-button:hover, .register-salon-button:hover {
    background-color: var(--accent-dark);
}

/* Fordeler med thaimassasje */
.benefits-thai-massage {
    background: linear-gradient(to bottom, #f9fafb, #e5e7eb);
}
.benefits-thai-massage .grid > div {
    padding: 8px; /* Redusert for små skjermer */
    border-radius: 6px;
}
.benefits-thai-massage .grid > div.bg-blue-50 { background-color: #eff6ff; }
.benefits-thai-massage .grid > div.bg-green-50 { background-color: #f0fdf4; }
.benefits-thai-massage .grid > div.bg-yellow-50 { background-color: #fefce8; }
.benefits-thai-massage .grid > div.bg-purple-50 { background-color: #faf5ff; }
.benefits-thai-massage .grid > div.bg-pink-50 { background-color: #fdf2f8; }
.benefits-thai-massage .grid > div.bg-teal-50 { background-color: #f0fdfa; }

/* FB-page */
.fb-page { margin-top: 1rem; max-width: 100%; }

/* Card tables */
.card.services table, .card.opening-hours table {
    width: 100%; border-collapse: collapse; margin-top: 0.5rem;
    overflow-x: auto; /* Tillater horisontal scroll på små skjermer */
}
.card.services th, .card.services td, .card.opening-hours th, .card.opening-hours td {
    padding: 0.5rem; border-bottom: 1px solid #e5e7eb; text-align: left;
}
.card.services th, .card.opening-hours th {
    font-weight: 600; color: #1f2937;
}
.card.services td {
    color: #4b5563;
}

/* Proof-container */
.proof-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 0.5rem; justify-content: center; /* Midtstiller på mobil */ }
.proof-item { cursor: pointer; }
.proof-item img { width: 100px; height: 100px; object-fit: cover; border-radius: 4px; } /* Ytterligere redusert */
.proof-item a { display: flex; align-items: center; color: #2563eb; text-decoration: none; font-size: 0.875rem; }
.proof-item a:hover { text-decoration: underline; }
.proof-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 1000; justify-content: center; align-items: center; }
.proof-modal img { max-width: 90%; max-height: 90%; border-radius: 8px; }
.proof-modal-close { position: absolute; top: 20px; right: 20px; color: white; font-size: 24px; cursor: pointer; }

/* Profil-bilder */
.profile-images {
    text-align: center;
    max-width: 100%;
    overflow: hidden; /* Klipper overflow */
}
.profile-images img {
    max-width: 100%; /* Endret for mobil */
    height: auto;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
    object-fit: contain;
}

/* Card */
.card {
    background-color: #FFFFFF;
    padding: 0.75rem; /* Ytterligere redusert for <640px */
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 1.5rem;
    max-width: 100%;
    overflow: hidden;
}
.card h3 {
    font-size: 1.1rem; /* Redusert for små skjermer */
    color: #333333;
    margin-bottom: 1rem;
}

/* Services table */
.services th,
.services td {
    padding: 0.3rem; /* Redusert for små skjermer */
    border-bottom: 1px solid #EEEEEE;
    text-align: left;
}
.services th {
    font-weight: 600;
    color: #333333;
}
.services td {
    color: #4b5563;
}

/* Opening hours table */
.opening-hours th,
.opening-hours td {
    padding: 0.3rem;
    text-align: left;
    border-bottom: 1px solid #EEEEEE;
}
.opening-hours th {
    font-weight: bold;
    color: #333333;
}

/* Map container */
.map-container {
    margin-top: 1.5rem;
    max-width: 100%;
    overflow: hidden;
}
.map-container h3 {
    font-size: 1rem; /* Redusert */
    color: #333333;
    margin-bottom: 1rem;
}

/* Meldinger container */
.profile .meldinger-container {
    margin-top: 1.5rem;
}
.profile .meldinger-container h2 {
    font-size: 1.5rem; /* Redusert */
    color: #333333;
    margin-bottom: 1rem;
}

/* Karusell-styling for gallery-modal */
#galleryModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
#galleryModal.show {
    display: flex;
}
.carousel-container {
    position: relative;
    width: 100%;
    max-width: 100%; /* Tilpasset for mobil */
    margin: 0 auto;
    overflow: hidden;
}
.carousel {
    display: flex;
    transition: transform 0.5s ease-in-out;
}
.carousel-item {
    min-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    height: auto; /* Endret for mobil */
    max-height: 50vh; /* Redusert for små skjermer */
}
.carousel-item img {
    max-width: 100%;
    max-height: 50vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}
.carousel-item .error-message {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: #FFFFFF;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    z-index: 10;
}
.carousel-prev,
.carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: #FFFFFF;
    padding: 0.5rem;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.carousel-prev:hover,
.carousel-next:hover {
    background-color: rgba(0, 0, 0, 0.7);
}
.carousel-prev {
    left: 1rem;
}
.carousel-next {
    right: 1rem;
}
.carousel-dots {
    text-align: center;
    margin-top: 1rem;
}
.carousel-dot {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    background-color: #BBBBBB;
    border-radius: 50%;
    margin: 0 0.25rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.carousel-dot.active {
    background-color: var(--primary);
}
.close-button {
    position: absolute;
    top: -2.5rem;
    left: -1.5rem;
    color: #FFFFFF;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
}

/* Carousel thumbnail */
.carousel-thumbnail-container {
    position: relative;
    background-color: #000000;
    width: 100%;
    max-width: 100%; /* Full bredde på mobil */
    margin: 0 auto;
    overflow: hidden;
    padding: 0;
    font-size: 0;  
    line-height: 0;  
}
.carousel-thumbnail {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 4px; /* Liten gap for bedre separasjon uten å øke bredde */
    padding: 0;
    margin: 0;
    scrollbar-width: thin;
    max-height: 260px; /* Ytterligere redusert for <640px */
    width: auto;
    justify-content: flex-start; /* Endret fra center for å unngå overflow */
    white-space: nowrap;
    overflow-x: auto;
}
.carousel-thumbnail-item {
    flex: 0 0 auto;
    width: 160px; /* Ytterligere redusert for <640px */
    height: 160px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    scroll-snap-align: start;
    transition: transform 0.3s ease, opacity 0.3s ease;
    border-right: 1px solid #e5e7eb;
    padding: 0;
    margin: 0;
    display: inline-block;
    box-sizing: border-box;
}
.carousel-thumbnail-item:last-child {
    border-right: none;
}
.carousel-thumbnail-prev,
.carousel-thumbnail-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: #FFFFFF;
    padding: 0.5rem;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.carousel-thumbnail-prev:hover,
.carousel-thumbnail-next:hover {
    background-color: rgba(0, 0, 0, 0.7);
}
.carousel-thumbnail-prev {
    left: 1rem;
}
.carousel-thumbnail-next {
    right: 1rem;
}

/* Siste annonser */
.siste-annonser .profil-kort {
    cursor: pointer;
}
.siste-annonser .profil-kort:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* FB-page (ny styling for å forhindre overflow) */
.fb-page {
    width: 100%;
    max-width: 100%; /* Tvinger til å passe i container */
    overflow: hidden; /* Klipper eventuell overflow */
}

.profil-kort ul {
    list-style-type: none;
    padding-left: 0;
}

.profil-kort img.payment-icon {
    width: 2rem; /* 20px – matcher typisk ikonstørrelse, juster til 1rem (16px) hvis for stort */
    height: auto;   /* Bevarer aspekt ratio basert på SVGens viewBox */
    object-fit: contain;
    vertical-align: middle; /* Bedre alignment med teksten i listen */
}

/* Media Queries - Små skjermer først (mobil-først tilnærming) */

/* Spesifikk for <640px */
@media (max-width: 640px) {
    .content-wrapper {
        padding: 0 8px; /* Ytterligere redusert */
    }
    .profil-kort {
        padding: 12px;
    }
    .card {
        padding: 0.75rem;
    }
    .card h3 {
        font-size: 1.1rem;
    }
    .services th, .services td, .opening-hours th, .opening-hours td {
        padding: 0.3rem;
        font-size: 0.85rem;
    }
    .carousel-container {
        max-width: 100%;
    }
    .carousel-item {
        height: auto;
        max-height: 50vh;
    }
    .carousel-item img {
        max-height: 50vh;
    }
    .close-button {
        top: -1.5rem;
        left: -0.5rem;
    }
    .fb-page {
        max-width: 100%;
    }
    .proof-container {
        flex-direction: column; /* Stack vertikalt for små skjermer */
        align-items: center;
    }
    .proof-item img {
        width: 100px;
        height: 100px;
    }
    .nearby-profiles .grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .benefits-thai-massage .grid {
        grid-template-columns: 1fr;
    }
    .profile .meldinger-container h2 {
        font-size: 1.5rem;
    }
    .map-container h3 {
        font-size: 1rem;
    }
    .card.services table, .card.opening-hours table {
        border: 0;
    }
    .card.services thead, .card.opening-hours thead {
        display: none;
    }
    .card.services tr, .card.opening-hours tr {
        display: block;
        margin-bottom: 1rem;
        border-bottom: 1px solid #e5e7eb;
    }
    .card.services td, .card.opening-hours td {
        display: block;
        text-align: right;
        position: relative;
        padding-left: 50%;
        border: none;
    }
    .card.services td:before, .card.opening-hours td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 50%;
        padding-left: 0.5rem;
        font-weight: bold;
        text-align: left;
    }
    .carousel-thumbnail-item {
        height: 70px; /* Eksempel: Øk høyden her for små skjermer. */
    }
    .carousel-thumbnail {
        max-height: 100px; /* Øk denne for å gi mer plass til karusellen totalt. */
    }
}

/* For middels skjermer (641px+) */
@media (min-width: 641px) {
    .content-wrapper {
        padding: 0 20px;
    }
    .profile {
        padding: 24px 12px;
    }
    .profil-kort {
        padding: 16px;
    }
    .profil-kort .carousel-thumbnail-item {
        width: 100px;
        height: 67px;
    }
    .ad-banner .ad-placeholder {
        padding: 16px;
    }
    #map {
        height: 250px;
    }
    .benefits-thai-massage .grid > div {
        padding: 12px;
    }
    .card {
        padding: 1rem;
    }
    .card h3 {
        font-size: 1.25rem;
    }
    .services th,
    .services td {
        padding: 0.5rem;
    }
    .opening-hours th,
    .opening-hours td {
        padding: 0.5rem;
    }
    .map-container h3 {
        font-size: 1.25rem;
    }
    .profile .meldinger-container h2 {
        font-size: 1.75rem;
    }
    .carousel-item {
        max-height: 60vh;
    }
    .carousel-item img {
        max-height: 60vh;
    }
    .carousel-thumbnail-item {
        width: 100px;
        height: 100px;
    }
    .carousel-thumbnail {
        max-height: 120px;
        gap: 0;
    }
    .claim-profile-button, .send-message-button, .register-salon-button {
        width: auto;
    }
}

/* For middels til store skjermer (768px+) */
@media (min-width: 768px) {
    .content-wrapper {
        padding: 0 24px;
    }
    .sidebar {
        max-width: 220px;
    }
    .profil-kort {
        padding: 24px;
        max-width: 800px;
    }
    .profil-kort .carousel-thumbnail-item {
        width: 160px;
        height: 160px;
    }
    #map {
        height: 384px;
    }
    .card {
        padding: 1.5rem;
    }
    .card h3 {
        font-size: 1.5rem;
    }
    .fb-page {
        max-width: 100%;
    }
    .carousel-thumbnail-item {
        width: 160px;
        height: 160px;
    }
    .carousel-thumbnail {
        max-height: 160px;
    }
}

/* For nettbrett (768px–1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .profil-kort {
        padding: 1.5rem;
    }
    .carousel-thumbnail-item {
        width: 140px;
        height: 140px;
    }
    .card {
        padding: 1.25rem;
    }
    .nearby-profiles .grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .benefits-thai-massage .grid {
        grid-template-columns: repeat(2, 1fr);
    }
    #map {
        height: 300px;
    }
    .proof-item img {
        width: 160px;
        height: 160px;
    }
}

/* For store skjermer (1024px+) */
@media (min-width: 1024px) {
    .content-wrapper {
        flex-direction: row;
        align-items: flex-start;
        gap: 24px;
    }
    .main-content {
        max-width: calc(100% - 280px);
    }
    .sidebar {
        max-width: 256px;
        margin-left: auto;
        position: sticky;
        top: 24px;
        margin-top: 0;
    }
    .ad-banner .ad-placeholder {
        width: 728px;
        height: 200px;
    }
}

/* Skjul piler på mobil for swipe */
@media (max-width: 767px) {
    .carousel-thumbnail-prev,
    .carousel-thumbnail-next {
        display: none;
    }
}

/* For max-width 1023px (mobil/nettbrett) */
@media (max-width: 1023px) {
    .ad-banner .ad-placeholder {
        width: 100%;
        height: auto;
    }
}