/* Cookie consent — centrerad modal med flikar */
.nop-consent {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2147483000;
    background: rgba(20, 20, 20, 0.5);
    padding: 16px;
    box-sizing: border-box;
    overflow: hidden;
}
.nop-consent.nop-consent-visible {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
}
.nop-consent *, .nop-consent *::before, .nop-consent *::after { box-sizing: border-box; }

.nop-consent-box {
    background: #fff;
    color: #222;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    overflow: hidden;
    text-align: left;
}
/* Bryt NopCommerce mobile body text-align:center som ärvs */
.nop-consent, .nop-consent * {
    text-align: left;
}
.nop-consent-tabs .nop-consent-tab { text-align: center; }
.nop-consent-btns { text-align: left; }

/* ---- Header (title + close) ---- */
.nop-consent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #f5f7f5;
    border-bottom: 1px solid #e5e5e5;
    border-radius: 10px 10px 0 0;
    flex-shrink: 0;
}
.nop-consent-header-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #111;
    line-height: 1.2;
}
.nop-consent-close {
    background: transparent;
    border: none;
    color: #777;
    font-size: 24px;
    line-height: 1;
    padding: 4px 10px;
    cursor: pointer;
    font-family: inherit;
    border-radius: 4px;
    margin: -4px -8px -4px 0;
}
.nop-consent-close:hover { color: #111; background: #f0f0f0; }

/* ---- Tabs ---- */
.nop-consent-tabs {
    display: flex;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
}
.nop-consent-tab {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 16px 12px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s;
}
.nop-consent-tab:hover { color: #2e7d32; }
.nop-consent-tab-active {
    color: #2e7d32;
    border-bottom-color: #2e7d32;
    font-weight: 600;
}

/* ---- Content panels ---- */
.nop-consent-content {
    flex: 0 1 auto; /* sizes to content, shrinks if needed (don't grow to fill 90vh) */
    overflow-y: auto;
    padding: 20px 28px;
    min-height: 0; /* IE flexbox fix */
}
.nop-consent-panel { color: #333; }
.nop-consent-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 12px;
    color: #111;
}
.nop-consent-text { margin: 0 0 12px; color: #444; }
.nop-consent-text a { color: #2e7d32; text-decoration: underline; }
.nop-consent-small { margin: 16px 0 0; color: #888; font-size: 12px; }

/* ---- Categories (Information panel) ---- */
.nop-consent-cats { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.nop-consent-cat {
    background: #f8f8f8;
    border: 1px solid #ececec;
    border-radius: 6px;
    padding: 14px 16px;
}
.nop-consent-panel > .nop-consent-text { margin-bottom: 16px; }
.nop-consent-cat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 32px;
}
.nop-consent-cat-label {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    flex: 1;
    min-width: 0;
    margin: 0 !important;
    line-height: 20px;
}
.nop-consent-cat-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    accent-color: #2e7d32;
    cursor: pointer;
    margin: 0;
    display: block;
}
.nop-consent-cat-label input[disabled] { cursor: not-allowed; opacity: 0.55; }
.nop-consent-cat-name {
    font-weight: 600;
    color: #111;
    font-size: 15px;
    line-height: 20px;
    display: inline-block;
}
.nop-consent-cat-toggle {
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.2;
    color: #444;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 30px;
}
.nop-consent-cat-toggle:hover { border-color: #2e7d32; color: #2e7d32; }
.nop-consent-cat-desc {
    margin: 10px 0 0 34px;
    color: #666;
    font-size: 13px;
    line-height: 1.5;
}
.nop-consent-cat-details {
    display: none;
    margin-top: 10px;
}

/* Providergrupper — stack av kollapsbara block */
.nop-consent-providers { display: flex; flex-direction: column; gap: 6px; }
.nop-consent-provider {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fff;
    overflow: hidden;
}
.nop-consent-provider-toggle {
    width: 100%;
    text-align: left;
    background: #fafafa;
    border: none;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #222;
}
.nop-consent-provider-toggle:hover { background: #f0f0f0; }
.nop-consent-provider-arrow { display: inline-block; width: 12px; color: #888; font-size: 10px; }
.nop-consent-provider-count { color: #888; font-size: 12px; margin-left: auto; }
.nop-consent-provider-body { display: none; border-top: 1px solid #e0e0e0; }
.nop-consent-provider-open .nop-consent-provider-body { display: block; }
.nop-consent-cat.nop-consent-expanded .nop-consent-cat-details { display: block; }

.nop-consent-cookies {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: fixed;
}
.nop-consent-cookies th,
.nop-consent-cookies td {
    padding: 8px 10px !important;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #f0f0f0;
    border-right: 1px solid #f0f0f0;
    word-break: break-word;
}
.nop-consent-cookies th:last-child,
.nop-consent-cookies td:last-child { border-right: none; }
.nop-consent-cookies th {
    background: #f5f5f5;
    font-weight: 600;
    color: #333;
}
.nop-consent-cookies tr:last-child td { border-bottom: none; }
.nop-consent-cookies td:first-child {
    font-family: Consolas, Menlo, monospace;
    color: #222;
    word-break: break-all;
}

/* ---- Footer buttons ---- */
.nop-consent-btns {
    display: flex;
    gap: 14px; /* moderna webbläsare */
    padding: 16px 28px;
    border-top: 1px solid #e5e5e5;
    background: #fafafa;
    flex-shrink: 0;
    justify-content: flex-end;
}
/* IE 11 stödjer inte flex gap — använd margin som fallback */
.nop-consent-btns .nop-consent-btn + .nop-consent-btn { margin-left: 14px; }
@supports (gap: 14px) {
    .nop-consent-btns .nop-consent-btn + .nop-consent-btn { margin-left: 0; }
}
.nop-consent-btn {
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s;
}
.nop-consent-btn-primary { background: #2e7d32; color: #fff; border-color: #2e7d32; }
.nop-consent-btn-primary:hover { background: #1b5e20; border-color: #1b5e20; }
.nop-consent-btn-secondary { background: #fff; color: #333; border-color: #d0d0d0; }
.nop-consent-btn-secondary:hover { background: #f5f5f5; border-color: #999; }

/* ---- Mobile ---- */
@media (max-width: 479px) {
    /* Centrerad modal även på mobil — sajten skymtar bakom */
    .nop-consent { padding: 12px; }
    .nop-consent-box {
        max-width: 100%;
        max-height: calc(100vh - 24px);
        border-radius: 10px;
    }
    .nop-consent-content { padding: 16px; }
    .nop-consent-btns {
        padding: 12px 16px;
        flex-direction: column-reverse;
    }
    .nop-consent-btn { width: 100%; padding: 12px; }
    .nop-consent-tab { padding: 14px 8px; font-size: 13px; }
    /* Stapla-layout på små skärmar: varje rad blir ett kort med etiketter */
    .nop-consent-cookies, .nop-consent-cookies tbody,
    .nop-consent-cookies tr, .nop-consent-cookies td {
        display: block;
        width: 100%;
    }
    .nop-consent-cookies thead { display: none; }
    .nop-consent-cookies tr {
        border-bottom: 1px solid #e0e0e0;
        padding: 10px 0;
    }
    .nop-consent-cookies tr:last-child { border-bottom: none; }
    .nop-consent-cookies td {
        padding: 4px 10px !important;
        border: none !important;
        font-size: 12px;
    }
    .nop-consent-cookies td::before {
        content: attr(data-label);
        display: block;
        font-size: 10px;
        font-weight: 600;
        color: #888;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        margin-bottom: 2px;
    }
}
