:root {
    --cream: #F0E3D5;
    --cream-dark: #E0CFC0;
    --brown: #171411;
    --brown-light: #3A3530;
    --accent: #D4A574;
    --green: #5A8A5A;
    --red: #9A7070;
    --blue: #5A7A9A;
    --radius: 20px;
    --font-display: 'Fredoka', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background: var(--cream);
    color: var(--brown);
    min-height: 100dvh;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

/* Pages */
.page { display: none; height: calc(100dvh - 70px); overflow-y: auto; }
.page.active { display: flex; flex-direction: column; align-items: center; }

/* Bottom Nav */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 70px; background: white;
    display: flex; justify-content: space-around; align-items: center;
    border-top: 1px solid var(--cream-dark);
    z-index: 100;
}

.nav-btn {
    background: none; border: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center;
    gap: 2px; color: var(--brown-light); opacity: 0.5;
    font-family: var(--font-body); font-size: 11px;
    transition: all 0.2s;
}
.nav-btn.active { opacity: 1; color: var(--accent); }
.nav-btn svg { width: 22px; height: 22px; }

/* Card Stack */
.swipe-header {
    text-align: center; padding: 20px 20px 0;
    width: 100%; max-width: 420px;
}
.swipe-title {
    font-family: var(--font-display); font-size: 28px;
    font-weight: 700; color: var(--brown);
}
.swipe-subtitle {
    font-size: 14px; color: var(--brown-light); opacity: 0.6;
    margin-top: 4px;
}

.card-stack {
    position: relative; width: 100%; max-width: 400px;
    height: 520px; margin-top: 16px;
    padding: 0 10px;
}

.deal-card {
    position: absolute; width: calc(100% - 20px); height: 100%;
    left: 10px;
    background: white; border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(23, 20, 17, 0.12);
    overflow: hidden; cursor: grab;
    transition: transform 0.3s ease;
    will-change: transform;
}
.deal-card:active { cursor: grabbing; }
.deal-card.swiping { transition: none !important; }
.deal-card.gone { display: none !important; }
.deal-card:nth-child(1) { z-index: 3; }
.deal-card:nth-child(2) { z-index: 2; transform: scale(0.95) translateY(10px); pointer-events: none; }
.deal-card:nth-child(3) { z-index: 1; transform: scale(0.9) translateY(20px); pointer-events: none; }
.deal-card:nth-child(n+4) { display: none; }

.card-image {
    width: 100%; height: 300px; object-fit: cover;
    background: var(--cream-dark);
}

.card-body { padding: 16px; }

.card-platform {
    display: inline-block; padding: 3px 10px;
    border-radius: 12px; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.card-platform.kleinanzeigen { background: #e8f5e9; color: #2e7d32; }
.card-platform.vinted { background: #e3f2fd; color: #1565c0; }

.card-title {
    font-family: var(--font-display); font-size: 20px;
    font-weight: 600; margin-top: 8px;
    line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}

.card-meta {
    display: flex; gap: 12px; margin-top: 8px;
    font-size: 13px; color: var(--brown-light); opacity: 0.7;
}

.card-price-row {
    display: flex; justify-content: space-between;
    align-items: center; margin-top: 12px;
}

.card-price {
    font-family: var(--font-display); font-size: 28px;
    font-weight: 700; color: var(--brown);
}

.deal-score {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 12px;
    font-family: var(--font-display); font-size: 16px; font-weight: 600;
}
.deal-score.high { background: #e8f5e9; color: #2e7d32; }
.deal-score.medium { background: #fff3e0; color: #e65100; }
.deal-score.low { background: #fce4ec; color: #c62828; }

/* Swipe Indicators */
.swipe-indicator {
    position: absolute; top: 30px;
    font-family: var(--font-display); font-size: 42px;
    font-weight: 700; padding: 8px 20px;
    border-radius: 12px; border: 4px solid;
    opacity: 0; transition: opacity 0.15s;
    pointer-events: none; z-index: 10;
}
.swipe-indicator.left {
    left: 20px; color: var(--red); border-color: var(--red);
    transform: rotate(-15deg);
}
.swipe-indicator.right {
    right: 20px; color: var(--green); border-color: var(--green);
    transform: rotate(15deg);
}
.swipe-indicator.visible { opacity: 1; }

/* Action Buttons */
.swipe-actions {
    display: flex; gap: 20px; margin-top: 16px;
    justify-content: center; align-items: center;
}

.action-btn {
    border: none; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.15s, box-shadow 0.15s;
    font-size: 24px;
}
.action-btn:active { transform: scale(0.9); }

.action-btn.skip {
    width: 56px; height: 56px;
    background: white; color: var(--red);
    box-shadow: 0 4px 15px rgba(154, 112, 112, 0.3);
}
.action-btn.info {
    width: 44px; height: 44px;
    background: white; color: var(--blue);
    box-shadow: 0 4px 15px rgba(90, 122, 154, 0.3);
    font-size: 18px; font-weight: 700;
}
.action-btn.deal {
    width: 56px; height: 56px;
    background: white; color: var(--green);
    box-shadow: 0 4px 15px rgba(90, 138, 90, 0.3);
}
.action-btn.buy {
    width: 44px; height: 44px;
    background: var(--accent); color: white;
    box-shadow: 0 4px 15px rgba(212, 165, 116, 0.4);
    font-size: 14px; font-weight: 700;
}

/* Empty State */
.empty-state {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; height: 100%;
    text-align: center; padding: 40px;
}
.empty-state svg { width: 80px; height: 80px; opacity: 0.3; margin-bottom: 20px; }
.empty-state h3 {
    font-family: var(--font-display); font-size: 22px;
    color: var(--brown); margin-bottom: 8px;
}
.empty-state p { color: var(--brown-light); opacity: 0.6; font-size: 14px; }

/* Detail Overlay */
.overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(23, 20, 17, 0.5);
    backdrop-filter: blur(4px);
    display: flex; align-items: flex-end;
    transition: opacity 0.3s;
}
.overlay.hidden { display: none; }

.overlay-content {
    background: white; width: 100%;
    max-height: 85vh; border-radius: var(--radius) var(--radius) 0 0;
    overflow-y: auto; padding: 24px;
    animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.overlay-close {
    position: absolute; top: 16px; right: 16px;
    background: var(--cream); border: none; border-radius: 50%;
    width: 36px; height: 36px; font-size: 20px;
    cursor: pointer; display: flex; align-items: center;
    justify-content: center;
}

.detail-images {
    display: flex; gap: 8px; overflow-x: auto;
    margin-bottom: 16px; padding-bottom: 8px;
}
.detail-images img {
    height: 200px; border-radius: 12px; object-fit: cover;
    flex-shrink: 0;
}

.detail-title {
    font-family: var(--font-display); font-size: 24px;
    font-weight: 600; margin-bottom: 8px;
}

.detail-price {
    font-family: var(--font-display); font-size: 32px;
    font-weight: 700; color: var(--accent); margin-bottom: 16px;
}

.detail-section {
    margin-bottom: 16px;
}
.detail-section h4 {
    font-family: var(--font-display); font-size: 14px;
    color: var(--brown-light); opacity: 0.6;
    text-transform: uppercase; letter-spacing: 1px;
    margin-bottom: 6px;
}
.detail-section p {
    font-size: 15px; line-height: 1.6;
}

.detail-similar {
    display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px;
}
.similar-card {
    flex-shrink: 0; width: 140px; background: var(--cream);
    border-radius: 12px; padding: 10px; text-align: center;
}
.similar-card .price { font-family: var(--font-display); font-weight: 600; }
.similar-card .label { font-size: 12px; opacity: 0.6; }

.detail-actions {
    display: flex; gap: 12px; margin-top: 20px;
}
.detail-btn {
    flex: 1; padding: 14px; border: none; border-radius: 14px;
    font-family: var(--font-display); font-size: 16px;
    font-weight: 600; cursor: pointer;
}
.detail-btn.skip { background: var(--cream); color: var(--red); }
.detail-btn.deal { background: var(--green); color: white; }
.detail-btn.buy { background: var(--accent); color: white; }
.detail-btn.msg { background: var(--blue); color: white; }

/* Settings Page */
.settings-container {
    width: 100%; max-width: 500px; padding: 20px;
}
.settings-title {
    font-family: var(--font-display); font-size: 28px;
    font-weight: 700; margin-bottom: 20px;
}

.profile-card {
    background: white; border-radius: var(--radius);
    padding: 16px; margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.profile-card-header {
    display: flex; justify-content: space-between; align-items: center;
}
.profile-card-name {
    font-family: var(--font-display); font-size: 18px; font-weight: 600;
}
.profile-card-platform {
    font-size: 12px; padding: 2px 8px; border-radius: 8px;
}
.profile-card-stats {
    display: flex; gap: 16px; margin-top: 8px;
    font-size: 13px; color: var(--brown-light); opacity: 0.6;
}
.profile-card-actions {
    display: flex; gap: 8px; margin-top: 12px;
}
.profile-card-actions button {
    padding: 6px 14px; border: none; border-radius: 10px;
    font-size: 13px; cursor: pointer;
}

.add-profile-btn {
    width: 100%; padding: 16px; border: 2px dashed var(--cream-dark);
    border-radius: var(--radius); background: none;
    font-family: var(--font-display); font-size: 16px;
    color: var(--brown-light); opacity: 0.5; cursor: pointer;
    transition: opacity 0.2s;
}
.add-profile-btn:hover { opacity: 0.8; }

.bot-status-card {
    background: white; border-radius: var(--radius);
    padding: 16px; margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.bot-status-card h3 {
    font-family: var(--font-display); font-size: 18px;
    font-weight: 600; margin-bottom: 12px;
}
.status-indicator {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 14px; font-weight: 500;
}
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
}
.status-dot.idle { background: #aaa; }
.status-dot.running { background: var(--green); animation: pulse 1.5s infinite; }
.status-dot.error { background: var(--red); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Insights Page */
.insights-container {
    width: 100%; max-width: 500px; padding: 20px;
}
.insights-title {
    font-family: var(--font-display); font-size: 28px;
    font-weight: 700; margin-bottom: 20px;
}

.stat-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 12px; margin-bottom: 20px;
}
.stat-card {
    background: white; border-radius: 16px; padding: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.stat-value {
    font-family: var(--font-display); font-size: 32px;
    font-weight: 700; color: var(--accent);
}
.stat-label {
    font-size: 12px; color: var(--brown-light);
    opacity: 0.6; margin-top: 4px;
}

.insight-card {
    background: white; border-radius: var(--radius);
    padding: 16px; margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.insight-card h3 {
    font-family: var(--font-display); font-size: 16px;
    font-weight: 600; margin-bottom: 12px;
}

.price-row {
    display: flex; justify-content: space-between;
    padding: 8px 0; border-bottom: 1px solid var(--cream);
    font-size: 14px;
}
.price-row:last-child { border: none; }
.price-brand { font-weight: 500; }
.price-value { color: var(--accent); font-weight: 600; }

/* Form */
.form-overlay {
    position: fixed; inset: 0; z-index: 250;
    background: rgba(23, 20, 17, 0.5);
    display: flex; align-items: center; justify-content: center;
}
.form-overlay.hidden { display: none; }

.form-card {
    background: white; border-radius: var(--radius);
    padding: 24px; width: 90%; max-width: 400px;
    max-height: 80vh; overflow-y: auto;
}
.form-card h3 {
    font-family: var(--font-display); font-size: 20px;
    margin-bottom: 16px;
}
.form-group {
    margin-bottom: 14px;
}
.form-group label {
    display: block; font-size: 13px; font-weight: 500;
    margin-bottom: 4px; color: var(--brown-light);
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; border: 1px solid var(--cream-dark);
    border-radius: 12px; font-family: var(--font-body);
    font-size: 15px; background: var(--cream);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--accent);
}
.form-actions {
    display: flex; gap: 10px; margin-top: 16px;
}
.form-actions button {
    flex: 1; padding: 12px; border: none; border-radius: 12px;
    font-family: var(--font-display); font-size: 15px;
    font-weight: 600; cursor: pointer;
}
.btn-cancel { background: var(--cream); color: var(--brown); }
.btn-save { background: var(--accent); color: white; }
