/* =====================================================
   GLOBAL RESET & GRUNDSTIL
===================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    overflow-y: scroll;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2937;
    line-height: 1.45;
}

a {
    text-decoration: none;
    color: inherit;
}

/* 🔒 LÅSER SCROLL VID ÖPPEN MOBILMENY (INGEN VISUELL EFFEKT) */
body.menu-open {
    overflow: hidden;
}

/* =====================================================
   TOPBAR / NAVIGATION (DESKTOP – OBERÖRD)
===================================================== */
.topbar {
    background: #1f2937;
    color: #ffffff;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
}

.menu-toggle {
    display: none;
}

.nav-menu {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 6px;
    white-space: nowrap;
}

.nav-left,
.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-right {
    margin-left: auto;
}

.nav-menu a,
.admin-toggle {
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 600;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
}

.nav-menu a:hover,
.admin-toggle:hover {
    background: rgba(255,255,255,0.15);
}

.topbar .danger {
    color: #fca5a5;
}

/* =====================================================
   DROPDOWNS (DESKTOP – OBERÖRD)
===================================================== */
.admin-dropdown {
    position: relative;
}

.admin-toggle {
    background: rgba(255,255,255,0.1);
}

.admin-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 220px;
    background: #111827;
    border-radius: 10px;
    padding: 8px;
    z-index: 1000;
}

.admin-dropdown.open .admin-menu {
    display: block;
}

.admin-menu a {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
}

.admin-menu a:hover {
    background: rgba(255,255,255,0.12);
}

/* =====================================================
   CONTENT
===================================================== */
.container {
    max-width: 1200px;
    margin: 28px auto;
    padding: 0 20px;
}

/* =====================================================
   CARD
===================================================== */
.card {
    background: #ffffff;
    padding: 22px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

/* =====================================================
   TEXT
===================================================== */
h1, h2, h3, h4 {
    margin-top: 0;
}

h2 { margin-bottom: 12px; }
h4 { margin-bottom: 10px; }

.muted {
    color: #6b7280;
    font-size: 0.9em;
}

/* =====================================================
   FORMS
===================================================== */
label {
    font-weight: 600;
    display: block;
    margin-top: 14px;
}

input,
select,
textarea {
    width: 100%;
    padding: 9px 10px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

/* =====================================================
   ✏️ INLINE EDIT
===================================================== */
.inline-edit {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-edit input {
    flex: 1;
}

.inline-edit input[readonly] {
    background: #f3f4f6;
    border: 1px dashed #cbd5e1;
    color: #374151;
}

.inline-edit button {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #e5e7eb;
    color: #1f2937;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.inline-edit button:hover {
    background: #d1d5db;
}

/* =====================================================
   BUTTONS
===================================================== */
.btn {
    padding: 9px 16px;
    border-radius: 6px;
    background: #2563eb;
    color: white;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.btn.secondary {
    background: #e5e7eb;
    color: #1f2937;
}

.btn.danger {
    background: #dc2626;
}

.btn.small {
    padding: 6px 10px;
    font-size: 13px;
}

/* =====================================================
   TABLES
===================================================== */
table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

/* =====================================================
   🔐 PERMISSIONS UI
===================================================== */
.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* =====================================================
   📱 MOBILE – FIXA ADMIN DROPDOWN UTAN HAMBURGARMENY
===================================================== */
@media (max-width: 768px) {

    /* Flytta admin-dropdown ur hamburgarmenyn och placera den i topbaren */
    .admin-dropdown {
        position: absolute;
        right: 20px;  /* Placera till höger i topbaren på mobil */
        top: 12px;
    }

    .menu-toggle {
        display: block;
        font-size: 22px;
        padding: 6px 10px;
        border-radius: 8px;
        background: rgba(255,255,255,0.15);
        color: white;
        border: none;
    }

    .nav-menu {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        width: 100%;
        height: calc(100vh - 56px);
        background: #1f2937;
        padding: 12px;
        z-index: 3000;
        flex-direction: column;
        overflow-y: auto;
    }

    .nav-menu.open {
        display: flex;
    }

    .nav-left {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .nav-left a {
        padding: 12px 14px;
        border-radius: 8px;
        color: #ffffff;
        font-weight: 600;
    }

    .nav-left a:hover {
        background: rgba(255,255,255,0.15);
    }

    .nav-right {
        margin-top: 12px;
    }
}
