/**
 * Modern Enhancements & Micro-interactions
 */

/* ========================================
   MICRO-ANIMATIONS
======================================== */

/* Fade in on load */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.twm-meal-card {
    animation: fadeInUp 0.6s ease-out forwards;
}

.twm-meal-card:nth-child(1) { animation-delay: 0.05s; }
.twm-meal-card:nth-child(2) { animation-delay: 0.1s; }
.twm-meal-card:nth-child(3) { animation-delay: 0.15s; }
.twm-meal-card:nth-child(4) { animation-delay: 0.2s; }
.twm-meal-card:nth-child(5) { animation-delay: 0.25s; }
.twm-meal-card:nth-child(6) { animation-delay: 0.3s; }

/* Button hover effects */
.twm-btn-primary,
.twm-btn-secondary {
    position: relative;
    overflow: hidden;
}

.twm-btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.twm-btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

/* Pulse animation for urgency */
@keyframes pulse-slow {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.twm-urgency-badge {
    animation: pulse-slow 2s infinite;
}

/* Smooth transitions */
* {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* ========================================
   CONVERSION OPTIMIZATIONS
======================================== */

/* Urgency Banner */
.twm-urgency-banner {
    background: linear-gradient(135deg, #FFB400 0%, #FF8A00 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(255, 180, 0, 0.3);
}

.twm-urgency-banner i {
    font-size: 20px;
}

/* Social Proof Box */
.twm-social-proof {
    background: #F0F9FF;
    border-left: 4px solid #0EA5E9;
    padding: 16px;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.twm-social-proof-icon {
    width: 48px;
    height: 48px;
    background: #0EA5E9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.twm-social-proof-content h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 700;
    color: #0C4A6E;
}

.twm-social-proof-content p {
    margin: 0;
    font-size: 13px;
    color: #075985;
}

/* Scarcity Indicator */
.twm-scarcity {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #FFF4E6;
    color: #B76E00;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

/* Improved Rating Display */
.twm-rating-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    background: #F9F9F9;
    border-radius: 12px;
    margin: 16px 0;
}

.twm-rating-number {
    font-size: 48px;
    font-weight: 700;
    color: #FFB400;
    line-height: 1;
    margin-bottom: 4px;
}

.twm-rating-stars {
    font-size: 20px;
    color: #FFB400;
    margin-bottom: 4px;
}

.twm-rating-text {
    font-size: 14px;
    color: #666;
}

/* ========================================
   DASHBOARD IMPROVEMENTS
======================================== */

/* Stats Cards with Icons */
.twm-stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.twm-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.twm-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.twm-stat-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    margin-bottom: 16px;
}

.twm-stat-value {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #222;
}

.twm-stat-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* ========================================
   LOADING STATES
======================================== */

.twm-loading {
    text-align: center;
    padding: 60px 20px;
}

.twm-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #FF385C;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   TOOLTIPS
======================================== */

[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: #222;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
}

[data-tooltip]:hover::after {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

/* ========================================
   SKELETON LOADERS
======================================== */

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

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.twm-skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.twm-skeleton-title {
    height: 24px;
    width: 70%;
    margin-bottom: 12px;
}

.twm-skeleton-image {
    aspect-ratio: 4 / 3;
    margin-bottom: 16px;
}

/* ========================================
   MOBILE ENHANCEMENTS
======================================== */

/* Sticky mobile CTA */
@media (max-width: 768px) {
    .twm-mobile-cta {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 16px 20px;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
        z-index: 999;
        display: flex;
        align-items: center;
        gap: 16px;
    }
    
    .twm-mobile-cta-info {
        flex: 1;
    }
    
    .twm-mobile-cta-price {
        font-size: 20px;
        font-weight: 700;
        color: #222;
    }
    
    .twm-mobile-cta-label {
        font-size: 12px;
        color: #666;
    }
    
    .twm-mobile-cta-btn {
        background: #FF385C;
        color: white;
        border: none;
        padding: 14px 24px;
        border-radius: 8px;
        font-weight: 600;
        white-space: nowrap;
    }
}

/* ========================================
   PREMIUM TOUCHES
======================================== */

/* Glassmorphism effect */
.twm-glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Gradient text */
.twm-gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Floating labels for forms */
.twm-floating-label {
    position: relative;
    margin-bottom: 24px;
}

.twm-floating-label input,
.twm-floating-label select,
.twm-floating-label textarea {
    width: 100%;
    padding: 16px 12px 8px;
    border: 2px solid #EEEEEE;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.twm-floating-label label {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: #999;
    pointer-events: none;
    transition: all 0.3s ease;
}

.twm-floating-label input:focus,
.twm-floating-label input:not(:placeholder-shown),
.twm-floating-label select:focus,
.twm-floating-label textarea:focus {
    border-color: #FF385C;
}

.twm-floating-label input:focus + label,
.twm-floating-label input:not(:placeholder-shown) + label,
.twm-floating-label select:focus + label,
.twm-floating-label textarea:focus + label {
    top: 8px;
    font-size: 12px;
    color: #FF385C;
    font-weight: 600;
}

/* Progress bar */
.twm-progress-bar {
    width: 100%;
    height: 4px;
    background: #EEEEEE;
    border-radius: 2px;
    overflow: hidden;
    margin: 16px 0;
}

.twm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00A699 0%, #00D4AA 100%);
    transition: width 0.5s ease;
}

/* Success checkmark animation */
@keyframes checkmark {
    0% {
        transform: scale(0) rotate(45deg);
    }
    50% {
        transform: scale(1.2) rotate(45deg);
    }
    100% {
        transform: scale(1) rotate(45deg);
    }
}

.twm-success-check {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid #00A699;
    border-radius: 50%;
    position: relative;
}

.twm-success-check::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 3px;
    width: 6px;
    height: 12px;
    border: solid #00A699;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    animation: checkmark 0.5s ease;
}

/* ========================================
   ENHANCED CARDS
======================================== */

/* Hoverable Cards */
.twm-card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.twm-card-hover:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
}

/* Glassmorphism Cards */
.twm-glass-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* ========================================
   CONVERSION ELEMENTS
======================================== */

/* Feature List with Icons */
.twm-features-list {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.twm-features-list li {
    padding: 12px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #F0F0F0;
}

.twm-features-list li:last-child {
    border-bottom: none;
}

.twm-features-list i {
    color: #00A699;
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* Countdown Timer */
.twm-countdown {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 16px 0;
}

.twm-countdown-item {
    text-align: center;
    padding: 12px;
    background: #F9F9F9;
    border-radius: 8px;
    min-width: 60px;
}

.twm-countdown-number {
    font-size: 24px;
    font-weight: 700;
    color: #FF385C;
    display: block;
}

.twm-countdown-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
}

/* Price Strike-through for Promo */
.twm-price-original {
    text-decoration: line-through;
    color: #999;
    font-size: 18px;
    margin-right: 8px;
}

.twm-price-discount {
    background: #FF385C;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 8px;
}

/* ========================================
   NOTIFICATION ENHANCEMENTS
======================================== */

/* Toast Notifications */
.twm-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    min-width: 300px;
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.twm-toast-success {
    border-left: 4px solid #00A699;
}

.twm-toast-error {
    border-left: 4px solid #FF385C;
}

.twm-toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.twm-toast-success .twm-toast-icon {
    background: #E8F5E9;
    color: #00A699;
}

.twm-toast-error .twm-toast-icon {
    background: #FFEBEE;
    color: #FF385C;
}

/* ========================================
   ACCESSIBILITY
======================================== */

/* Focus states */
*:focus {
    outline: 2px solid #FF385C;
    outline-offset: 2px;
}

button:focus,
a:focus {
    outline: 2px solid #FF385C;
    outline-offset: 2px;
}

/* Skip to content */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #FF385C;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}
