/* HeySalad Recipe Agent - Tinder-style swipe UI */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #ed4c4c;
    --primary-light: #fce8e8;
    --bg: #fce8e8;
    --card: #ffffff;
    --text: #1a1a2e;
    --text-light: #6b7280;
    --success: #10b981;
    --nope: #9ca3af;
    --like: #ed4c4c;
    --radius: 20px;
    --shadow: 0 10px 40px rgba(0,0,0,0.12);
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg);
}

/* Header - centered logo, bigger */
.app-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: var(--bg);
    position: relative;
}

.app-header .logo {
    height: 44px;
}

.saved-count {
    position: absolute;
    right: 20px;
    background: var(--primary);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* Main content */
.app-main {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Camera View */
.camera-view {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: var(--bg);
}

.camera-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text);
}

.camera-frame {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 3/4;
    border-radius: var(--radius);
    overflow: hidden;
    background: white;
    box-shadow: var(--shadow);
}

.camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}

.placeholder-icon {
    color: var(--text-light);
    margin-bottom: 12px;
}

.camera-actions {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.capture-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: white;
    border: 4px solid var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    box-shadow: var(--shadow);
}

.capture-btn:active {
    transform: scale(0.95);
}

.capture-inner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
}

.upload-btn {
    padding: 12px 24px;
    background: white;
    border: 2px solid var(--primary);
    border-radius: 30px;
    color: var(--primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.upload-btn:hover {
    transform: scale(1.02);
}

/* Loading View with Grandstander font */
.loading-view {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--bg);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid white;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
}

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

.loading-title {
    font-family: 'Grandstander', cursive;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.3;
}

.detected-ingredients {
    text-align: center;
}

.detected-ingredients p {
    color: var(--text-light);
    margin-bottom: 12px;
}

.ingredient-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.ingredient-tag {
    background: white;
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* Recipes View - no title */
.recipes-view {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 16px;
    padding-top: 0;
    background: var(--bg);
}

/* Card Stack */
.card-stack {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Recipe Card */
.recipe-card {
    position: absolute;
    width: 100%;
    max-width: 340px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s ease-out, opacity 0.2s;
}

.recipe-card.dragging {
    cursor: grabbing;
    transition: none;
}

.recipe-card.saved {
    transform: translateX(100vw) rotate(20deg) !important;
    opacity: 0;
}

.card-image {
    width: 100%;
    height: 220px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.card-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(transparent, rgba(0,0,0,0.4));
}

/* Card action buttons embedded in image */
.card-actions {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    gap: 10px;
    z-index: 5;
}

.card-action-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.card-action-btn.skip {
    background: rgba(255,255,255,0.9);
    color: var(--nope);
}

.card-action-btn.save {
    background: rgba(255,255,255,0.9);
    color: var(--like);
}

.card-action-btn.save.active {
    background: var(--like);
    color: white;
}

.card-action-btn:active {
    transform: scale(0.9);
}

.card-content {
    padding: 16px 20px 20px;
    background: white;
}

.recipe-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.3;
}

.match-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.match-icon {
    color: var(--primary);
    display: flex;
    align-items: center;
}

/* Icon styling */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    vertical-align: middle;
}

.icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.recipe-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text);
}

.stat .icon {
    color: var(--primary);
    position: relative;
    top: -1px;
}

.missing-ingredients {
    background: var(--bg);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 12px;
}

.missing-label {
    color: var(--text-light);
    margin-right: 6px;
}

.missing-items {
    color: var(--primary);
    font-weight: 500;
}

.tap-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
    padding-top: 8px;
    border-top: 1px solid #f3f4f6;
}

/* Swipe Indicators */
.swipe-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 2px;
    z-index: 100;
    border: 4px solid;
    background: rgba(255,255,255,0.9);
}

.swipe-indicator.nope {
    left: 20px;
    color: var(--nope);
    border-color: var(--nope);
    transform: translateY(-50%) rotate(-20deg);
}

.swipe-indicator.like {
    right: 20px;
    color: var(--like);
    border-color: var(--like);
    transform: translateY(-50%) rotate(20deg);
}

/* Recipe Detail */
.recipe-detail {
    height: 100%;
    overflow-y: auto;
    background: var(--bg);
}

.recipe-detail .back-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    background: rgba(255,255,255,0.95);
    border: none;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-image {
    width: 100%;
    height: 280px;
    background-size: cover;
    background-position: center;
}

.detail-content {
    padding: 20px;
    background: white;
    border-radius: 20px 20px 0 0;
    margin-top: -20px;
    position: relative;
    min-height: calc(100vh - 260px);
}

.detail-content h1 {
    font-size: 24px;
    margin-bottom: 16px;
}

.detail-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stat-pill {
    background: var(--bg);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-pill .icon {
    color: var(--primary);
    position: relative;
    top: -1px;
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--text);
}

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

.ingredients-list li {
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ingredients-list li.missing {
    color: var(--primary);
}

.ingredients-list .check-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.ingredients-list .check-icon svg {
    width: 100%;
    height: 100%;
}

.ingredients-list li.have .check-icon {
    color: var(--success);
}

.ingredients-list li.missing .check-icon {
    color: var(--primary);
}

.order-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 24px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.order-btn:hover {
    background: #d43d3d;
}

.instructions-list {
    padding-left: 20px;
}

.instructions-list li {
    padding: 10px 0;
    line-height: 1.6;
}

/* Empty View */
.empty-view {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    background: var(--bg);
}

.empty-icon {
    margin-bottom: 20px;
    color: var(--primary);
}

.empty-view h2 {
    font-size: 22px;
    margin-bottom: 10px;
}

.empty-view p {
    color: var(--text-light);
    margin-bottom: 30px;
}

.primary-btn {
    padding: 14px 28px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-btn:hover {
    background: #d43d3d;
}

/* Animations */
@keyframes cardEnter {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.recipe-card.top {
    animation: cardEnter 0.3s ease-out;
}

/* Share button and toast */
.header-actions {
    position: absolute;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.share-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    color: var(--primary);
}

.share-btn:active {
    transform: scale(0.95);
}

.share-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    z-index: 1000;
    animation: toastIn 0.3s ease-out;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
