:root {
    /* Light Theme (Default) */
    --primary: #6c63ff;
    --primary-hover: #5a52e0;
    --background: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.85);
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --radius: 16px;
    --nav-bg: #ffffff;
    --shadow: 0 10px 15px -3px rgba(108, 99, 255, 0.1);
}

[data-theme="dark"] {
    --primary: #a78bfa;
    --primary-hover: #6c63ff;
    --background: #0f0f13;
    --card-bg: rgba(26, 26, 36, 0.85);
    --border: #2a2a3a;
    --text: #f0f0f5;
    --text-muted: #9090aa;
    --nav-bg: #1a1a24;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--background);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 1rem 1rem 6rem 1rem;
    /* Added bottom padding for nav */
    transition: background-color 0.3s, color 0.3s;
}

/* Mobile Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--nav-bg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 0.8rem 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    gap: 4px;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--primary);
    font-weight: 600;
}

.nav-item svg {
    width: 24px;
    height: 24px;
}

/* Theme Toggle */
.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s;
}

.theme-toggle:hover {
    background: var(--border);
}

.app-container {
    width: 100%;
    max-width: 600px;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.logo span {
    color: var(--primary);
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

header p {
    color: var(--text-muted);
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid white;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

/* Upload UI */
.upload-zone {
    width: 100%;
    aspect-ratio: 16/10;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    position: relative;
    background: var(--card-bg);
}

.upload-zone:hover {
    border-color: var(--primary);
    background: var(--border);
}

.upload-zone.drag-over {
    border-color: var(--primary);
    background: var(--border);
    border-style: solid;
}

.upload-placeholder {
    text-align: center;
    color: var(--text-muted);
}

#previewGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    width: 100%;
    padding: 10px;
}

.preview-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.input-tip {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

select,
textarea,
input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
    background: var(--card-bg);
    color: var(--text);
}

.input-with-loader {
    position: relative;
    display: flex;
    align-items: center;
}

.small-loader {
    position: absolute;
    right: 12px;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

select:focus,
textarea:focus,
input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-primary {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Results */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.name-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.confidence-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    width: fit-content;
    text-transform: uppercase;
}

.confidence-high {
    background: #dcfce7;
    color: #166534;
}

.confidence-middel {
    background: #fef9c3;
    color: #854d0e;
}

.confidence-lav {
    background: #fee2e2;
    color: #991b1b;
}

.price-tag {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #14532d;
    padding: 1rem 2rem;
    border-radius: 20px;
    font-weight: 800;
    font-size: 2.5rem;
    /* Huge text */
    text-align: center;
    width: 100%;
    margin: 1rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    letter-spacing: -1px;
    font-family: 'Outfit', sans-serif;
}

[data-theme="dark"] .price-tag {
    background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
    color: #ecfdf5;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--card-bg) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
    opacity: 0.7;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    width: 100%;
}

.skeleton-title {
    height: 2rem;
    margin-bottom: 1rem;
    width: 60%;
}

.skeleton-price {
    height: 4rem;
    margin-bottom: 1.5rem;
    width: 100%;
    border-radius: 20px;
}

.skeleton-desc {
    height: 100px;
    width: 100%;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Time to sell badge */
.time-to-sell {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 1.25rem;
    background: var(--border);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    width: fit-content;
}

/* Platform tabs */
.platform-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 0.75rem;
}

.tab-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.description-area h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.description-text {
    background: var(--border);
    padding: 1.5rem;
    border-radius: 8px;
    line-height: 1.7;
    white-space: pre-wrap;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.result-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-facebook {
    background: #1877F2;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-facebook:hover {
    background: #166fe5;
}

.btn-dba {
    background: #e63329;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-dba:hover {
    background: #c0271e;
}

/* History */
.history-section {
    margin-top: 3rem;
}

.history-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.history-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.history-info strong {
    display: block;
    font-size: 0.9rem;
}

.history-info span {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 700;
}

.history-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.market-proof {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.market-proof h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sources-list {
    list-style: none;
}

.sources-list li {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding-left: 1.2rem;
    position: relative;
}

.sources-list li::before {
    content: "•";
    color: var(--primary);
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* Helpers */
.hidden {
    display: none;
}

.animate-up {
    animation: slideUp 0.4s ease-out;
}

.animate-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Loader */
#loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2rem;
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(-80px);
    background: #1a1a24;
    color: #f0f0f5;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 999;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.error {
    background: #991b1b;
}

/* Clear history button */
.btn-clear-history {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 1rem;
    transition: color 0.2s, border-color 0.2s;
}

.btn-clear-history:hover {
    color: #ef4444;
    border-color: #ef4444;
}

/* ─── Auth Modal ─────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.hidden {
    display: none;
}

.modal-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.modal-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--background);
    padding: 0.3rem;
    border-radius: 10px;
}

.modal-tab {
    flex: 1;
    padding: 0.6rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-tab.active {
    background: var(--primary);
    color: white;
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.auth-error.hidden {
    display: none;
}

.auth-footer {
    margin-top: 1.2rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-badge {
    background: rgba(108, 99, 255, 0.15);
    border: 1px solid rgba(108, 99, 255, 0.3);
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.user-badge.hidden {
    display: none;
}

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    color: #ef4444;
    border-color: #ef4444;
}

.btn-logout.hidden {
    display: none;
}

/* ─── Rate limit ─────────────────────────────────────────────────────────── */
.rate-limit-info {
    display: inline-block;
    background: rgba(108, 99, 255, 0.1);
    border: 1px solid rgba(108, 99, 255, 0.2);
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.rate-limit-info.hidden {
    display: none;
}

.rate-limit-empty {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.btn-upgrade-small {
    background: var(--primary);
    color: white;
    border: none;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    margin-left: 8px;
    font-weight: 600;
}

.btn-upgrade-small:hover {
    background: var(--primary-hover);
}

/* ─── Terms checkbox ─────────────────────────────────────────────────────── */
.terms-group {
    margin-bottom: 1rem;
}

.terms-group.hidden {
    display: none;
}

.terms-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
}

.terms-label input[type="checkbox"] {
    width: auto;
    accent-color: var(--primary);
    cursor: pointer;
}

.terms-label a {
    color: var(--primary);
}

/* ─── Slet konto ─────────────────────────────────────────────────────────── */
.btn-delete-account {
    background: none;
    border: none;
    color: rgba(239, 68, 68, 0.5);
    font-size: 0.75rem;
    cursor: pointer;
    margin-top: 0.5rem;
    padding: 0;
    transition: color 0.2s;
}

.btn-delete-account:hover {
    color: #ef4444;
}

/* ─── Auth success besked ─────────────────────────────────────────────────── */
.auth-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.auth-success.hidden {
    display: none;
}

/* ─── Link-knap (ingen baggrund) ─────────────────────────────────────────── */
.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity 0.2s;
}

.btn-link:hover {
    opacity: 0.75;
}

.btn-link.hidden {
    display: none;
}