@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;600;800&display=swap');

:root {
    /* Color Palette */
    --primary: #FF6B6B; /* Vibrant Coral */
    --primary-hover: #fa5252;
    --secondary: #4ECDC4; /* Teal */
    --dark: #1A1A2E;
    --darker: #16213E;
    --light: #F7F9FC;
    --surface: #FFFFFF;
    --surface-dark: #2A2A40;
    --text: #2D3436;
    --text-muted: #636E72;
    --text-light: #F7F9FC;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, #FF8E53 100%);
    --gradient-surface: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);

    /* Shadows */
    --shadow-sm: 0 4px 6px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.15);
    --shadow-glow: 0 0 20px rgba(255, 107, 107, 0.4);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-snappy: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

[data-theme="dark"] {
    --light: #1A1A2E;
    --surface: #16213E;
    --text: #F7F9FC;
    --text-muted: #A0AAB2;
    --shadow-sm: 0 4px 6px rgba(0,0,0,0.2);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--light);
    color: var(--text);
    line-height: 1.6;
    transition: background-color var(--transition-fast), color var(--transition-fast);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5em;
}

/* Typography Utilities */
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }

/* Layout Elements */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
}

header {
    background-color: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color var(--transition-fast);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-icon {
    font-size: 1.8rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    transition: color var(--transition-fast);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width var(--transition-snappy);
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-snappy);
    border: none;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-secondary:hover {
    background-color: var(--primary);
    color: white;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.btn-icon:hover {
    transform: scale(1.1) rotate(5deg);
    color: var(--primary);
}

/* Main Layout for Home Page */
.hero {
    padding: 4rem 0;
    text-align: center;
    background: var(--gradient-surface);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.recipe-dashboard {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    padding: 3rem 0;
    min-height: calc(100vh - 80px); /* Approx nav height */
    align-items: start;
}

/* Sidebar List */
.recipe-list-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 1rem;
    /* Custom Scrollbar */
}
.recipe-list-container::-webkit-scrollbar {
    width: 6px;
}
.recipe-list-container::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: var(--radius-full);
}

.recipe-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-snappy);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.recipe-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-primary);
    transform: scaleY(0);
    transition: transform var(--transition-snappy);
    transform-origin: bottom;
}

.recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.recipe-card:hover::before, .recipe-card.selected::before {
    transform: scaleY(1);
}

.recipe-card.selected {
    border-color: var(--primary);
    background-color: rgba(255, 107, 107, 0.05);
}

.recipe-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.recipe-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

.recipe-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Recipe Detail View */
.recipe-detail {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.5s ease forwards;
    display: none; /* Hidden initially */
}

.recipe-detail.active {
    display: block;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
    padding: 3rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 2px dashed rgba(0,0,0,0.1);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.detail-header {
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding-bottom: 2rem;
    margin-bottom: 2rem;
}

.detail-header h2 {
    font-size: 2.5rem;
}

.detail-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
    background: var(--light);
    padding: 1rem;
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.stat-value {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary);
}
.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.detail-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
}

.ingredients-list {
    list-style: none;
    background: var(--light);
    padding: 1.5rem;
    border-radius: var(--radius-md);
}

.ingredients-list li {
    padding: 0.75rem 0;
    border-bottom: 1px dashed rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
}

.ingredients-list li:last-child {
    border-bottom: none;
}

.ingredient-qty {
    font-weight: 600;
    color: var(--primary);
}

.instructions-list {
    list-style: none;
    counter-reset: step-counter;
}

.instructions-list li {
    position: relative;
    padding-left: 3rem;
    margin-bottom: 1.5rem;
}

.instructions-list li::before {
    counter-increment: step-counter;
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: -2px;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    box-shadow: var(--shadow-sm);
}

.nutrition-card {
    margin-top: 2rem;
    padding: 1.5rem;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--radius-md);
    background: linear-gradient(to right, rgba(255, 107, 107, 0.05), transparent);
}
.nutrition-card pre {
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.9rem;
    overflow-x: auto;
}

/* Form Styles */
.form-container {
    max-width: 800px;
    margin: 3rem auto;
    background: var(--surface);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    background-color: var(--light);
    color: var(--text);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.2);
    background-color: var(--surface);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: flex;
    gap: 1rem;
}
.form-row .form-group {
    flex: 1;
}

/* Dynamic Lists (Ingredients/Instructions) */
.dynamic-list {
    margin-bottom: 2rem;
    background: rgba(0,0,0,0.02);
    padding: 1.5rem;
    border-radius: var(--radius-md);
}

.dynamic-item {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.3s ease;
}

.dynamic-item .form-control {
    margin-bottom: 0;
}

.btn-remove {
    background: #ff4757;
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn-remove:hover {
    opacity: 0.8;
}

/* Basket Styling */
.basket-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-snappy);
}

.basket-overlay.active {
    opacity: 1;
    visibility: visible;
}

.basket-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--surface);
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: right var(--transition-snappy);
}

.basket-panel.active {
    right: 0;
}

.basket-header {
    padding: 2rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.basket-header h2 {
    margin-bottom: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
}

.basket-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.empty-basket {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-style: italic;
}

.basket-item {
    background: var(--light);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.3s ease;
}

.basket-item-info {
    flex: 1;
}

.basket-item-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.basket-item-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-remove-basket {
    background: transparent;
    color: var(--text-muted);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-remove-basket:hover {
    background: rgba(255, 71, 87, 0.1);
    color: #ff4757;
}

.basket-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(0,0,0,0.05);
    background: var(--surface);
}

/* Added-to-basket button state */
.btn-add-basket.btn-secondary {
    background-color: transparent !important;
    border: 2px solid var(--primary) !important;
    color: var(--primary) !important;
    box-shadow: none !important;
}

/* Animations */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive */
@media (max-width: 900px) {
    .recipe-dashboard {
        grid-template-columns: 1fr;
    }
    .recipe-list-container {
        height: auto;
        max-height: 400px;
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 1rem;
    }
    .recipe-card {
        min-width: 250px;
        flex-shrink: 0;
    }
    .detail-content {
        grid-template-columns: 1fr;
    }
}
