/* ===== RESET Y ESTILOS BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

body:not(.auth-page) {
    background-color: #FFEFE9;
    display: flex;
    flex-direction: column;
    padding-top: 100px;
}

main {
    flex: 1;
    padding: 20px;
}

section {
    padding: 30px;
}

.highlight {
    color: #e8544f;
}

/* ===== NAVEGACIÓN ===== */
nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: #F5F5F5;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100px;
    z-index: 10;
}

nav a {
    text-decoration: none;
    color: black;
    font-weight: bold;
    font-size: 1.2rem;
}

/* Menu hamburguesa */
.menu-toggle {
    display: none;
}

.menu-toggle span {
    width: 30px;
    height: 3px;
    background-color: #2C2C2C;
    margin: 4px 0;
    transition: 0.3s;
    border-radius: 3px;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* ===== BOTONES ===== */
.btn-primary {
    padding: 10px 20px;
    color: white;
    background-color: #E8534F;
    border-radius: 14px;
    border: 1px solid #E8534F;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: #e32620;
}

.btn-secondary {
    color: #E8534F;
    border: 1px solid #E8534F;
    padding: 10px 20px;
    border-radius: 14px;
    background-color: transparent;
    cursor: pointer;
    transition: border-color 0.3s, color 0.3s;
}

.btn-secondary:hover {
    border-color: #e32620;
    color: #e32620;
}

/* ===== FOOTER ===== */
footer {
    background-color: #2C2C2C;
    color: #fff;
    text-align: center;
    padding: 20px 0;
    font-size: 19px;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;              
    align-items: center;       
    justify-content: center;    
    gap: 20px;                  
}

footer img {
    width: 35px;               
    height: 35px;
    vertical-align: middle;    
    transition: transform 0.3s;
}

footer img:hover {
    transform: scale(1.2);     
}

/* ===== INDEX - SECCIÓN TÍTULO ===== */
.section-title {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    margin-bottom: 20px;
}

.contenido h1 {
    font-size: 48px;
    margin-bottom: 15px;
    line-height: 1.2;
}

.contenido p {
    line-height: 1.6;
}

.buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

/* ===== ÚLTIMAS RECETAS ===== */
.ultimas-recetas,
.mejores-recetas,
.viejas-recetas {
    margin-bottom: 60px;
}

.ultimas-recetas .contenido,
.mejores-recetas .contenido,
.viejas-recetas .contenido {
    margin-bottom: 40px;
}

.ultimas-recetas h1,
.mejores-recetas h1,
.viejas-recetas h1 {
    font-size: 36px;
    margin-bottom: 10px;
}

.ultimas-recetas p,
.mejores-recetas p,
.viejas-recetas p {
    color: #666;
    font-size: 1rem;
}

/* ===== CARDS ===== */
.cards,
.mejores-cards,
.viejas-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.card {
    background-color: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.card-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: #E8534F;
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
}

.card-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-rating {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    align-items: center;
}

.star {
    color: #FFC107;
    font-size: 1.1rem;
}

.rating-number {
    color: #999;
    font-size: 0.9rem;
    margin-left: 5px;
}

.card-title {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 5px;
    color: #2C2C2C;
}

.card-author {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.card-info {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: #666;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.info-icon {
    width: 20px;
    text-align: center;
}

.card-footer {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
}

.btn-receta {
    flex: 1;
    padding: 10px;
    background-color: #E8534F;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 0.95rem;
}

.btn-receta:hover {
    background-color: #e32620;
}

.btn-heart {
    padding: 8px 12px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    color: #E8534F;
    transition: color 0.3s;
}

.btn-heart:hover {
    color: #e32620;
}

.like-count {
    font-size: 0.9rem;
    color: #666;
    min-width: 30px;
    text-align: right;
}

/* ===== CALIFICACIÓN ===== */
.calificacion-usuario {
    margin-top: 20px;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.calificacion-usuario p {
    font-size: 0.85rem;
    font-weight: 500;
    margin: 5px 0 0 0;
    color: #666;
    text-align: center;
    width: 100%;
}

.estrellas-clickeables {
    display: flex;
    gap: 8px;
    font-size: 2rem;
    justify-content: flex-start;
}

.estrellas {
    color: #FFC107;
}

.estrella-clickeable {
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ddd;
    user-select: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.estrella-clickeable:hover {
    transform: scale(1.3);
    filter: drop-shadow(0 0 8px rgba(232, 83, 79, 0.5));
}

.estrella-clickeable:active {
    transform: scale(1.1);
}

.receta-calificacion {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

.receta-calificacion .estrellas {
    font-size: 1.5rem;
}

.receta-calificacion .calificacion-numero {
    font-size: 1rem;
    color: #666;
}

/* ===== PÁGINA DE AUTENTICACIÓN ===== */
body.auth-page {
    background-color: #2C2C2C;
    padding-top: 0;
}

.auth-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    min-height: 100vh;
    background-color: #FFF5F2;
    position: relative;
    overflow: hidden;
}

.form-section {
    padding: 80px 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 20;
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.65, 0, 0.35, 1);
    background-color: transparent;
}

.form-section h2 {
    font-size: 48px;
    margin-bottom: 15px;
    color: #2C2C2C;
    font-weight: bold;
}

.form-section .subtitle {
    color: #666;
    margin-bottom: 40px;
    font-size: 16px;
}

.input-group {
    margin-bottom: 20px;
    position: relative;
}

.input-group input {
    width: 100%;
    padding: 20px 20px 20px 60px;
    border: 1px solid #CDCDCD;
    background-color: #F0E8E5 !important;
    border-radius: 8px;
    font-size: 17px;
    outline: none;
    color: #666;
    box-sizing: border-box;
}

.input-group input::placeholder {
    color: #999;
}

.input-group::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 2;
    pointer-events: none;
}

.input-group.name::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Ccircle cx='12' cy='8' r='5'/%3E%3Cpath d='M20 21a8 8 0 1 0-16 0'/%3E%3C/svg%3E");
}

.input-group.email::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='m3 7 9 6 9-6'/%3E%3C/svg%3E");
}

.input-group.password::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M12 17a1 1 0 1 0 0-2 1 1 0 0 0 0 2z'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E");
}

.submit-btn {
    padding: 16px 50px;
    background-color: #E8534F;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 17px;
    cursor: pointer;
    margin-top: 15px;
    transition: background-color 0.3s;
}

.submit-btn:hover {
    background-color: #d64440;
}

#loginForm {
    grid-column: 1;
    grid-row: 1;
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.65, 0, 0.35, 1);
}

#registerForm {
    grid-column: 2;
    grid-row: 1;
    opacity: 0;
    pointer-events: none;
    transform: translateX(50px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.65, 0, 0.35, 1);
}

.auth-container.register-mode #loginForm {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50px);
}

.auth-container.register-mode #registerForm {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.welcome-section {
    background: linear-gradient(135deg, #EE7964 0%, #E8534F 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    clip-path: circle(40% at 82% 50%);
    transition: clip-path 0.8s cubic-bezier(0.76, 0, 0.24, 1);
    z-index: 999;
}

.auth-container.register-mode .welcome-section {
    clip-path: circle(70% at -5% 50%);
    z-index: 5;
}

.welcome-section.expanding {
    z-index: 100 !important;
}

.logo-container {
    position: absolute;
    top: 20%;
    left: 80%;
    transform: translate(-50%, 0);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: left 0.8s cubic-bezier(0.76, 0, 0.24, 1),
        top 0.8s cubic-bezier(0.76, 0, 0.24, 1),
        opacity 0.5s ease,
        transform 0.8s cubic-bezier(0.76, 0, 0.24, 1);
    z-index: 10;
}

.logo-container.fade-out {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.8);
}

.logo-container.fade-in {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

.auth-container.register-mode .logo-container {
    left: 20%;
}

.logo-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

.welcome-section h1 {
    font-size: 72px;
    margin-bottom: 15px;
    font-weight: bold;
    color: white;
    text-align: center;
    background-color: transparent;
}

.welcome-section p {
    font-size: 16px;
    margin-bottom: 35px;
    line-height: 1.6;
    color: white;
    text-align: center;
    font-weight: 300;
    background-color: transparent;
}

.switch-btn {
    padding: 16px 50px;
    background-color: transparent;
    color: white;
    border: 2px solid white;
    border-radius: 8px;
    font-size: 17px;
    cursor: pointer;
    transition: all 0.3s;
}

.switch-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.welcome-content {
    position: absolute;
    z-index: 10;
    top: 40%;
    transform: translate(-50%, 0);
    max-width: 450px;
    width: auto;
    transition: opacity 0.4s ease, left 0.8s cubic-bezier(0.76, 0, 0.24, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background-color: transparent;
    padding: 20px;
}

.login-content {
    left: 80%;
    display: flex;
}

.register-content {
    left: 20%;
    display: none;
}

.login-content.fade-out {
    opacity: 0;
}

.register-content.fade-out {
    opacity: 0;
}

.auth-container.register-mode .login-content {
    display: none;
}

.auth-container.register-mode .register-content {
    display: flex;
}

/* Elementos móviles ocultos en desktop */
.mobile-logo,
.mobile-switch-btn {
    display: none;
}

/* ===== ANIMACIONES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* ===== MEDIA QUERIES ===== */

/* Tablets (max-width: 968px) */
@media (max-width: 968px) {
    /* Navegación */
    nav {
        padding: 10px 20px;
        height: 80px;
    }

    nav a {
        font-size: 1rem;
    }

    #logo {
        width: 70px;
        height: 70px;
    }

    .btn-primary,
    .btn-secondary {
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    /* Footer */
    footer {
        padding: 15px 10px;
        font-size: 16px;
    }

    /* Index */
    .section-title {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .contenido h1 {
        font-size: 36px;
    }

    .slider-box {
        max-width: 100%;
    }

    /* Cards */
    .cards, .mejores-cards, .viejas-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    /* Autenticación */
    .auth-container,
    .auth-container.register-mode {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }

    .welcome-section,
    .auth-container.register-mode .welcome-section {
        clip-path: none !important;
        padding: 50px 30px;
        min-height: 50vh;
        grid-column: 1;
        grid-row: 1;
    }

    #loginForm,
    #registerForm {
        grid-column: 1;
        grid-row: 2;
        padding: 50px 30px;
    }

    .logo-container,
    .auth-container.register-mode .logo-container {
        position: static;
        margin-bottom: 30px;
        transform: none;
        right: auto;
        left: auto;
        top: auto;
    }

    .login-content,
    .register-content,
    .auth-container.register-mode .login-content,
    .auth-container.register-mode .register-content {
        position: static;
        margin-top: 0;
        transform: none;
        right: auto;
        left: auto;
    }

    .form-section h2 {
        font-size: 32px;
    }

    .welcome-section h1 {
        font-size: 40px;
    }
}

/* Móviles (max-width: 768px) */
@media (max-width: 768px) {
    /* Navegación */
    nav {
        height: 70px;
        padding: 0 15px;
        justify-content: space-between;
        align-items: center;
    }

    nav > a:first-child {
        order: 1;
    }

    #logo {
        width: 60px;
        height: 60px;
    }

    .menu-toggle {
        display: flex;
        flex-direction: column;
        cursor: pointer;
        padding: 10px;
        z-index: 15;
        order: 2;
    }

    nav > a:not(:first-child),
    #perfil-container {
        display: none !important;
    }

    nav.active {
        height: auto;
        flex-direction: column;
        align-items: stretch;
    }

    nav.active > a:first-child {
        align-self: flex-start;
    }

    nav.active .menu-toggle {
        position: absolute;
        top: 5px;
        right: 15px;
    }

    nav.active #perfil-container[style*="display: block"],
    nav.active #perfil-container[style*="display:block"] {
        display: block !important;
        width: 100%;
        text-align: center;
        padding: 20px 0 10px 0;
        order: 1;
        border-bottom: 2px solid #e0e0e0;
    }

    nav.active #perfil-container[style*="display: none"],
    nav.active #perfil-container[style*="display:none"] {
        display: none !important;
    }

    nav.active > a:not(:first-child):not([style*="display:none"]):not([style*="display: none"]) {
        display: block !important;
        order: 2;
        width: 100%;
        text-align: center;
        padding: 15px 0;
        font-size: 1.1rem;
        border-top: 1px solid #e0e0e0;
    }

    nav.active .btn-primary,
    nav.active .btn-secondary {
        width: 90%;
        margin: 10px auto;
        display: block;
        padding: 12px;
        font-size: 1rem;
    }

    #perfil-foto {
        width: 70px;
        height: 70px;
    }

    body:not(.auth-page) {
        padding-top: 70px;
    }

    /* Footer */
    footer {
        padding: 12px 10px;
        font-size: 14px;
        line-height: 1.4;
    }

    /* Index */
    .section-title {
        padding: 20px 10px;
    }

    .contenido {
        padding: 0 10px;
    }

    .contenido h1 {
        font-size: 28px;
    }

    .contenido p {
        font-size: 0.9rem;
    }

    .buttons {
        flex-direction: column;
        width: 100%;
    }

    .buttons button {
        width: 100%;
    }



    .ultimas-recetas h1 {
        font-size: 28px;
    }

    /* Cards */
    .cards,
    .mejores-cards,
    .viejas-cards {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 10px;
    }

    .card,
    .mejores-cards,
    .viejas-cards {
        max-width: 100%;
    }

    .card-image {
        height: 200px;
    }

    .card-content {
        padding: 15px;
    }

    .card-title {
        font-size: 1.2rem;
    }

    .card-info {
        flex-wrap: wrap;
        gap: 10px;
        font-size: 0.85rem;
    }

    .card-footer {
        flex-direction: row;
        gap: 10px;
    }

    .btn-receta {
        width: 100%;
    }

    .slider-box {
        height: 300px;
    }

    /* Autenticación */
    body.auth-page {
        background: linear-gradient(135deg, #EE7964 0%, #E8534F 100%);
    }

    .auth-container {
        grid-template-columns: 1fr;
        position: relative;
        min-height: 100vh;
        background-color: transparent;
        padding: 20px;
    }

    #loginForm,
    #registerForm {
        grid-column: 1;
        grid-row: 1;
        padding: 100px 30px 30px 30px;
        min-height: calc(100vh - 40px);
        width: 100%;
        position: relative;
        background-color: #FFF5F2;
        border-radius: 20px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    }

    #loginForm {
        opacity: 1;
        transform: translateX(0);
        pointer-events: auto;
        z-index: 2;
    }

    #registerForm {
        opacity: 0;
        transform: translateX(100%);
        pointer-events: none;
        position: absolute;
        top: 20px;
        left: 20px;
        right: 20px;
        width: calc(100% - 40px);
        z-index: 1;
    }

    .auth-container.register-mode #loginForm {
        opacity: 0;
        transform: translateX(-100%);
        pointer-events: none;
        z-index: 1;
    }

    .auth-container.register-mode #registerForm {
        opacity: 1;
        transform: translateX(0);
        pointer-events: auto;
        z-index: 2;
    }

    .form-section h2 {
        font-size: 32px;
        text-align: center;
        color: #2C2C2C;
        margin-top: 0;
    }

    .form-section .subtitle {
        font-size: 14px;
        text-align: center;
        color: #666;
        margin-bottom: 30px;
    }

    .mobile-logo {
        position: fixed;
        top: 30px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 100;
        display: block !important;
    }

    .mobile-logo img {
        width: 70px;
        height: 70px;
        border-radius: 50%;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .welcome-section {
        display: none !important;
    }

    .input-group {
        margin-bottom: 15px;
    }

    .input-group input {
        padding: 16px 16px 16px 50px;
        font-size: 15px;
    }

    .submit-btn {
        padding: 14px 40px;
        font-size: 15px;
        width: 100%;
        margin-top: 10px;
    }

    .mobile-switch-btn {
        display: block !important;
        text-align: center;
        margin-top: 20px;
        padding: 12px;
        background-color: transparent;
        color: #E8534F;
        border: 2px solid #E8534F;
        border-radius: 8px;
        font-size: 15px;
        font-weight: bold;
        cursor: pointer;
        transition: all 0.3s;
        width: 100%;
    }

    .mobile-switch-btn:hover {
        background-color: #E8534F;
        color: white;
    }
}

/* Móviles pequeños (max-width: 600px) */
@media (max-width: 600px) {
    /* Navegación */
    nav {
        height: 60px;
    }

    #logo {
        width: 50px;
        height: 50px;
    }

    #perfil-foto {
        width: 65px;
        height: 65px;
    }

    .menu-toggle span {
        width: 25px;
    }

    body:not(.auth-page) {
        padding-top: 60px;
    }

    /* Footer */
    footer {
        padding: 10px 8px;
        font-size: 12px;
        line-height: 1.3;
    }

    /* Index */
    .contenido h1 {
        font-size: 24px;
    }

    .ultimas-recetas h1 {
        font-size: 24px;
    }

    /* Cards */
    .card-image {
        height: 180px;
    }

    .card-title {
        font-size: 1.1rem;
    }

    .card-info {
        font-size: 0.8rem;
    }

    .slider-box {
        height: 250px;
    }

    /* Autenticación */
    .auth-container {
        padding: 15px;
    }

    #loginForm,
    #registerForm {
        padding: 90px 20px 20px 20px;
        min-height: calc(100vh - 30px);
        border-radius: 15px;
    }

    #registerForm {
        top: 15px;
        left: 15px;
        right: 15px;
        width: calc(100% - 30px);
    }

    .form-section h2 {
        font-size: 28px;
    }

    .mobile-logo {
        top: 20px;
    }

    .mobile-logo img {
        width: 60px;
        height: 60px;
    }

    .input-group input {
        padding: 14px 14px 14px 45px;
        font-size: 14px;
    }

    .input-group::before {
        left: 14px;
        width: 18px;
        height: 18px;
    }

    .submit-btn {
        padding: 12px 30px;
        font-size: 14px;
    }

    .mobile-switch-btn {
        font-size: 14px;
        padding: 10px;
    }
}