:root {
    --recipe-orange: #FF5722;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

/* Typography Improvements */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    letter-spacing: 0.2px;
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1.2rem;
    font-weight: 600;
    line-height: 1.3;
}

/* Card Styling with Shadow and Hover Effects */
.card {
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 1px solid var(--bs-border-color);
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--bs-dark);
    position: relative;
    z-index: 1;
}

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

/* Loading Spinner Animation */
#loadingSpinner {
    margin: 2rem 0;
    z-index: 2;
    position: relative;
}

.spinner-border {
    animation: spinner-grow 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Recipe Result Section */
#recipeResult {
    margin-top: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    position: relative;
}

#recipeResult.show {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced Button Styling */
.btn-recipe {
    background-color: var(--recipe-orange);
    color: white;
    padding: 0.85rem 1.75rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(255, 87, 34, 0.2);
    position: relative;
    z-index: 2;
}

.btn-recipe:hover {
    background-color: #f4511e;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 87, 34, 0.3);
}

.btn-recipe:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(255, 87, 34, 0.2);
}

/* Text Colors and Typography */
.text-recipe {
    color: var(--recipe-orange);
}

.recipe-title {
    color: var(--recipe-orange);
    font-weight: 700;
    font-size: 1.85rem;
    margin-bottom: 1.75rem;
    letter-spacing: -0.5px;
}

/* Enhanced Navbar Styling */
.navbar {
    background-color: var(--bs-dark);
    border-bottom: 3px solid var(--recipe-orange);
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1000;
}

.navbar-brand img {
    height: 40px;
    width: auto;
    object-fit: contain;
    margin-right: 1rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-brand:hover img {
    transform: scale(1.08);
}

/* List Item Styling with Hover Effects */
.list-unstyled li {
    padding: 0.75rem 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.list-unstyled li:hover {
    transform: translateX(4px);
    background-color: rgba(255, 87, 34, 0.05);
    padding-left: 0.5rem;
}

.list-unstyled li i {
    margin-right: 0.75rem;
    color: var(--recipe-orange);
    transition: transform 0.2s ease;
}

.list-unstyled li:hover i {
    transform: scale(1.1);
}

/* Enhanced Form Controls */
.form-control, .form-select {
    border-radius: 8px;
    padding: 0.85rem 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-width: 2px;
    background-color: var(--bs-dark);
    color: var(--bs-light);
    position: relative;
    z-index: 2;
}

.form-control:focus, .form-select:focus {
    border-color: var(--recipe-orange);
    box-shadow: 0 0 0 0.2rem rgba(255, 87, 34, 0.15);
}

/* Uber Eats Section */
.uber-eats-section {
    margin-top: 2.5rem;
    padding: 2rem 0;
    border-top: 1px solid var(--bs-border-color);
    position: relative;
    z-index: 1;
}

.uber-eats-button {
    background-color: var(--bs-dark);
    border: 2px solid var(--bs-border-color);
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
}

.uber-eats-button:hover {
    transform: translateY(-4px);
    box-shadow: var(--hover-shadow);
    border-color: var(--recipe-orange);
}

.uber-eats-logo {
    max-width: 150px;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.uber-eats-button span {
    color: var(--bs-light);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Improved Animations */
.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Error Message Styling */
#errorMessage {
    background-color: var(--bs-dark);
    border: 2px solid var(--recipe-orange);
    color: var(--bs-light);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    text-align: center;
    animation: fadeIn 0.3s ease-in-out;
    font-size: 1.1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

#errorMessage::before {
    content: "\F33A";
    font-family: "bootstrap-icons";
    display: block;
    font-size: 2.5rem;
    color: var(--recipe-orange);
    margin-bottom: 1.5rem;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* Example Recipe Cards */
.example-recipe-card {
    background-color: var(--bs-dark);
    border: 2px solid var(--bs-border-color);
    border-radius: 12px;
    padding: 1.5rem;
    height: 100%;
    position: relative;
    transition: all 0.3s ease;
}

.example-recipe-card:hover {
    transform: translateY(-4px);
    border-color: var(--recipe-orange);
    box-shadow: var(--hover-shadow);
}

.platform-badge {
    position: absolute;
    top: -12px;
    right: 1rem;
    background-color: var(--recipe-orange);
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: var(--card-shadow);
}

.example-recipe-card h5 {
    color: var(--recipe-orange);
    margin-bottom: 1rem;
    padding-right: 2rem;
}

.example-recipe-card p {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}


/* Enhanced Responsive Design */
@media (max-width: 768px) {
    .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .card {
        margin: 1rem 0;
        border-radius: 10px;
    }

    .recipe-title {
        font-size: 1.6rem;
        letter-spacing: -0.3px;
    }

    .navbar-brand img {
        height: 32px;
    }

    .btn-recipe {
        width: 100%;
        margin: 0.5rem 0;
        padding: 0.75rem 1.5rem;
    }

    .list-unstyled li {
        font-size: 0.95rem;
        padding: 0.6rem 0;
    }

    .uber-eats-button {
        padding: 0.75rem;
    }

    .uber-eats-logo {
        max-width: 120px;
    }

    .example-recipe-card {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }

    .platform-badge {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Feedback Section Styles */
.feedback-section {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease-in-out;
    color: var(--bs-light);
}

.feedback-section.show {
    opacity: 1;
    transform: translateY(0);
}

.feedback-section h4 {
    color: var(--bs-light);
    font-weight: 600;
}

.rating-container .btn-group {
    gap: 0.5rem;
}

.rating-container .btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    padding: 0;
    line-height: 45px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.rating-container .btn:hover {
    transform: scale(1.1);
}

.rating-container .btn.active {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(255, 87, 34, 0.2);
}

.feedback-text-container {
    max-width: 500px;
    margin: 0 auto;
}

.feedback-text-container textarea {
    background-color: var(--bs-dark);
    color: var(--bs-light);
    border-color: var(--bs-border-color);
}

.feedback-text-container textarea:focus {
    background-color: var(--bs-dark);
    color: var(--bs-light);
    border-color: var(--recipe-orange);
    box-shadow: 0 0 0 0.2rem rgba(255, 87, 34, 0.15);
}

.btn-outline-recipe {
    color: var(--recipe-orange);
    border-color: var(--recipe-orange);
    background-color: transparent;
}

.btn-outline-recipe:hover,
.btn-outline-recipe:focus {
    color: white;
    background-color: var(--recipe-orange);
    border-color: var(--recipe-orange);
}

#feedbackMessage {
    min-height: 60px;
    color: var(--bs-light);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .rating-container .btn {
        width: 40px;
        height: 40px;
        line-height: 40px;
    }
}

/* Recipe Card Animations */
.recipe-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
    position: relative;
    z-index: 1;
}

.recipe-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--hover-shadow);
}

.recipe-card:active {
    transform: scale(0.98);
}

/* Ingredient List Animations */
#ingredientsList li, #stepsList li {
    opacity: 0;
    transform: translateX(-10px);
    animation: slideInFade 0.5s ease forwards;
}

#ingredientsList li:nth-child(odd) {
    animation-delay: calc(var(--animation-order, 0) * 100ms);
}

#ingredientsList li:nth-child(even) {
    animation-delay: calc(var(--animation-order, 0) * 150ms);
}

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

/* Recipe Title Animation */
.recipe-title {
    opacity: 0;
    transform: translateY(-10px);
    animation: titleFadeIn 0.6s ease forwards;
}

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

/* Steps Animation */
#stepsList li {
    opacity: 0;
    transform: translateY(10px);
    animation: stepsFadeIn 0.5s ease forwards;
    animation-delay: calc(var(--animation-order, 0) * 200ms);
}

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

/* Button Interactions */
.btn-recipe {
    position: relative;
    overflow: hidden;
}

.btn-recipe::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease-out, height 0.3s ease-out;
    z-index: 1;
}

.btn-recipe:active::after {
    width: 200px;
    height: 200px;
    opacity: 0;
}

/* Processing Animation */
.processing {
    position: relative;
}

.processing::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--recipe-orange), transparent);
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Feedback Form Animations */
.rating-container button {
    transform-origin: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.rating-container button:hover {
    transform: scale(1.15);
}

.rating-container button:active {
    transform: scale(0.95);
}

.rating-container button.active {
    animation: pulse 0.3s ease-in-out;
}

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

/* Ingredient Substitution Styles */
.ingredient-item {
    position: relative;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    background-color: var(--bs-dark);
}

.ingredient-item:hover {
    transform: translateX(10px);
    background-color: rgba(255, 87, 34, 0.1);
}

.substitution-button {
    opacity: 0;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s ease;
    color: var(--recipe-orange);
}

.ingredient-item:hover .substitution-button {
    opacity: 1;
}

.substitutions-container {
    overflow: hidden;
}

.substitution-card {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    background-color: var(--bs-dark);
    border: 1px solid var(--bs-border-color);
}

.substitution-card.show {
    opacity: 1;
    transform: translateY(0);
}

.substitution-ratio {
    font-size: 0.9rem;
    color: var(--recipe-orange);
    font-weight: 600;
}

.substitution-notes {
    font-size: 0.9rem;
    color: var(--bs-secondary);
    margin-top: 0.5rem;
}

.substitution-category {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    background-color: var(--recipe-orange);
    color: white;
}

/* Animation for showing substitutions */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.substitution-animate {
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Loading State Styles */
.loading-container {
    text-align: center;
    padding: 2rem;
}

.loading-text {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--recipe-orange);
}

.jumble-text {
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--bs-secondary);
    min-height: 1.5em;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.jumble-text.show {
    opacity: 1;
    transform: translateY(0);
}

/* Pulse animation for the loading text */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.loading-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Character scramble animation */
@keyframes scramble {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-2px) rotate(5deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

.scramble-char {
    display: inline-block;
    animation: scramble 0.3s ease-in-out infinite;
    animation-delay: calc(var(--char-index) * 0.05s);
}