:root {
    
    --primary-color: #ff6b6b;       
    --primary-hover: #fa5252;
    --secondary-color: #4ecdc4;     
    --accent-color: #ffe66d;        
    
    --bg-body: #f7f9fc;             
    --bg-card: #ffffff;
    
    --text-main: #2d3436;           
    --text-light: #636e72;          
    --text-white: #ffffff;
    
    --border-color: #dfe6e9;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --footer-height: 76px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: var(--footer-height);
}

/* --- Header & Nav --- */
header {
    background-color: var(--bg-card);
    box-shadow: var(--shadow-sm);
    padding: 0 2rem;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
}

header strong {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 800;
    letter-spacing: -0.5px;
}

header .site-brand-link {
    color: inherit;
    text-decoration: none;
}

header .site-brand-link:hover {
    text-decoration: none;
}

header nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

header nav a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

header nav a:hover, header nav a.active {
    color: var(--primary-color);
}

.user-badge {
    background-color: var(--secondary-color);
    color: var(--text-white);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* --- Badge notification --- */
.badge {
    background-color: var(--primary-color) !important;
    font-size: 0.7rem !important;
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* --- Main Layout --- */
main {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

h2 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    color: var(--text-main);
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button, .button {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

button:hover, .button:hover {
    background-color: var(--primary-hover);
    text-decoration: none;
}

input[type="text"], 
input[type="email"], 
input[type="password"], 
textarea, 
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    margin-bottom: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.1);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

/* --- Forms --- */
.recipe-form form {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    max-width: 800px;
    margin: 0 auto;
}

.search-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.search-bar input {
    margin-bottom: 0;
    flex: 1;
}

/* --- Cards & Grids --- */
.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

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

.card img {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    object-fit: contain;
    object-position: center;
    background-color: #f8f9fa; /* Fond léger pour combler les vides si nécessaire */
}

.card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.card-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.card p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex: 1;
}

.card-body > a {
    margin-top: auto;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.card-link {
    cursor: pointer;
    color: inherit;
    text-decoration: none;
}

.card-link:hover {
    text-decoration: none;
}

.card-link:hover .card-title {
    color: var(--primary-color);
}

.card-cta {
    margin-top: auto;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    color: var(--primary-color);
}

/* --- Auth Pages --- */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 70px); /* Hauteur moins header */
}

.auth-card {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
    text-align: center;
}

.auth-card h1 {
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-light);
    margin-bottom: 2rem;
}

.auth-actions {
    margin-top: 1rem;
}

/* --- Recipe Show --- */
.ingredients-list, .steps-list {
    margin: 1rem 0 2rem 1.5rem;
}
.ingredients-list li, .steps-list li {
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}

.nav-back-button {
    position: fixed;
    top: 84px;
    right: 16px;
    z-index: 2000;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    color: var(--text-white);
    box-shadow: var(--shadow-md);
    font-size: 1.15rem;
    line-height: 1;
}

.nav-back-button:hover {
    background-color: var(--primary-hover);
}

.nav-back-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.35), var(--shadow-md);
}

.site-footer {
    margin-top: auto;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
}

.site-footer__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-footer__brand {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.site-footer__brand strong {
    color: var(--primary-color);
    font-weight: 800;
    letter-spacing: -0.5px;
}

.site-footer__brand span {
    color: var(--text-light);
    font-size: 0.9rem;
}

.site-footer__nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.site-footer__nav a {
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
}

.site-footer__nav a:hover,
.site-footer__nav a.active {
    color: var(--primary-color);
    text-decoration: underline;
}

.legal-page {
    max-width: 900px;
}

.legal-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.legal-section h2 {
    margin-top: 0;
}

.legal-section h3 {
    margin: 1rem 0 0.5rem;
    font-size: 1.1rem;
}

.legal-list {
    margin: 0.75rem 0 0;
    padding-left: 1.25rem;
    color: var(--text-main);
}

.legal-toc {
    margin-top: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.legal-toc a {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

@media (max-width: 640px) {
    .nav-back-button {
        top: 76px;
        right: 12px;
        width: 40px;
        height: 40px;
        font-size: 1.05rem;
    }

    .site-footer__inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .site-footer__nav {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}
