/* Styles généraux pour tous les écrans */
body {
    font-family: 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5; /* Couleur de fond douce pour le thème clair */
    color: #1a1a1a; /* Couleur du texte pour le thème clair */
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.dark-theme {
    background-color: #0f172a; /* Couleur de fond profonde pour le thème sombre */
    color: #f8f9fa; /* Couleur du texte pour le thème sombre */
}

header {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #2c3e50;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.dark-theme header {
    background-color: rgba(30, 41, 59, 0.85);
    color: #ffffff;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    cursor: pointer;
}

.menu-toggle .bar {
    height: 4px;
    width: 100%;
    background-color: #2c3e50;
    border-radius: 10px;
    transition: background-color 0.3s ease;
}

body.dark-theme .menu-toggle .bar {
    background-color: #ffffff;
}

.menu {
    display: flex;
    gap: 1rem;
}

.menu.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

nav a {
    color: #1a1a1a;
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    background-color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.95em;
}

nav a:hover {
    background-color: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

body.dark-theme nav a {
    color: #f8f9fa;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme nav a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.user-profile-nav {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.6);
    padding: 4px 15px 4px 8px;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

body.dark-theme .user-profile-nav {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

body.dark-theme .user-avatar {
    border-color: #2c3e50;
}

.user-greeting {
    font-weight: 600;
    font-size: 0.95em;
    color: #2c3e50;
}

body.dark-theme .user-greeting {
    color: #f8f9fa;
}

.btn-logout {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    padding: 0.4rem 0.8rem !important;
    margin-left: 5px;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    transform: translateY(-1px) !important;
}

body.dark-theme .btn-logout {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #fca5a5 !important;
}

.recipe-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    padding: 2rem;
}

.recipe-card {
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    overflow: hidden;
    width: 240px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.07);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
}

.recipe-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 40px rgba(31, 38, 135, 0.12);
}

body.dark-theme .recipe-card {
    background-color: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body.dark-theme .recipe-card:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

.recipe-card a {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.recipe-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

body.dark-theme .recipe-card img {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.recipe-title {
    padding: 1rem 0.5rem;
    font-size: 1.1em;
    font-weight: 600;
    color: #2c3e50;
    background-color: transparent;
}

body.dark-theme .recipe-title {
    color: #f8f9fa;
}

.alphabet-filter {
    text-align: center;
    margin: 2rem 0;
}

.alphabet-filter a {
    color: #3498db;
    text-decoration: none;
    margin: 0 0.4rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.alphabet-filter a:hover {
    background-color: rgba(52, 152, 219, 0.1);
    text-decoration: none;
}

.theme-switch {
    text-align: center;
    margin: 1rem 0;
}

.theme-toggle-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    background-color: #e9ecef;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: background-color 0.3s;
}

body.dark-theme .theme-toggle-label {
    background-color: #333;
}
}

.theme-toggle-light,
.theme-toggle-dark {
    display: none;
    margin-left: 0.5rem;
}

#theme-toggle {
    display: none;
}

#theme-toggle:checked + .theme-toggle-label .theme-toggle-light {
    display: block;
}

#theme-toggle:not(:checked) + .theme-toggle-label .theme-toggle-dark {
    display: block;
}

/* Media Queries pour rendre le site responsive */
@media (max-width: 768px) {
    .menu {
        display: none;
    }
    .menu-toggle {
        display: flex;
    }
    .menu.active {
        display: flex;
    }
}

/* Styles additionnels pour assurer la visibilité du texte et un meilleur contraste */
h1, h2, h3, h4, h5, h6 {
    color: inherit;
}

p, a, span, li {
    color: inherit;
}

button {
    color: white;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

input, textarea {
    background-color: #fff;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.5rem;
}

body.dark-theme input,
body.dark-theme textarea {
    background-color: #333;
    color: #e0e0e0;
    border: 1px solid #444;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #4CAF50;
}

.recipe-detail {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
    max-width: 800px;
    margin: 2rem auto;
}

body.dark-theme .recipe-detail {
    background-color: #1f1f1f;
    border: 1px solid #444;
}

.recipe-detail img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.recipe-detail h2 {
    color: #4CAF50;
}

.recipe-detail ul, .recipe-detail ol {
    padding-left: 1.5rem;
}

.author-list {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
    max-width: 800px;
    margin: 2rem auto;
}

body.dark-theme .author-list {
    background-color: #1f1f1f;
    border: 1px solid #444;
}

.author-list ul {
    padding-left: 1.5rem;
}

.recipe-form {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
    max-width: 800px;
    margin: 2rem auto;
}

body.dark-theme .recipe-form {
    background-color: #1f1f1f;
    border: 1px solid #444;
}

.recipe-form label {
    display: block;
    margin-top: 1rem;
    color: #4CAF50;
}

.recipe-form textarea {
    width: 100%;
    height: 200px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.5rem;
    background-color: #fff;
    color: #333;
}

body.dark-theme .recipe-form textarea {
    background-color: #333;
    color: #e0e0e0;
    border: 1px solid #444;
}

.recipe-form input[type="file"] {
    margin-top: 1rem;
    color: inherit;
}

.recipe-form button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 1rem;
}

.recipe-form button:hover {
    background-color: #45a049;
}

/* Media Queries pour rendre le site responsive */
@media (max-width: 600px) {
    .recipe-grid {
        flex-direction: column;
        align-items: center;
    }
    .recipe-card {
        width: 90%;
        margin-bottom: 1rem;
    }
    .recipe-card img {
        height: 200px;
    }
}

@media (min-width: 601px) and (max-width: 1024px) {
    .recipe-grid {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-around;
    }
    .recipe-card {
        width: 45%;
        margin-bottom: 1rem;
    }
    .recipe-card img {
        height: 200px;
    }
}

@media (min-width: 1025px) {
    .recipe-grid {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    .recipe-card {
        width: 30%;
        margin-bottom: 1rem;
    }
    .recipe-card img {
        height: 200px;
    }
}

#ingredient-suggestions {
    border: 1px solid #ccc;
    background-color: #fff;
    position: absolute;
    width: calc(80% - 22px);
    max-height: 150px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

#ingredient-suggestions div {
    padding: 10px;
    cursor: pointer;
}

#ingredient-suggestions div:hover {
    background-color: #f0f0f0;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.edit-section {
    margin-top: 1rem;
    text-align: center;
}

.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background-color: #f0f0f0;
    z-index: 1000;
}

.progress-bar-inner {
    width: 100%;
    background-color: #4CAF50;
    height: 0;
}

#current-letter {
    position: fixed;
    top: 10px;
    left: 10px;
    background-color: #4CAF50;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    z-index: 1001;
}

/* CSS pour modify_recipe */
.modify_recipe .form-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.modify_recipe .form-row div {
    flex: 1;
}

.modify_recipe label {
    display: block;
    margin-bottom: 0.5rem;
    color: #4CAF50;
    font-weight: bold;
}

.modify_recipe input[type="text"] {
    width: 100%;
    padding: 0.5rem;
    box-sizing: border-box;
}

.tag {
    display: inline-block;
    background-color: #e0f7e9;
    color: #4CAF50;
    padding: 0.25rem 0.5rem;
    margin: 0.25rem;
    border-radius: 4px;
}

.remove-tag {
    cursor: pointer;
    margin-left: 0.5rem;
    color: #f44336;
}

#yaml_content {
    background-color: #2d2d2d;
    color: #f8f8f2;
    font-family: 'Courier New', Courier, monospace;
    border: none;
    padding: 1rem;
    border-radius: 4px;
    overflow: auto;
}

/* Login Page Styles */
.slideshow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.slide.active {
    opacity: 1;
}

.login-container-google {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
}

.google-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background-color: #4285F4;
    color: white;
    border-radius: 5px;
    text-decoration: none;
    font-size: 1.2em;
    gap: 10px;
}

.google-btn img {
    width: 30px;
    height: 30px;
}

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%; /* Position below the input */
    left: 0;
    right: 0;
    background-color: #fff;
    border: 1px solid #ddd;
    border-top: none;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: none; /* Hidden by default */
}

body.dark-theme .search-suggestions {
    background-color: #333;
    border: 1px solid #444;
    color: #e0e0e0;
}

/* Loader Styles */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    backdrop-filter: blur(5px);
    pointer-events: none;
}

body.dark-theme .loader-overlay {
    background: rgba(15, 23, 42, 0.8);
}

.loader-overlay.show {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.loader-spinner {
    border: 4px solid rgba(16, 185, 129, 0.2);
    border-top: 4px solid #10b981;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

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

.search-suggestion-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

body.dark-theme .search-suggestion-item {
    border-bottom: 1px solid #555;
}

.search-suggestion-item:hover {
    background-color: #f0f0f0;
}

body.dark-theme .search-suggestion-item:hover {
    background-color: #555;
}