:root {
    --primary: #003366;    /* Konsumentett-blå */
    --secondary: #f4f4f4;  /* Ljusgrå bakgrund för tabeller etc */
    --accent: #d9534f;     /* Accentfärg (t.ex. priser) */
    --text: #333;          /* Standard textfärg */
    --white: #fff;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f9f9f9;
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Layout --- */
.container {
    width: 90%;
    max-width: 1100px;
    margin: auto;
    padding: 20px 0;
}

/* --- Header & Navigation --- */
header {
    background-color: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.logo img { 
    height: 50px; 
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    padding: 0;
    margin: 0;
}

.nav-links a {
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
    font-size: 1.1rem;
}

.nav-links a:hover { 
    color: #005599; 
}

/* --- Dropdown Meny (För Ledigt-filtret) --- */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 180px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1000;
    border-radius: 4px;
    top: 100%;
    left: 0;
}

.dropdown-content a {
    color: var(--text);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 1rem;
    font-weight: normal;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
    color: var(--primary);
}

/* Visa dropdown vid hovring */
.dropdown:hover .dropdown-content {
    display: block;
}

/* --- Mobilmeny (Hamburgare) --- */
.hamburger, #menu-toggle { 
    display: none; 
}

@media (max-width: 768px) {
    .hamburger { 
        display: block; 
        font-size: 28px; 
        cursor: pointer; 
        color: var(--primary); 
    }
    
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 70px;
        right: 0;
        background: white;
        width: 100%;
        text-align: center;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
        padding: 20px 0;
    }

    /* Mobilanpassning av dropdown */
    .dropdown-content {
        position: relative;
        box-shadow: none;
        background-color: #eee;
        width: 100%;
        text-align: center;
    }

    #menu-toggle:checked + .hamburger + .nav-links { 
        display: flex; 
    }
}

/* --- Hero Section --- */
.hero {
    background: var(--primary);
    color: white;
    padding: 4rem 2rem;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    background: white;
    color: var(--primary);
    padding: 10px 20px;
    text-decoration: none;
    font-weight: bold;
    border-radius: 4px;
    margin-top: 10px;
}
.btn:hover { background: #eee; }

/* --- Grid & Kort (Fastigheter & Objekt) --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #ddd;
    transition: transform 0.2s;
}

.card:hover { transform: translateY(-3px); }

.card-img {
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: #ccc;
}

.card-content { padding: 20px; }

.card h3 { 
    margin-top: 0; 
    color: var(--primary); 
}

.address { 
    color: #666; 
    font-size: 0.9rem; 
    margin-bottom: 10px; 
}

.link-btn {
    display: block;
    margin-top: 15px;
    color: var(--primary);
    text-decoration: none;
    font-weight: bold;
}

/* Små knappar (t.ex. Intresseanmälan) */
.btn-small {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-top: 10px;
}
.btn-small:hover { background-color: #004488; }

/* --- Tabeller --- */
.table-responsive { overflow-x: auto; }

table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 20px; 
    background: white; 
}

th, td { 
    padding: 12px; 
    text-align: left; 
    border-bottom: 1px solid #ddd; 
}

th { 
    background-color: var(--secondary); 
    color: var(--primary); 
}

.row-ledigt { background-color: #f0f9ff; }

/* --- Status Badges --- */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
}
.status-badge.ledigt { background: #d4edda; color: #155724; }
.status-badge.uthyrt { background: #f8d7da; color: #721c24; }
.status-badge.ej { background: #e2e3e5; color: #383d41; }

/* --- Footer --- */
footer {
    background: var(--primary);
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: auto;
}
footer a { color: #aecfee; }

/* --- Sektioner & Hjälpklasser --- */
.section-padding { padding: 40px 0; }

.bg-light { 
    background-color: #f0f2f5; 
    /* Mobilfix: Undviker scrollbar i sidled men fyller ut bakgrunden */
    margin: 40px -20px; 
    padding: 40px 20px; 
    width: auto;
    border-radius: 8px;
}

.tag {
    display: inline-block;
    background-color: #eee;
    color: #555;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 5px;
}

/* --- Hyresgäster Grid (Flexbox) --- */
.hyresgaster-grid {
    display: flex;
    flex-wrap: wrap;         /* Radbryt automatiskt */
    justify-content: center; /* Centrera blocken */
    gap: 20px;
    
    /* Maxbredd håller ihop loggorna snyggt under texten */
    max-width: 900px;        
    margin: 20px auto;       
}

.hyresgast {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    
    width: 150px;            /* Fast storlek på desktop */
    height: 140px;           
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    
    transition: transform 0.2s, box-shadow 0.2s;
}

.hyresgast:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.hyresgast img {
    max-width: 100%;
    max-height: 70px; 
    width: auto;
    object-fit: contain;
    margin-bottom: 10px;
}

.hyresgast a {
    text-decoration: none;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
}

/* Mobilanpassning för hyresgäster */
@media (max-width: 768px) {
    .hyresgaster-grid {
        gap: 10px;
        width: 100%; 
    }
    
    .hyresgast {
        width: 130px; /* Lite mindre rutor på mobil */
        height: 130px;
        padding: 10px;
    }
}

/* --- Detaljbox för Fastighet (Bekvämligheter m.m.) --- */
.info-box-details {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin: 20px 0;
    border-left: 5px solid var(--primary);
}

.amenities-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
    padding-left: 20px;
}

.amenities-list li {
    margin-bottom: 5px;
}

.price {
    color: var(--accent);
    font-weight: bold;
    font-size: 1.1rem;
}

/* --- Galleri & Lightbox --- */
.gallery-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    pointer-events: none;
}

.btn-gallery {
    background-color: #6c757d; /* Grå knapp för galleri */
    cursor: pointer;
    border: none;
}
.btn-gallery:hover { background-color: #5a6268; }

/* Lightbox Modal */
.lightbox {
    display: none; /* Dold som standard */
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9);
    justify-content: center;
    align-items: center;
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90vh;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.prev, .next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: white;
    font-weight: bold;
    font-size: 30px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
}
.next { right: 0; border-radius: 3px 0 0 3px; }
.prev { left: 0; border-radius: 3px 0 0 3px; }
.prev:hover, .next:hover { background-color: rgba(0,0,0,0.8); }

@media only screen and (max-width: 700px) {
    .lightbox-content { width: 100%; }
}

/* --- Kontaktformulär --- */
.contact-container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.contact-form {
    margin-top: 20px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--primary);
}

.form-group input, 
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box; /* Viktigt för att padding inte ska spräcka bredden */
}

.form-group input:focus, 
.form-group textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 5px rgba(0, 51, 102, 0.2);
}

/* Meddelanderutor (Succé/Fel) */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-weight: bold;
}
.alert.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.alert.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Mobilanpassning */
@media (max-width: 768px) {
    .contact-container {
        padding: 20px;
    }
}