/* Shared Styles and Animations for FreshBites */

* { box-sizing: border-box; }

html, body { 
    font-family: 'Plus Jakarta Sans', sans-serif; 
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

img { max-width: 100%; height: auto; }

@media (max-width: 640px) {
    html { font-size: 14px; }
}

/* Smooth Page Transitions */
.page-transition {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Skeleton Loading Animation */
.skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.dark .skeleton {
    background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
    background-size: 200% 100%;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #1e293b;
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 400px;
    animation: slideInRight 0.3s ease-out, fadeOut 0.3s ease-out 2.7s;
    border-left: 4px solid #13ec5b;
}

.toast.success { border-left-color: #13ec5b; }
.toast.error { border-left-color: #ef4444; }
.toast.warning { border-left-color: #f59e0b; }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Heart/Favorite Animation */
.heart-btn {
    transition: transform 0.2s ease;
}

.heart-btn:active {
    transform: scale(0.9);
}

.heart-btn.favorited {
    color: #ef4444;
}

.heart-btn.favorited .material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Button Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn-ripple:active::after {
    width: 200%;
    height: 200%;
}

/* Card Hover Effects */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

/* Bottom Navigation for Mobile */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 8px 0;
    z-index: 50;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.dark .bottom-nav {
    background: #1e293b;
    border-top-color: #334155;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 12px;
    color: #64748b;
    transition: color 0.2s;
    text-decoration: none;
}

.bottom-nav-item.active {
    color: #13ec5b;
}

.bottom-nav-item .material-symbols-outlined {
    font-size: 24px;
}

.bottom-nav-item span:last-child {
    font-size: 11px;
    font-weight: 500;
}

/* Pull to Refresh Indicator */
.pull-to-refresh {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.pull-to-refresh.visible {
    transform: translateX(-50%) translateY(70px);
}

.pull-to-refresh.spinning .material-symbols-outlined {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Filter Chips */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #13ec5b;
    color: #0f172a;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    animation: slideIn 0.2s ease-out;
}

.filter-chip button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
}

@keyframes slideIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Search Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-top: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
}

.dark .autocomplete-dropdown {
    background: #1e293b;
    border-color: #334155;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

.autocomplete-item:hover {
    background: #f1f5f9;
}

.dark .autocomplete-item:hover {
    background: #334155;
}

.autocomplete-item img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

/* Animated Counter */
.counter {
    font-variant-numeric: tabular-nums;
}

/* Glass Morphism Effect */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.dark .glass {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Feature Showcase Modal */
.feature-showcase {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.feature-showcase-content {
    background: white;
    border-radius: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 32px;
    animation: scaleIn 0.3s ease-out;
}

.dark .feature-showcase-content {
    background: #1e293b;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.feature-item {
    padding: 16px;
    background: #f1f5f9;
    border-radius: 12px;
    text-align: center;
}

.dark .feature-item {
    background: #334155;
}

.feature-item .material-symbols-outlined {
    font-size: 32px;
    color: #13ec5b;
    margin-bottom: 8px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-track {
    background: #1e293b;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

/* Hide scrollbar for mobile category pills */
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
