/* Restaurant Detail Page - Optimized Non-Critical CSS */

/* Particle Canvas for effects */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0;
    transition: opacity 1s ease;
}

#particle-canvas.active {
    opacity: 0.3;
}

/* Notifications */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    pointer-events: none;
}

.notification {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-heavy);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    border-left: 4px solid var(--success-color);
}

.notification-icon {
    font-size: 24px;
}

.notification-content h4 {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
}

.notification-content p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Combo Indicator */
.combo-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(135deg, #ff6b6b, #ff8787);
    color: white;
    padding: 20px 40px;
    border-radius: 20px;
    font-size: 24px;
    font-weight: 700;
    box-shadow: 0 10px 40px rgba(255, 107, 107, 0.4);
    z-index: 1100;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.combo-indicator.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Content Sections */
.content-section {
    margin-top: 32px;
}

.content-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.content-card:hover {
    box-shadow: var(--shadow-medium);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-light);
}

.card-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.card-content {
    padding: 24px;
}

/* AI Discovery Section */
.ai-discovery-section {
    margin: 32px 0;
}

.ai-discovery-container {
    text-align: center;
}

.discover-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-medium);
}

.discover-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.discover-button:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.ai-description-container {
    margin-top: 24px;
    text-align: left;
}

.ai-description-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.ai-description-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(236, 114, 5, 0.05) 0%, transparent 70%);
    animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.ai-description-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.ai-description-header i {
    font-size: 24px;
    color: var(--primary-color);
}

.ai-description-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-description-content {
    position: relative;
    z-index: 1;
}

.ai-description-text {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-secondary);
    position: relative;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

.ai-description-text.collapsed {
    max-height: 100px;
}

.ai-description-text.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, transparent, white);
}

.ai-description-text.expanded {
    max-height: none;
}

.expand-description-btn {
    margin-top: 12px;
    padding: 8px 16px;
    background: transparent;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.expand-description-btn:hover {
    background: var(--primary-color);
    color: white;
}

.expand-description-btn.expanded .expand-icon {
    transform: rotate(180deg);
}

.expand-icon {
    transition: transform 0.3s ease;
}

.typewriter-cursor {
    display: inline-block;
    width: 3px;
    height: 1.2em;
    background: var(--primary-color);
    margin-left: 2px;
    animation: typewriter-blink 1s infinite;
}

@keyframes typewriter-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* Gamification Section */
.gamification-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 20px;
    padding: 32px;
    margin: 32px 0;
    position: relative;
    overflow: hidden;
}

.gamification-header {
    text-align: center;
    margin-bottom: 24px;
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.gamification-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-item {
    background: white;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.stat-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.stat-item:hover::before {
    transform: translateX(0);
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 8px;
    display: block;
    animation: bounce 2s ease-in-out infinite;
}

.streak-fire {
    animation: fire-dance 1.5s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes fire-dance {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    50% { transform: scale(1.2) rotate(5deg); }
    75% { transform: scale(1.1) rotate(-5deg); }
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.level-item {
    grid-column: span 2;
}

.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    color: white;
    box-shadow: var(--shadow-medium);
}

.level-bronze { background: linear-gradient(135deg, #cd7f32, #b87333); }
.level-silver { background: linear-gradient(135deg, #c0c0c0, #a8a8a8); }
.level-gold { background: linear-gradient(135deg, #ffd700, #ffb700); }
.level-platinum { background: linear-gradient(135deg, #e5e4e2, #d3d3d3); }
.level-diamond { background: linear-gradient(135deg, #b9f2ff, #87ceeb); }

/* Progress Bar */
.progress-container {
    height: 20px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 24px;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-bronze { background: linear-gradient(90deg, #cd7f32, #b87333); }
.progress-silver { background: linear-gradient(90deg, #c0c0c0, #a8a8a8); }
.progress-gold { background: linear-gradient(90deg, #ffd700, #ffb700); }
.progress-platinum { background: linear-gradient(90deg, #e5e4e2, #d3d3d3); }
.progress-diamond { background: linear-gradient(90deg, #b9f2ff, #87ceeb); }

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* Achievement Badges */
.achievements-section {
    text-align: center;
}

.achievements-grid {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.achievement-item {
    width: 64px;
    height: 64px;
    background: white;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: all 0.3s ease;
    cursor: pointer;
    filter: grayscale(1);
    opacity: 0.5;
}

.achievement-item.earned {
    filter: grayscale(0);
    opacity: 1;
    border-color: var(--primary-color);
    animation: achievement-pop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.achievement-item:hover {
    transform: scale(1.1) rotate(5deg);
}

@keyframes achievement-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Menu Preview Card */
.menu-preview-card .menu-category {
    margin-bottom: 24px;
}

.menu-preview-card .menu-category:last-child {
    margin-bottom: 0;
}

.category-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.menu-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.menu-item:hover {
    transform: translateX(4px);
}

.item-name {
    flex: 1;
    color: var(--text-secondary);
    font-size: 15px;
}

.item-price {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 15px;
}

.view-full-menu-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.view-full-menu {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.2s ease;
}

.view-full-menu:hover {
    color: var(--primary-hover);
}

/* User Dishes Card */
.dishes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.dish-item {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 12px 16px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.dish-item:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

.dish-item:hover .dish-link {
    color: white;
}

.dish-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: block;
}

.dish-star {
    position: absolute;
    top: 8px;
    right: 8px;
    color: #ffc107;
    font-size: 12px;
}

/* AI Chat Questions Section */
.ai-chat-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.ai-questions-list {
    margin-bottom: 24px;
}

.ai-question-item {
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.ai-question-item:hover {
    box-shadow: var(--shadow-medium);
    border-color: var(--primary-color);
}

.ai-question-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.ai-question-icon {
    color: var(--primary-color);
    font-size: 16px;
}

.ai-question-text {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.ai-answer-preview {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    padding-left: 24px;
}

.ai-answer-icon {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 2px;
}

.ai-answer-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.ai-question-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-light);
}

.ai-question-helpful {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-ask-section {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 20px;
}

.ai-ask-title {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-ask-form {
    margin-bottom: 16px;
}

.ai-input-wrapper {
    display: flex;
    gap: 12px;
}

.ai-question-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
}

.ai-question-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(236, 114, 5, 0.1);
}

.ai-submit-button {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-submit-button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.ai-full-chat-link {
    text-align: center;
}

.ai-chat-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
}

.ai-chat-link:hover {
    color: var(--primary-hover);
}

/* Content Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

/* Reviews Card */
.review-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.review-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.review-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.review-source-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.review-author {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.review-rating {
    display: flex;
    gap: 2px;
}

.review-rating .fa-star {
    font-size: 12px;
}

.review-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.view-all-reviews {
    margin-top: 16px;
    text-align: center;
}

.view-all-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
}

.view-all-link:hover {
    color: var(--primary-hover);
}

/* Hours Card */
.hours-24 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    color: var(--success-color);
    font-weight: 600;
}

.hours-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hours-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.hours-item:last-child {
    border-bottom: none;
}

.day-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 15px;
}

.day-hours {
    color: var(--text-secondary);
    font-size: 15px;
}

/* Photos Card */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.photo-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 12px;
}

.photo-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.photo-item:hover .photo-image {
    transform: scale(1.1);
}

.photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    transition: opacity 0.3s ease;
}

.photo-item:hover .photo-overlay {
    opacity: 0.8;
}

/* Ratings Card */
.main-rating {
    text-align: center;
    padding: 24px 0;
    border-bottom: 1px solid var(--border-color);
}

.score-display {
    margin-bottom: 8px;
}

.score-number {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary-color);
}

.score-max {
    font-size: 24px;
    color: var(--text-secondary);
}

.score-meta {
    color: var(--text-secondary);
    font-size: 14px;
}

.external-ratings {
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rating-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rating-source {
    display: flex;
    align-items: center;
    gap: 8px;
}

.source-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.source-initial {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 12px;
}

.source-name {
    font-size: 14px;
    color: var(--text-secondary);
}

.rating-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* FAB Container */
.fab-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 90;
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-heavy);
}

.fab:hover {
    transform: scale(1.1);
}

.fab-share {
    background: #4267B2;
    color: white;
}

.fab-photo {
    background: var(--success-color);
    color: white;
}

/* Consiglia Button Component */
.consiglia-button {
    background: var(--primary-color);
    color: white;
}

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

/* Mobile Optimizations */
@media (max-width: 768px) {
    .gamification-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-item {
        padding: 16px;
    }
    
    .stat-icon {
        font-size: 24px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .level-item {
        grid-column: span 2;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dishes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .fab-container {
        bottom: 100px;
        right: 16px;
    }
    
    .fab {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    
    .ai-input-wrapper {
        flex-direction: column;
    }
    
    .ai-submit-button {
        width: 100%;
        justify-content: center;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-section {
    animation: fadeIn 0.6s ease-out;
}

/* Utility Classes */
.clickable {
    cursor: pointer;
}

.skeleton-text {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    height: 16px;
    border-radius: 4px;
    margin-bottom: 8px;
}

/* Print Styles */
@media print {
    .fab-container,
    .ai-chat-footer,
    .gamification-section,
    .ads_1,
    .notification-container {
        display: none !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .content-card {
        border-width: 2px;
    }
    
    .cta-button,
    .fab,
    .ai-submit-button {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}