/* Estilos globales */
body, html {
    margin: 0;
    padding: 0;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #dddddd;
    color: #333;
}

/* Clase para el body */
.site-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
}

/* Header general (incluido en header.php) */
header {
    background-color: #547556;
    padding: 5px 0;
    border-bottom: 1px solid #e0e0e0;
}

.site-header {
    width: 100%;
    background-color: #547556; 
    border-bottom: 1px solid #e0e0e0;
    padding: 5px;
}

/* Contenedor del header: se centra y se limita al mismo ancho que tu contenido principal */
.header-container {
    max-width: 820px; /* Ajusta a tu ancho principal */
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    justify-content: space-between; /* Botón a la izquierda, logo a la derecha */
    align-items: center;
    padding: 0 15px;
}

/* Columna derecha (botón / sign in) */
.header-right {
    display: flex;
    align-items: center;
}

/* Columna central: logo centrado */
.header-center {
    text-align: center;
}

/***********************************************************
 * REVERTIR ESTILO DEL USER ICON (LETRA EN CÍRCULO ROJO)
 ***********************************************************/

/* Contenedor del ícono de usuario (posición relativa para el modal) */
.user-icon-wrapper {
    position: relative; 
    display: inline-block; 
}

/* Ícono circular con la inicial */
.user-icon {
    width: 40px;
    height: 40px;
    background-color: #ce3e3a; /* Rojo */
    border-radius: 50%;
    color: #fff;               /* Letra en blanco */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    /* Si quieres la inicial en mayúscula, usa text-transform o hazlo en PHP */
    /* text-transform: uppercase; */
}

/* Modal que se muestra debajo de la .user-icon */
.user-modal {
    position: absolute;
    top: 50px;  /* Ajusta según la altura del ícono */
    right: 0;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    z-index: 2100;
    width: 150px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: block;      /* El modal se muestra cuando NO tiene la clase .hidden */
    box-sizing: border-box;
    transition: background-color 0.2s ease-in-out;
}

/* Por defecto, lo ocultas con .hidden { display: none; } */
.hidden {
    display: none !important;
}


/*-------------- START EVERYTHING ABOUT FONTS -----------------*/
:root {
    --font-base: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --h2-font-size: 2rem;        
    --mood-font-size: 1.2rem;     
    --description-font-size: 1rem;
    --posted-font-size: 0.8rem;   
    --header-logo-font-size: 2rem;
    --action-btn-font-size: 0.9rem;
    --sidebar-font-size: 1rem;    
    --sidebar-title-font-size: 1.3rem;
}

/* General: todas las tipografías usan la fuente base */
body, p, h1, h2, input, textarea, button, span {
    font-family: var(--font-base);
}

/* Estilo para h2 */
h2 {
    font-size: var(--h2-font-size);
    font-weight: bold;
    color: #534e6d;
    margin-bottom: 1rem;
}
/* Para el texto que muestra el título del Post mood + thoughts */
.post-title {
    /* Hereda tipografía y color similares a description-text */
    font-family: var(--font-base); 
    font-size: 1rem; 
    color: #534e6d; 
    margin-bottom: 15px;

    /* Negritas y subrayado */
    font-weight: bold;
}

/* Para el texto que muestra el mood */
.mood-text {
    font-size: var(--mood-font-size);
    font-weight: bold;
    color: #534e6d;
}

/* Para el texto de la descripción */
.description-text {
    font-size: var(--description-font-size);
    color: #534e6d;
}

/* Para el texto que indica quién y cuándo se publicó */
.posted-text {
    font-size: var(--posted-font-size);
    color: #666;
}

/* Para botones de acción */
.action-btn {
    font-size: var(--action-btn-font-size);
}

/* Sidebar: tipografía */
.sidebar {
    font-size: var(--sidebar-font-size);
}

.sidebar-box h3 {
    font-size: var(--sidebar-title-font-size);
    margin-top: 0;
}
/*-------------- END EVERYTHING ABOUT FONTS -----------------*/

/* Ajusta el estilo del h1 del logo */
.site-logo {
    margin: 0;
    font-size: 2.5rem;
    color: #fff;
}

.logo-emoji {
    font-size: 1.0em;
}

.header-actions a {
    margin-left: 15px;
    text-decoration: none;
    color: #ff4d4f;
    font-weight: bold;
}

.header-actions select {
    margin-left: 15px;
    padding: 5px;
}

.hidden {
    display: none;
}

/* Dropdown Sign in / Sign up */
.auth-dropdown-wrapper {
    position: relative; 
    display: inline-block;
}

.dropdown-modal {
    position: absolute;
    top: 40px;
    right: 0;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    z-index: 2000;
}

.dropdown-modal a {
    display: block;
    width: 73%;
    padding: 10px 15px;
    text-decoration: none;
    color: #333;
    font-weight: bold;
    font-size: 0.8rem;
    transition: background-color 0.3s ease-in-out;
}

.dropdown-modal a:hover {
    background-color: #f0f0f0;
    border-radius: 8px;
}

.dropdown-separator {
    border: none;
    border-top: 1px solid #ddd;
    margin: 5px 0;
}

.hidden {
    display: none;
}

/* Estilo para el botón "Sign in / Sign up" */
#authButton {
    background-color: #fff;
    border: 1px solid #ddd;
    color: #333;
    padding: 12px 24px;
    border-radius: 60px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#authButton:hover {
    background-color: #f0f0f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Adapt the iframe for the login and register page */
#authFrame {
    width: 100%;
    height: 220px;
    border: none;
    border-radius: 4px;
}

/* Modal para Sign In / Sign Up */
.loginRegisterModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.loginRegisterModal.hidden {
    display: none !important;
}

.loginRegisterModal-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 500px;
    position: relative;
}

.loginRegisterModal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #333;
}

/* Estilos específicos para la página de login */
.login-page {
    margin: 10px;
    background-color: transparent;
    font-family: 'Arial', sans-serif;
    color: #333;
}

.login-page form input[type="text"],
.login-page form input[type="password"] {
    height: 25px;
    padding: 2px;
    box-sizing: border-box;
    border-radius: 4px;
}

/* Similar para register */
.register-page {
    margin: 5px;
    background-color: transparent;
    font-family: 'Arial', sans-serif;
    color: #333;
}

.register-page form input[type="text"],
.register-page form input[type="password"] {
    height: 25px;
    padding: 2px;
    box-sizing: border-box;
    border-radius: 4px;
}

/* Contenedor principal: sidebar a la izquierda y contenido principal centrado */
.main-container {
    display: flex;  /* Sidebar (izq) y contenido (der) */
    max-width: 820px;
    width: 100%;
    margin: 20px auto;
    flex: 1; 
}

/* Sidebar */
.sidebar {
    width: 300px; 
    background-color: transparent;
    padding: 20px;
    border: none;
    border-radius: 0px;
    margin: 0;
    min-height: 100vh;
    z-index: 1000;
}

/* Caja dentro del sidebar */
.sidebar-box {
    margin-bottom: 20px;
}
.sidebar-box h3 {
    margin-top: 0;
}
.rules-list {
    list-style: disc;
    padding-left: 20px;
    margin: 0;
}

/* Contenido principal */
.content {
    flex: 1;
    background-color: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 20px;
}
.content-container {
    min-width: 700px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.content-track {
    background-color: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 20px;
    margin-bottom: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-height: 200px;
}

/*********** START of EMOJIS and tracker ***************/
.mood-choices {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}
.mood-choices input[type="radio"] {
    display: none;
}
.mood-btn {
    cursor: pointer;
    font-size: 2rem;
    transition: transform 0.2s;
}
.mood-btn:hover {
    transform: scale(1.2);
}
.mood-choices input[type="radio"]:checked + .mood-btn {
    transform: scale(1.3);
}
.mood-title {
    width: 60%;
    height: 10px;
    resize: vertical;
    font-size: 0.8rem;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin-bottom: 15px;
}
.mood-description {
    width: 96%;
    height: 80px;
    resize: vertical;
    font-size: 1rem;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
}
.submit-btn {
    background-color: #ce3e3a;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.submit-btn:hover {
    background-color: #e43c3e;
}
.form-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    box-sizing: border-box;
}
.form-error.hidden {
    display: none;
}
/*********** END of EMOJIS and tracker ***************/

/* .content-box use on community section */
.content-box {
    background-color: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#language, select, textarea, input[type="text"] {
    font-size: 1rem;
}

section {
    margin-bottom: 30px;
}
section h2 {
    margin-top: 0;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

/* Estilo de posts */
.post {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/***** START moods + thoughts General container ***/
.moods-container {
    display: block;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-top: 20px;
}
/* Botones de Most Voted y Newest de los Post mood */
.moods-sort {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px; /* Espacio entre "Sort by:" y botones */
}

.moods-sort span {
    font-weight: bold;
    color: #333; 
}

.sort-btn {
    background-color: rgba(0, 128, 255, 0.2); /* azul claro semitransparente */
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15); /* sombra leve */
    transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.sort-btn:hover {
    background-color: rgba(0, 128, 255, 0.3); /* un poco más oscuro al hover */
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}


/* Cada item de mood */
.mood-item {
    display: flex;
    flex-direction: column; /* Fila 1: post-row, Fila 2: commentsPanel */
    position: relative;
    align-items: stretch; 
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease-in-out;
    width: 100%; /* MODIFICADO: forzar 100% del contenedor */
}

/* Fila 1: post-row => post a la izq, votación a la der */
.post-row {
    display: flex; /* post a la izq, votación a la der */
    width: 100%;
}

/* Quitar la línea del último item */
.mood-item:last-child {
    border-bottom: none;
}

/* Efecto hover */
.mood-item:hover {
    background-color: #f9f9f9;
}

/* Contenido principal del mood (izquierda) */
.mood-content {
    flex: 1;
    padding: 15px;
    position: relative;
}

.mood-footer {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-actions {
    display: flex;
}

/**** START User Delete Post AND show comments ****/
.delete-post {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    transition: color 0.2s;
    display: flex;
    align-items: center;
}
.delete-post i {
    font-size: 1rem;
}
.delete-post:hover {
    color: #CE3E3A;
}

/* Botón de "Show Comments" */
.show-comments {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    font-size: 0.9rem;
    transition: color 0.2s;
    display: flex;
    align-items: center;
}
.show-comments i {
    font-size: 1rem;
}
.show-comments:hover {
    color: #CE3E3A;
}

.comment-count {
    margin-left: 5px;
    font-weight: bold;
    color: #666;
}

.comment-text {
    width: 90%;
    height: 50px;
    resize: vertical;
    font-size: 1rem;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 5px;
}

.newCommentForm .submit-btn {
    /* padding: 10px 10px; */
    margin-bottom: 20px;
}

/* Contenedor de la sección de votos (derecha) */
.vote-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-left: 1px solid #ddd;
    width: 60px;
    padding: 15px;
    transition: background-color 0.2s ease-in-out;
    cursor: pointer;
}
.vote-section:hover {
    background-color: #f9fff8;
}
.vote-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background-color 0.2s ease-in-out;
    padding: 5px;
    border-radius: 6px;
    cursor: pointer;
}
.vote-container:hover {
    background-color: #f9fff8;
}
.vote-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #888;
    transition: color 0.5s ease, transform 0.5s ease;
    margin: 3px 0;
    cursor: pointer;
}
.vote-btn:hover {
    color: #CE3E3A;
}
.upvote:hover i {
    transform: translateY(-5px);
}
.downvote:hover i {
    transform: translateY(5px);
}
.vote-count {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
    font-size: 15px;
    margin: 3px 0;
    color:#534e6d;
}

/* Errores de voto */
.vote-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 5px 10px;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-top: 5px;
}
.vote-error-modal {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 0.9rem;
    position: fixed;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    box-sizing: border-box;
    width: 400px;
    text-align: center;
}

/***** START Comments on post section *************/
/* Panel de comentarios en la fila 2 (debajo de .post-row) */
.commentsPanel {
    display: block;
    padding: 15px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin: 0 15px 15px;
}

.hidden {
    display: none;
}

/* Votar comentario */
.comment-item {
    border-bottom: 1px solid #eee;
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: space-between;
}
.comment-vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}
.comment-upvote, .comment-downvote {
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1rem;
}

/* Modal flotante de error (igual que vote-error-modal) */
.vote-error-modal {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 0.9rem;
    z-index: 9999;
    width: 300px;
    text-align: center;
}
/***** END Comments on post section *************/

/* Footer */
footer {
    margin-top: auto;
    background-color: #547556;
    color: #fff;
    text-align: center;
    padding: 15px 0;
    border-top: 1px solid #e0e0e0;
    border-radius: 0px;
}

/* ********************* START PLACEHOLDERS *****************************/
::-webkit-input-placeholder {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.9rem;
    color: #999;
    font-weight: bold;
}
:-moz-placeholder {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.9rem;
    color: #999;
    font-weight: bold;
    opacity: 1;
}
::-moz-placeholder {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.9rem;
    color: #999;
    font-weight: bold;
    opacity: 1;
}
:-ms-input-placeholder {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.9rem;
    font-weight: bold;
    color: #999;
}
::placeholder {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.9rem;
    font-weight: bold;
    color: #999;
}
/* ********************* END PLACEHOLDERS *****************************/

/* Media query para pantallas pequeñas */
@media (max-width: 820px) {
    .header-container {
        width: 95%;
        margin: 0;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0 15px;
    }
    .main-container {
        flex-direction: column;
    }
    .content-container {
        min-width: auto;
        width: 100%;
    }
    html {
        font-size: 18px;
    }
    .mood-title, .mood-description {
        width: 96%;
        margin-right: 2%;
    }
    .site-logo {
        font-size: 1.8rem;
    }
    .site-header {
        padding: 8px 0;
        margin: 0;
        width: 100%;
    }
    .vote-section {
        width: 80px;
    }
    .vote-btn {
        font-size: 1.5rem;
        padding: 5px;
    }
    .comment-vote {
        width: 35px; /* Definir ancho específico para comentarios */
        padding: 5px; /* Ajustar padding */
    }
    .comment-upvote, .comment-downvote {
        font-size: 0.9rem; /* Reducir tamaño de íconos */
    }
    .delete-post i, .show-comments i {
        font-size: 1.2rem;
    }
}