/* ==========================================================================
   TABLA DE CONTENIDOS
   ==========================================================================
   1.  Variables Globales (Root y Dark Mode)
   2.  Estilos Base (Reset, Body, Tipografía)
   3.  Layout Principal (Sidebar, Main Content)
   4.  Componentes
       - Header
       - Profile Section
       - Social Links
       - Project Cards (Tweet Style)
       - Image Grid
       - Form
   5.  Chatbot
   6.  Footer
   7.  Utilidades (Botones, Scrollbar)
   8.  Media Queries (Responsive Design)
   ========================================================================== */

/* ==========================================================================
   1. Variables Globales (Root y Dark Mode)
   ========================================================================== */
:root {
    --bg-color: #ffffff;
    --text-color-primary: #0F1419;
    --text-color-secondary: #536471;
    --border-color: #EFF3F4;
    --accent-color: #0071C2;
    --accent-color-hover: #005FA3;
    --hover-color: rgba(0, 0, 0, 0.03);
    --header-bg-color: rgba(255, 255, 255, 0.85);
    --profile-img-border: #FFFFFF;
    --modal-bg-color: #FFFFFF;
    --message-bg-color: #EFF3F4;
    --scrollbar-thumb: #D6D9DB;
    --scrollbar-thumb-hover: #AAB8C2;
    --logo-color: #0F1419;
    --btn-text-color: #FFFFFF;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #000000;
        --text-color-primary: #E7E9EA;
        --text-color-secondary: #71767B;
        --border-color: #2F3336;
        --hover-color: #16181C;
        --header-bg-color: rgba(0, 0, 0, 0.65);
        --profile-img-border: #000000;
        --modal-bg-color: #000000;
        --message-bg-color: #16181C;
        --scrollbar-thumb: #2F3336;
        --scrollbar-thumb-hover: #71767B;
        --logo-color: #FFFFFF;
        --accent-color: #1D9BF0;
        --accent-color-hover: #1A8CD8;
    }

    .chatbot-header .btn-close {
        filter: invert(1) grayscale(100%) brightness(200%);
    }
}

/* ==========================================================================
   2. Estilos Base (Reset, Body, Tipografía)
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background-color: var(--bg-color);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow-x: hidden;
    padding-left: 275px;
}

/* ==========================================================================
   3. Layout Principal (Sidebar, Main Content)
   ========================================================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 275px;
    height: 100vh;
    background-color: var(--bg-color);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-logo {
    font-size: 30px;
    color: var(--logo-color);
    margin-bottom: 30px;
    padding-left: 12px;
}

.sidebar a {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    color: var(--text-color-primary);
    text-decoration: none;
    font-size: 20px;
    font-weight: 400;
    border-radius: 9999px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.sidebar a:hover {
    background-color: var(--hover-color);
}

.sidebar a i {
    font-size: 26px;
    margin-right: 20px;
    width: 26px;
}

.main-content {
    max-width: 998px;
    padding: 20px 6px;
    min-height: 100vh;
    background-color: var(--bg-color);
}

/* ==========================================================================
   4. Componentes
   ========================================================================== */

/* Header */
.header {
    position: sticky;
    top: 0;
    background-color: var(--header-bg-color);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 8px;
    z-index: 999;
    transition: transform 0.3s ease-in-out;
}

.header.hidden {
    transform: translateY(-100%);
}

.header .header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color-primary);
    margin: 0;
}

.section-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--accent-color);
}

#about p {
    font-size: 15px;
    line-height: 20px;
    color: var(--text-color-primary);
}

#about ul {
    list-style-type: '✓';
    padding-left: 20px;
    margin-top: 10px;
    color: var(--text-color-primary);
    /* This will color the checkmark */
}

#about li {
    padding-left: 10px;
    margin-bottom: 5px;
}

/* Tweet Card Style */
.tweet-card {
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
}

/* Profile Section */
.profile-header {
    background-image: url('./img/fondo-p.jpeg');
    background-size: cover;
    background-position: center;
    height: 160px;
    position: relative;
}

.profile-info {
    padding: 16px;
    position: relative;
}

.profile-actions {
    position: absolute;
    top: 16px;
    right: 16px;
}

.profile-img {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: none;
    margin-top: -80px;
    box-sizing: border-box;
    padding: 4px;
    object-fit: cover;
    object-position: center 20%;

}


.profile-name {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-color-primary);
    margin-top: 12px;
    margin-bottom: 0;
}

.verification-badge {
    color: var(--accent-color);
    font-size: 18px;
    /* Adjust size as needed */
    margin-left: 5px;
    vertical-align: middle;
    /* Align badge with text */
}

.profile-username {
    font-size: 15px;
    color: var(--text-color-secondary);
    margin-bottom: 12px;
}

.profile-bio {
    font-size: 15px;
    color: var(--text-color-primary);
    margin-bottom: 12px;
    line-height: 20px;
}

/* Social Links */
.social-links {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    /* Aumenta el área de clic */
    color: var(--text-color-secondary);
    font-size: 20px;
    transition: all 0.2s;
    border-radius: 50%;
}

.social-links a:hover {
    color: var(--accent-color);
}

/* Project Card (Tweet Style) */
.project-card {
    display: flex;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.project-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.project-card-content {
    width: 100%;
}

.project-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.project-card-header .name {
    font-weight: 700;
    color: var(--text-color-primary);
}

.project-card-header .username {
    color: var(--text-color-secondary);
    margin-left: 4px;
}

.project-card-body .project-card-text {
    color: var(--text-color-primary);
    font-size: 15px;
    line-height: 20px;
    margin-bottom: 12px;
}

.project-card-body img {
    width: 100%;
    height: auto;
    border-radius: 16px;
    border: 3px solid var(--border-color);
    margin-bottom: 12px;
    object-fit: cover;
}

/* Image Grid Styles */
.project-image-grid {
    display: grid;
    gap: 2px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.project-image-grid .grid-item {
    position: relative;
    overflow: hidden;
}

.project-image-grid .grid-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    margin: 0;
    border-radius: 0;
    border: none;
    transition: transform 0.2s;
}

.project-image-grid .grid-item img:hover {
    transform: scale(1.05);
}

.grid-1 {
    grid-template-columns: 1fr;
    aspect-ratio: 16 / 9;
}

.grid-2 {
    grid-template-columns: 1fr 1fr;
    aspect-ratio: 16 / 8;
}

.grid-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    aspect-ratio: 16 / 9;
}

.grid-3 .grid-item:first-child {
    grid-row: span 2;
}

.grid-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    aspect-ratio: 16 / 9;
}

.project-card-footer {
    display: flex;
    justify-content: space-between;
    max-width: 425px;
    margin-top: 12px;
}

.project-card-footer .action {
    display: flex;
    align-items: center;
    color: var(--text-color-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 8px;
    /* Aumenta el área de clic */
    margin: -8px;
    /* Compensa el padding para no afectar el layout */
    border-radius: 50%;
}

.project-card-footer .action i {
    font-size: 18px;
    margin-right: 8px;
}

.project-card-footer .action:hover {
    color: var(--accent-color);
    background-color: rgba(29, 155, 240, 0.1);
}

/* Like Animation */
@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-20px);
    }

    60% {
        transform: translateY(-10px);
    }
}

.like-action .bi-heart-fill {
    display: none;
}

.like-action .bi-heart {
    display: inline-block;
}

.like-action.liked .bi-heart {
    display: none;
}

.like-action.liked .bi-heart-fill {
    display: inline-block;
    color: #E0245E;
    /* Twitter's like color */
    animation: bounce 1s ease;
}

/* Form Style */
.form-control {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color-primary);
    border-radius: 4px;
    padding: 12px;
    font-size: 15px;
}

.form-control:focus {
    background-color: var(--bg-color);
    border-color: var(--accent-color);
    color: var(--text-color-primary);
    box-shadow: none;
}

.form-label {
    color: var(--text-color-primary);
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
}

/* ==========================================================================
   5. Chatbot
   ========================================================================== */
.chatbot-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(29, 156, 240, 0);
    transition: all 0.3s;
    z-index: 1000;
}

.chatbot-icon.hidden {
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none;
}

.chatbot-icon:hover {
    transform: scale(1.1);
    background-color: var(--accent-color-hover);
}

.chatbot-icon i {
    font-size: 30px;
    color: var(--btn-text-color);
}

.chatbot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(91, 112, 122, 0.4);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.chatbot-overlay.show {
    display: block;
    opacity: 1;
}

.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 370px;
    max-width: calc(100vw - 40px);
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    display: none;
    flex-direction: column;
    transition: opacity 0.3s, transform 0.3s;
    opacity: 0;
    transform: translateY(20px);
}

.chatbot-window.show {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.chatbot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.chatbot-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color-primary);
    margin: 0;
}

.chatbot-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    height: 400px;
}

.chatbox {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 16px;
}

.message-content {
    background-color: var(--message-bg-color);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    color: var(--text-color-primary);
    font-size: 15px;
}

/* ==========================================================================
   6. Footer
   ========================================================================== */
footer {
    background-color: var(--bg-color);
    border-top: 1px solid var(--border-color);
    padding: 20px;
    text-align: center;
    color: var(--text-color-secondary);
    font-size: 13px;
}

/* ==========================================================================
   7. Utilidades (Botones, Scrollbar)
   ========================================================================== */
.btn.btn-x {
    background-color: var(--accent-color);
    color: var(--btn-text-color);
    border: none;
    border-radius: 9999px;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
    transition: background-color 0.2s;
}

.btn.btn-x:hover {
    background-color: var(--accent-color-hover);
    color: var(--btn-text-color);
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

.btn-close-white {
    filter: var(--btn-close-filter);
}

/* Timeline Item for Experience Section */
.timeline-item {
    position: relative;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.timeline-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.timeline-item strong {
    font-weight: 700;
    color: var(--text-color-primary);
}

.timeline-item h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color-primary);
    margin-bottom: 8px;
}

.timeline-item time,
.timeline-item span[itemprop="jobLocation"] {
    font-size: 14px;
    color: var(--text-color-secondary);
}

.timeline-item em {
    font-size: 14px;
    color: var(--text-color-secondary);
}

.timeline-item ul {
    list-style-type: '✓';
    padding-left: 20px;
    margin-top: 10px;
}

.timeline-item li {
    padding-left: 10px;
    margin-bottom: 5px;
    color: var(--text-color-primary);
}

.highlight {
    color: var(--accent-color);
}

/* ==========================================================================
   8. Media Queries (Responsive Design)
   ========================================================================== */
@media (max-width: 1024px) {
    body {
        padding-left: 88px;
    }

    .sidebar {
        width: 88px;
    }

    .sidebar a span {
        display: none;
    }

    .sidebar a {
        justify-content: center;
        padding: 12px;
    }

    .sidebar a i {
        margin-right: 0;
    }
}

@media (max-width: 768px) {
    body {
        padding-left: 0;
    }

    .sidebar {
        display: none;
    }
}

/* Media query para mejorar la responsividad del chatbot en móviles */
@media (max-width: 500px) {
    .chatbot-window {
        /* Lo hacemos casi de ancho completo y lo centramos */
        left: 10px;
        right: 10px;
        width: auto;

        /* Lo bajamos un poco para que no esté tan alto */
        bottom: 80px;

        /* Evitamos que ocupe toda la altura en pantallas muy pequeñas */
        max-height: 80vh;
    }

    .chatbot-body {
        /* La altura se ajustará automáticamente al contenido y al max-height */
        height: auto;
        min-height: 300px;
        /* Aseguramos una altura mínima razonable */
    }
}

/* Notification Style */
.notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--accent-color);
    color: var(--btn-text-color);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    transform: translate(-50%, 20px);
}

.notification.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ==========================================================================
   9. Modal Vista Proyecto
   ========================================================================== */


.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(91, 112, 122, 0.4);
    z-index: 1040;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-overlay.show {
    display: block;
    opacity: 1;
}

.project-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 80%;
    max-width: 600px;
    max-height: 90vh;
    background-color: var(--bg-color);
    border-radius: 16px;
    z-index: 1050;
    display: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    display: flex;
    flex-direction: column;
}

.project-modal.show {
    display: flex;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.project-modal-header {
    padding: 8px;
    display: flex;
    align-items: center;
    min-height: 53px;
}

.project-modal-header .btn-close {
    margin-left: 8px;
    background-color: rgba(15, 20, 25, 0.75);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    opacity: 1;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23E7E9EA'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
}

.project-modal-content {
    overflow-y: auto;
    padding: 0 16px 16px 16px;
}

/* Forzamos que la tarjeta dentro del modal no tenga borde inferior */
.project-modal .project-card {
    border-bottom: none;
    padding: 0;
}