/* ================================================================
   Mediebibliotek – Stylesheet v1.0
   Palette: #0d1b2a (navy), #007c77 (teal), #f0f4f8 (light bg),
            #1a3c5e (dark accent), #ffffff, #e53e3e (danger)
================================================================ */

/* ── Reset / scope ───────────────────────────────────────────────── */
.mb-app *, .mb-app *::before, .mb-app *::after { box-sizing: border-box; margin: 0; padding: 0; }
.mb-app { font-family: 'Inter', system-ui, -apple-system, sans-serif; color: #1a2b3c; background: transparent; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.mb-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 6px; font-size: 14px; font-weight: 600;
    cursor: pointer; border: none; transition: background .15s, transform .1s, box-shadow .15s;
    line-height: 1.4; white-space: nowrap;
}
.mb-btn:hover  { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,.15); }
.mb-btn:active { transform: translateY(0); }
.mb-btn-primary { background: #007c77; color: #fff; }
.mb-btn-primary:hover { background: #005f5b; }
.mb-btn-ghost   { background: transparent; color: #007c77; border: 1.5px solid #007c77; }
.mb-btn-ghost:hover { background: #edf7f7; }
.mb-btn-warning { background: #d97706; color: #fff; }
.mb-btn-warning:hover { background: #b45309; }
.mb-btn-success { background: #059669; color: #fff; }
.mb-btn-success:hover { background: #047857; }
.mb-btn-danger  { background: #dc2626; color: #fff; }
.mb-btn-danger:hover  { background: #b91c1c; }

/* ── Top bar ─────────────────────────────────────────────────────── */
.mb-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 0 20px; border-bottom: 2px solid #e2e8f0; margin-bottom: 20px;
    flex-wrap: wrap; gap: 12px;
}
.mb-logo { font-size: 20px; font-weight: 800; color: #0d1b2a; letter-spacing: -0.5px; }
.mb-topbar-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mb-login-note { font-size: 13px; color: #64748b; }
.mb-login-note a { color: #007c77; font-weight: 600; text-decoration: none; }

/* ── Filter bar ──────────────────────────────────────────────────── */
.mb-filterbar {
    display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap;
}
.mb-search-wrap {
    position: relative; flex: 1; min-width: 220px;
}
.mb-search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; pointer-events: none;
}
.mb-filterbar input[type="text"] {
    width: 100%; padding: 9px 12px 9px 36px; border: 1.5px solid #cbd5e1;
    border-radius: 8px; font-size: 14px; outline: none; transition: border-color .15s;
    background: #fff;
}
.mb-filterbar input[type="text"]:focus { border-color: #007c77; box-shadow: 0 0 0 3px rgba(0,124,119,.12); }
.mb-sort-wrap select {
    padding: 9px 12px; border: 1.5px solid #cbd5e1; border-radius: 8px;
    font-size: 14px; outline: none; background: #fff; cursor: pointer; color: #1a2b3c;
}
.mb-sort-wrap select:focus { border-color: #007c77; }

/* ── Category tabs ───────────────────────────────────────────────── */
.mb-cats-wrap {
    display: flex; align-items: center; gap: 12px; margin-bottom: 24px;
    border-bottom: 2px solid #e2e8f0; padding-bottom: 0; flex-wrap: wrap;
}
.mb-cats { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; padding-bottom: 2px; }
.mb-cat-tab {
    padding: 8px 16px; border: none; background: transparent; cursor: pointer;
    font-size: 13px; font-weight: 600; color: #64748b; border-radius: 6px 6px 0 0;
    border-bottom: 3px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s;
    text-transform: uppercase; letter-spacing: .5px;
}
.mb-cat-tab:hover  { color: #007c77; }
.mb-cat-tab.active { color: #007c77; border-bottom-color: #007c77; }

/* ── Video grid ──────────────────────────────────────────────────── */
.mb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
    margin-top: 4px;
}

/* ── Video card ──────────────────────────────────────────────────── */
.mb-card {
    background: #fff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(13,27,42,.08);
    transition: transform .18s, box-shadow .18s;
    display: flex; flex-direction: column;
    cursor: pointer;
}
.mb-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(13,27,42,.14);
}

.mb-card-thumb-wrap {
    position: relative; width: 100%; padding-top: 56.25%;
    background: #0d1b2a; overflow: hidden;
}
.mb-card-thumb {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
    transition: transform .3s;
}
.mb-card:hover .mb-card-thumb { transform: scale(1.04); }

.mb-thumb-placeholder {
    position: absolute; inset: 0; background: linear-gradient(135deg, #1a3c5e 0%, #0d1b2a 100%);
    display: flex; align-items: center; justify-content: center;
}
.mb-thumb-placeholder::after { content: '🎬'; font-size: 40px; opacity: .5; }

.mb-play-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0); transition: background .2s;
    color: #fff; font-size: 40px; opacity: 0; transition: opacity .2s;
}
.mb-card:hover .mb-play-overlay { opacity: 1; background: rgba(0,0,0,.3); }

.mb-cat-badge {
    position: absolute; top: 10px; left: 10px;
    background: rgba(0,124,119,.9); color: #fff;
    padding: 3px 10px; border-radius: 100px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .6px; backdrop-filter: blur(4px);
}

.mb-card-body { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.mb-card-title { font-size: 15px; font-weight: 700; color: #0d1b2a; line-height: 1.35; }
.mb-card-desc  { font-size: 13px; color: #64748b; line-height: 1.5; }

.mb-card-tags  { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; }
.mb-tag {
    background: #f0f9ff; color: #0369a1; border: 1px solid #bae6fd;
    padding: 2px 8px; border-radius: 100px; font-size: 11px; font-weight: 600;
}

.mb-card-meta {
    display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}
.mb-meta-views { font-size: 12px; color: #94a3b8; margin-right: auto; }

.mb-like-btn {
    display: flex; align-items: center; gap: 4px; background: none; border: 1.5px solid #e2e8f0;
    padding: 4px 10px; border-radius: 100px; font-size: 13px; cursor: pointer;
    color: #64748b; transition: all .15s;
}
.mb-like-btn:hover:not([disabled]) { border-color: #f43f5e; color: #f43f5e; background: #fff1f2; }
.mb-like-btn.liked { border-color: #f43f5e; color: #f43f5e; background: #fff1f2; }
.mb-like-btn[disabled] { opacity: .5; cursor: default; }

.mb-delete-btn {
    background: none; border: none; cursor: pointer; font-size: 15px;
    color: #cbd5e1; transition: color .15s; padding: 4px;
}
.mb-delete-btn:hover { color: #dc2626; }

/* ── Empty states ────────────────────────────────────────────────── */
.mb-empty, .mb-no-results {
    grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: #94a3b8;
}
.mb-empty-icon { font-size: 48px; margin-bottom: 12px; }
.mb-empty p, .mb-no-results p { font-size: 16px; }

/* ── Modals ──────────────────────────────────────────────────────── */
.mb-modal-overlay {
    position: fixed; inset: 0; background: rgba(13,27,42,.6); backdrop-filter: blur(4px);
    z-index: 99999; display: flex; align-items: center; justify-content: center;
    padding: 20px; animation: mb-fade-in .15s ease;
}
.mb-modal-overlay-dark { background: rgba(0,0,0,.85); }
@keyframes mb-fade-in { from { opacity: 0; } to { opacity: 1; } }

.mb-modal {
    background: #fff; border-radius: 16px; width: 100%; max-width: 540px;
    max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(13,27,42,.3);
    animation: mb-slide-up .2s ease;
}
.mb-modal-wide { max-width: 720px; }
@keyframes mb-slide-up { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.mb-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 16px; border-bottom: 1px solid #f1f5f9;
    position: sticky; top: 0; background: #fff; z-index: 1;
}
.mb-modal-header h2 { font-size: 18px; font-weight: 700; color: #0d1b2a; }
.mb-modal-close {
    background: #f1f5f9; border: none; border-radius: 50%; width: 32px; height: 32px;
    font-size: 14px; cursor: pointer; color: #64748b; display: flex; align-items: center;
    justify-content: center; transition: background .15s;
}
.mb-modal-close:hover { background: #e2e8f0; color: #0d1b2a; }

.mb-modal-body  { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.mb-modal-footer {
    padding: 16px 24px; border-top: 1px solid #f1f5f9;
    display: flex; justify-content: flex-end; gap: 10px;
}
.mb-modal-msg { padding: 12px 24px; font-size: 14px; border-top: 1px solid #f1f5f9; }

/* Fields */
.mb-field { display: flex; flex-direction: column; gap: 5px; }
.mb-field label { font-size: 13px; font-weight: 600; color: #374151; }
.mb-req { color: #dc2626; }
.mb-field input, .mb-field select, .mb-field textarea {
    padding: 9px 12px; border: 1.5px solid #cbd5e1; border-radius: 8px;
    font-size: 14px; outline: none; transition: border-color .15s; font-family: inherit;
    color: #1a2b3c; background: #fff;
}
.mb-field input:focus, .mb-field select:focus, .mb-field textarea:focus {
    border-color: #007c77; box-shadow: 0 0 0 3px rgba(0,124,119,.12);
}
.mb-hint { font-size: 12px; color: #94a3b8; }

.mb-url-preview {
    display: flex; align-items: center; gap: 10px; padding: 10px;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; margin-top: 4px;
}
.mb-url-preview img { width: 80px; height: 45px; object-fit: cover; border-radius: 4px; }
#mb-url-provider    { font-size: 12px; font-weight: 600; color: #007c77; text-transform: uppercase; }

.mb-info-box {
    background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px;
    padding: 10px 14px; font-size: 13px; color: #1e40af;
}

/* Video lightbox */
.mb-modal-video { background: #0d1b2a; max-width: 860px; border-radius: 16px; position: relative; }
.mb-close-video {
    position: absolute; top: 12px; right: 12px; z-index: 2;
    background: rgba(255,255,255,.15); color: #fff;
}
.mb-close-video:hover { background: rgba(255,255,255,.3); color: #fff; }
.mb-video-embed { width: 100%; padding-top: 56.25%; position: relative; }
.mb-video-embed iframe {
    position: absolute; inset: 0; width: 100%; height: 100%;
    border-radius: 16px 16px 0 0;
}
.mb-video-info { padding: 20px 24px; }
.mb-video-info h3 { font-size: 18px; font-weight: 700; color: #fff; margin-bottom: 8px; }
.mb-video-info p  { font-size: 14px; color: #94a3b8; line-height: 1.6; margin-bottom: 12px; }
.mb-lbox-meta     { display: flex; flex-wrap: wrap; gap: 10px; }
.mb-lbox-meta span { font-size: 12px; color: #64748b; }

/* Category manager */
.mb-cat-add-row { display: flex; gap: 10px; margin-bottom: 16px; }
.mb-cat-add-row input { flex: 1; padding: 9px 12px; border: 1.5px solid #cbd5e1; border-radius: 8px; font-size: 14px; outline: none; }
.mb-cat-add-row input:focus { border-color: #007c77; }
.mb-cat-list  { display: flex; flex-direction: column; gap: 8px; }
.mb-cat-item  {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 8px; cursor: grab;
}
.mb-cat-item.dragging { opacity: .5; background: #e0f2f1; }
.mb-cat-drag  { color: #94a3b8; font-size: 16px; cursor: grab; }
.mb-cat-name  { flex: 1; font-weight: 600; font-size: 14px; }
.mb-cat-actions { display: flex; gap: 6px; }

/* Pending list */
.mb-pending-row {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px; background: #fffbeb; border: 1px solid #fef3c7;
    border-radius: 10px; margin-bottom: 10px;
}
.mb-pending-thumb img { width: 100px; height: 56px; object-fit: cover; border-radius: 6px; }
.mb-pending-thumb .mb-thumb-placeholder { width: 100px; height: 56px; border-radius: 6px; background: #1a3c5e; }
.mb-pending-info { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.mb-pending-info strong { font-size: 14px; color: #0d1b2a; }
.mb-pending-info span   { font-size: 13px; color: #64748b; }
.mb-pending-info small  { font-size: 11px; color: #94a3b8; }
.mb-pending-info a      { font-size: 11px; color: #007c77; word-break: break-all; }
.mb-pending-actions { display: flex; flex-direction: column; gap: 6px; }

/* Notifications / toasts */
.mb-toast {
    position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
    background: #0d1b2a; color: #fff; padding: 12px 24px; border-radius: 100px;
    font-size: 14px; font-weight: 600; z-index: 999999; box-shadow: 0 8px 24px rgba(0,0,0,.25);
    animation: mb-toast-in .25s ease; pointer-events: none;
}
.mb-toast.error { background: #dc2626; }
.mb-toast.success { background: #059669; }
@keyframes mb-toast-in { from { opacity:0; transform: translateX(-50%) translateY(10px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .mb-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
    .mb-modal { border-radius: 12px; }
    .mb-topbar { flex-direction: column; align-items: flex-start; }
    .mb-pending-row { flex-direction: column; }
}
@media (max-width: 420px) {
    .mb-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   Webbsida / typ-toggle — tillägg v1.1
================================================================ */

/* ── Typ-väljare i modal ─────────────────────────────────────── */
.mb-type-toggle {
    display: flex; gap: 12px; margin-bottom: 8px;
}
.mb-type-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; padding: 20px 16px; border: 2px solid #e2e8f0; border-radius: 14px;
    background: #f8fafc; cursor: pointer;
    transition: border-color .18s, background .18s, box-shadow .18s, transform .12s;
    font-family: inherit; text-align: center;
}
.mb-type-btn:hover:not(.active) {
    border-color: #94a3b8; background: #f1f5f9;
    transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.07);
}
.mb-type-icon {
    font-size: 32px; line-height: 1; display: block;
}
.mb-type-btn > span:not(.mb-type-icon) {
    font-size: 14px; font-weight: 700; color: #1a2b3c; display: block; line-height: 1.2;
}
.mb-type-btn small {
    font-size: 12px; color: #94a3b8; font-weight: 400; display: block;
}
.mb-type-btn.active {
    border-color: #007c77; background: #edf7f7;
    box-shadow: 0 0 0 4px rgba(0,124,119,.1);
    transform: translateY(-1px);
}
.mb-type-btn.active > span:not(.mb-type-icon) { color: #007c77; }
.mb-type-btn.active small                      { color: #5ba9a5; }

/* ── URL-preview med host ────────────────────────────────────── */
.mb-url-preview-info { display: flex; flex-direction: column; gap: 2px; }
.mb-url-host         { font-size: 12px; color: #374151; font-weight: 600; }
.mb-url-no-thumb     { background: #f0f9ff; border-color: #bae6fd; }
.mb-no-thumb-icon    { font-size: 28px; }
.mb-url-no-thumb small { font-size: 11px; color: #64748b; }

/* ── Webbsida-kort ───────────────────────────────────────────── */
/* Web placeholder — blå ton istället för marinblå */
.mb-thumb-web {
    background: linear-gradient(135deg, #0369a1 0%, #0c4a6e 100%) !important;
}
.mb-thumb-web::after { content: '🌐' !important; }

/* Webböverlägget (visar globen istället för play) */
.mb-web-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 40px; opacity: 0; background: rgba(0,0,0,0);
    transition: opacity .2s, background .2s;
}
.mb-card:hover .mb-web-overlay { opacity: 1; background: rgba(0,0,0,.25); }

/* "Öppnar ny flik"-badge längst ner till höger på thumbnails */
.mb-ext-badge {
    position: absolute; bottom: 8px; right: 8px;
    background: rgba(3,105,161,.85); color: #fff;
    padding: 3px 8px; border-radius: 100px; font-size: 10px; font-weight: 700;
    letter-spacing: .4px; backdrop-filter: blur(4px);
}

/* Domännamn under rubriken */
.mb-card-host {
    font-size: 11px; color: #0369a1; font-weight: 600;
    display: block; margin-top: -4px;
}

/* Tunn blå accent i vänsterkanten för webbsida-kort */
.mb-card-web {
    border-left: 3px solid #0369a1;
}
