/* =====================================================================
   style.css – Toppskaret Ønskeliste
   Dark glassmorphism — basert på handlelisten, tilpasset ønskeliste
   ===================================================================== */

:root {
    --bg-1: #0f0c29;
    --bg-2: #1a1a3e;
    --bg-3: #24243e;
    --accent: #8b5cf6;
    --accent-rgb: 139, 92, 246;
    --glass: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.12);
    --text: #f0f0f5;
    --text-muted: rgba(240, 240, 245, 0.6);
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --radius: 16px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    min-height: 100vh;
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: linear-gradient(135deg, var(--bg-1), var(--bg-2), var(--bg-3));
    background-size: 200% 200%;
    animation: bgShift 20s ease infinite;
    -webkit-font-smoothing: antialiased;
}

@keyframes bgShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* ----------------- Glass ----------------- */
.glass-card {
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ----------------- Buttons ----------------- */
button {
    font-family: inherit;
    cursor: pointer;
    border: none;
}

.btn-primary,
.btn-secondary,
.btn-danger,
.btn-nav {
    padding: 0.7rem 1.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), rgba(var(--accent-rgb), 0.7));
    color: #fff;
    box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.4);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(var(--accent-rgb), 0.55);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.35);
    color: #fff;
}

.btn-nav {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    text-decoration: none;
}

.btn-nav:hover {
    background: rgba(255, 255, 255, 0.16);
}

.btn-nav-danger {
    color: #fca5a5;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ----------------- Inputs ----------------- */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="date"],
textarea,
select {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 0.7rem 1rem;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
    width: 100%;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

input::placeholder {
    color: var(--text-muted);
}

label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.input-group {
    margin-bottom: 1.2rem;
}

.input-group small {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ----------------- Login ----------------- */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem 2rem;
    text-align: center;
}

.login-logo {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
}

.login-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 1.8rem;
    font-size: 0.95rem;
}

.error-msg {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.2rem;
    font-size: 0.85rem;
}

.success-msg {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #86efac;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.2rem;
    font-size: 0.85rem;
}

/* ----------------- Navbar ----------------- */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.5rem;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.nav-user-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), rgba(var(--accent-rgb), 0.5));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
}

/* ----------------- App layout ----------------- */
.app-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.2rem;
    padding: 1.2rem;
    max-width: 1100px;
    margin: 0 auto;
    align-items: start;
}

.sidebar {
    padding: 1.2rem;
    position: sticky;
    top: 80px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.sidebar-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.lists-overview {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.list-card {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid transparent;
    border-left: 3px solid var(--list-color, var(--accent));
    cursor: pointer;
    transition: all 0.2s;
}

.list-card:hover {
    background: rgba(0, 0, 0, 0.35);
}

.list-card.active {
    background: rgba(var(--accent-rgb), 0.15);
    border-color: rgba(var(--accent-rgb), 0.4);
}

.list-card-icon {
    font-size: 1.6rem;
}

.list-card-body {
    flex: 1;
    min-width: 0;
}

.list-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-card-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.35rem;
    margin-top: 0.15rem;
}

/* ----------------- List container ----------------- */
.list-container {
    padding: 1.5rem;
    min-height: 400px;
}

.list-header {
    margin-bottom: 1.5rem;
}

.list-title-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.list-icon-big {
    font-size: 2.2rem;
}

#list-title {
    font-size: 1.5rem;
    font-weight: 700;
    flex: 1;
}

.list-meta-row {
    margin-top: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.badge {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.list-description {
    margin-top: 0.8rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Add item form */
.add-item-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.add-item-form input {
    flex: 1;
    min-width: 150px;
}

/* ----------------- Items ----------------- */
.item-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.9rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.item:hover {
    border-color: var(--glass-border);
}

.item.removed {
    opacity: 0.45;
}

.item.removed .item-name {
    text-decoration: line-through;
}

.item.reserved-by-me {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.08);
}

.item-content {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    width: 100%;
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    min-width: 0;
}

.item-name {
    font-weight: 500;
    font-size: 0.95rem;
}

.item-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.15rem;
}

.tag {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.1rem 0.5rem;
    border-radius: 8px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.tag.price {
    color: #86efac;
    background: rgba(34, 197, 94, 0.1);
}

.tag.store {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.1);
}

.tag.priority-high {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
}

.tag.priority-medium {
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.1);
}

.tag.priority-low {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.08);
}

.tag.reserved {
    color: #86efac;
    background: rgba(34, 197, 94, 0.15);
}

.item-link {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.75rem;
}

.item-link:hover {
    text-decoration: underline;
}

/* Checkbox */
.item-checkbox {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 7px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
    background: transparent;
}

.item-checkbox:hover {
    border-color: var(--success);
}

.item-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
}

.item-checkbox.checked::after {
    content: '✓';
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

.item-checkbox.reserve:hover {
    border-color: var(--accent);
}

.item-checkbox.reserve.checked {
    background: var(--accent);
    border-color: var(--accent);
}

.item-actions {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.item:hover .item-actions {
    opacity: 1;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.muted {
    color: var(--text-muted);
}

.small {
    font-size: 0.8rem;
}

/* ----------------- Drawer (guest links) ----------------- */
.drawer {
    position: fixed;
    top: 0;
    right: -380px;
    width: 360px;
    height: 100vh;
    z-index: 100;
    transition: right 0.3s ease;
}

.drawer.open {
    right: 0;
}

.drawer-content {
    height: 100%;
    padding: 1.5rem;
    overflow-y: auto;
    border-radius: 0;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.guest-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.guest-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
}

.guest-name {
    flex: 1;
    font-weight: 500;
    font-size: 0.9rem;
}

.guest-link-box {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    margin-top: 0.4rem;
}

.guest-link-box code {
    flex: 1;
    font-size: 0.7rem;
    color: #a78bfa;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.guest-card {
    padding: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    margin-bottom: 0.6rem;
    border: 1px solid var(--glass-border);
}

.guest-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.78rem;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ----------------- Modals ----------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.edit-item-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.icon-picker {
    text-align: center;
    font-size: 1.2rem;
}

.color-picker {
    width: 100%;
    height: 42px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
}

.icon-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.5rem;
}

.icon-opt {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.icon-opt:hover {
    background: rgba(var(--accent-rgb), 0.2);
    border-color: var(--accent);
}

.modal-buttons {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.modal-buttons button {
    flex: 1;
    min-width: 100px;
}

/* ----------------- Toast ----------------- */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-sm);
    z-index: 300;
    font-weight: 500;
    font-size: 0.9rem;
    animation: toastIn 0.3s ease;
}

.toast.success {
    background: rgba(34, 197, 94, 0.9);
    color: #fff;
}

.toast.error {
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
}

.toast.info {
    background: rgba(var(--accent-rgb), 0.9);
    color: #fff;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* ----------------- Guest page ----------------- */
.guest-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 1.2rem;
}

.guest-header {
    text-align: center;
    padding: 2rem 1.5rem;
    margin-bottom: 1.5rem;
}

.guest-header .icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.guest-header h1 {
    font-size: 1.6rem;
    margin-bottom: 0.3rem;
}

.guest-header .subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.guest-header .description {
    margin-top: 0.8rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.guest-info-banner {
    padding: 1rem 1.2rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--accent);
    background: rgba(var(--accent-rgb), 0.08);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ----------------- Admin ----------------- */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.2rem;
}

.admin-section {
    padding: 1.5rem;
    margin-bottom: 1.2rem;
}

.admin-section h2 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 0.7rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9rem;
}

.admin-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.admin-form-row {
    display: flex;
    gap: 0.6rem;
    align-items: flex-end;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.admin-form-row .input-group {
    flex: 1;
    min-width: 140px;
    margin-bottom: 0;
}

.pill {
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
}

.pill-admin {
    background: rgba(var(--accent-rgb), 0.25);
    color: #ddd6fe;
}

.pill-member {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

/* ----------------- Responsive ----------------- */
@media (max-width: 800px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        top: 0;
    }

    .lists-overview {
        max-height: none;
        flex-direction: row;
        overflow-x: auto;
    }

    .list-card {
        min-width: 200px;
    }

    .navbar {
        padding: 0.7rem 1rem;
    }

    .nav-user-name {
        display: none;
    }

    .add-item-form input {
        flex: 1;
    }

    .drawer {
        width: 100%;
        right: -100%;
    }

    .drawer.open {
        right: 0;
    }
}