/**
 * Swipe/Discover Page Styles
 * TikTok-style vertical scrolling recipe feed
 */

/* CSS Variables */
:root {
    --swipe-bg: #000;
    --swipe-text: #fff;
    --swipe-accent: #C76B5C;
    --swipe-overlay: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.9) 0%,
        rgba(0, 0, 0, 0.6) 30%,
        rgba(0, 0, 0, 0.2) 60%,
        rgba(0, 0, 0, 0.1) 100%
    );
    --swipe-radius: 12px;
    --swipe-transition: 0.3s ease;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--swipe-bg);
    color: var(--swipe-text);
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Navigation Bar */
.swipe-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
}

.swipe-nav__back,
.swipe-nav__shuffle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--swipe-text);
    cursor: pointer;
    transition: var(--swipe-transition);
    text-decoration: none;
}

.swipe-nav__back:hover,
.swipe-nav__shuffle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.swipe-nav__title {
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Progress Indicator */
.swipe-progress {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.swipe-progress__current {
    color: var(--swipe-accent);
}

/* Keyboard Hint */
.keyboard-hint {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 30px;
    font-size: 14px;
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.5s ease;
}

.keyboard-hint kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
}

.keyboard-hint__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--swipe-text);
    font-size: 18px;
    cursor: pointer;
}

/* Main Container */
.swipe-container {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar but keep functionality */
.swipe-container::-webkit-scrollbar {
    display: none;
}

.swipe-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Recipe Card */
.recipe-card {
    position: relative;
    height: 100vh;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow: hidden;
}

/* Background Image */
.recipe-card__bg {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.recipe-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recipe-card__overlay {
    position: absolute;
    inset: 0;
    background: var(--swipe-overlay);
}

/* Card Content */
.recipe-card__content {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    padding-bottom: 40px;
}

/* Recipe Info */
.recipe-card__info {
    max-width: 85%;
}

.recipe-card__title {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 12px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

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

.recipe-card__time,
.recipe-card__rating,
.recipe-card__servings {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
}

.recipe-card__rating svg {
    color: #FFD700;
}

.recipe-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.recipe-card__tag {
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.recipe-card__desc {
    font-size: 15px;
    line-height: 1.5;
    opacity: 0.85;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* Action Buttons */
.recipe-card__actions {
    position: absolute;
    right: 16px;
    bottom: 120px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 3;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--swipe-text);
    cursor: pointer;
    transition: var(--swipe-transition);
    text-decoration: none;
}

.action-btn svg {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    transition: var(--swipe-transition);
}

.action-btn__label {
    font-size: 12px;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.action-btn:hover svg {
    transform: scale(1.15);
}

.action-btn--save.active {
    color: var(--swipe-accent);
}

.action-btn--save.active svg {
    animation: heartPop 0.3s ease;
}

/* Scroll Hint */
.scroll-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    opacity: 0.7;
    animation: bounce 2s infinite;
}

/* Loading Indicator */
.swipe-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    height: 100vh;
    scroll-snap-align: start;
    background: var(--swipe-bg);
}

.swipe-loading.active {
    display: flex;
}

.swipe-loading__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--swipe-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    animation: fadeInDown 0.3s ease;
}

.toast--success {
    background: rgba(46, 125, 50, 0.9);
}

.toast--error {
    background: rgba(198, 40, 40, 0.9);
}

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

@keyframes heartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

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

/* Responsive Adjustments */
@media (min-width: 768px) {
    .recipe-card__content {
        padding: 40px;
        padding-bottom: 60px;
    }

    .recipe-card__title {
        font-size: 36px;
    }

    .recipe-card__info {
        max-width: 60%;
    }

    .recipe-card__actions {
        right: 40px;
        bottom: 150px;
        gap: 24px;
    }

    .action-btn svg {
        width: 32px;
        height: 32px;
    }
}

@media (min-width: 1024px) {
    .recipe-card__content {
        padding: 60px;
        padding-bottom: 80px;
    }

    .recipe-card__title {
        font-size: 42px;
    }

    .recipe-card__info {
        max-width: 50%;
    }

    .recipe-card__desc {
        font-size: 16px;
    }

    .recipe-card__actions {
        right: 60px;
        bottom: 180px;
    }
}

/* Prevent text selection during swipe */
.recipe-card {
    user-select: none;
    -webkit-user-select: none;
}

/* Focus states for accessibility */
.action-btn:focus-visible,
.swipe-nav__back:focus-visible,
.swipe-nav__shuffle:focus-visible {
    outline: 2px solid var(--swipe-accent);
    outline-offset: 2px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .swipe-container {
        scroll-behavior: auto;
    }

    .scroll-hint,
    .action-btn svg,
    .swipe-loading__spinner {
        animation: none;
    }
}
