/* ===========================
   Portfolio CSS - Minimalist Clean Theme
   =========================== */

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

:root {
    /* Minimalist Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f0f1f3;
    --accent-primary: #2c3e50;
    --accent-secondary: #34495e;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-tertiary: #95a5a6;
    --border-color: #e0e2e5;
    --hover-color: #ecf0f1;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.app {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===========================
   Header/Navigation
   =========================== */

.header {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(224, 226, 229, 0.7);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--accent-primary);
    letter-spacing: -0.5px;
}

.nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.about-btn, .nav-link {
    color: var(--text-primary);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 500;
}

.about-btn:hover, .nav-link:hover {
    color: var(--accent-secondary);
    background: var(--bg-tertiary);
}

.nav-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===========================
   Main Content
   =========================== */

.main-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.active-view {
    display: flex !important;
}

.about-view.active-view {
    display: block !important;
}

/* ===========================
   Portfolio View
   =========================== */

.portfolio-view {
    display: none;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
    padding-bottom: 160px;
}

.project-display {
    flex: 1;
    display: flex;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.project-background {
    position: fixed;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(0.92) blur(6px);
    z-index: 0;
}

.project-content {
    position: relative;
    z-index: 2;
    display: grid;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    grid-template-columns: 500px minmax(0, 1.5fr);
    gap: 2rem;
    padding: 3rem;
    overflow: visible;
    min-height: 0;
}

.project-panel {
    grid-column: 1 / 2;
    /* --- CAMBIOS CLAVE --- */
    align-self: start;       /* <--- Evita que el panel se estire verticalmente */
    height: auto;            /* <--- Asegura que el alto dependa del contenido */
    /* --------------------- */
    
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(224, 226, 229, 0.8);
    border-radius: 22px;
    padding: 2rem;
    display: grid;
    gap: 1.5rem;
    box-shadow: 0 25px 80px rgba(44, 62, 80, 0.08);
    
    /* Scroll inteligente: solo aparece si el contenido supera el máximo */
    overflow-y: auto;
    max-height: calc(100vh - 220px); 
    
    scrollbar-width: thin;
    scrollbar-color: rgba(44, 62, 80, 0.2) rgba(0, 0, 0, 0.05);
}

.project-panel::-webkit-scrollbar {
    width: 6px;
}

.project-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 999px;
}

.project-panel::-webkit-scrollbar-thumb {
    background: rgba(44, 62, 80, 0.18);
    border-radius: 999px;
}

.project-video {
    grid-column: 2 / 3;
    width: min(840px, 100%);
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#videoPlayer {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    border-radius: 16px;
    border: 1px solid transparent;
    background: transparent;
    object-fit: contain;
}

.close-project-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-project-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--accent-primary);
    transform: rotate(90deg);
}

.close-project-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-project-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--accent-primary);
    transform: rotate(90deg);
}

/* Project Header */

.project-header {
    grid-column: 1 / -1;
}

.project-header h2 {
    font-size: 2.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--accent-primary);
    letter-spacing: -0.5px;
}

.project-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
}

/* Project Media */

.project-media {
    width: 100%;
    max-width: 900px;
    flex-shrink: 0;
}

.carousel-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.carousel {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-item {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.carousel-prev, .carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-prev:hover, .carousel-next:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.carousel-prev {
    left: 1rem;
}

.carousel-next {
    right: 1rem;
}

.carousel-indicators {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(44, 62, 80, 0.3);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator.active {
    background: var(--accent-primary);
    width: 30px;
    border-radius: 5px;
}

/* Project Video */

.project-right {
    grid-column: 2 / 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 1.5rem;
    min-height: 0;
    height: calc(100vh - 220px);
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0.5rem;
    box-sizing: border-box;

    scrollbar-width: thin;
    scrollbar-color: rgba(44, 62, 80, 0.2) rgba(0, 0, 0, 0.05);
}

.project-right::-webkit-scrollbar {
    width: 6px;
}

.project-right::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 999px;
}

.project-right::-webkit-scrollbar-thumb {
    background: rgba(44, 62, 80, 0.18);
    border-radius: 999px;
}

.project-video {
    width: min(900px, 100%);
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex: 0 0 auto;
}

.project-media {
    width: 100%;
    max-width: 900px;
    flex: 0 0 auto;
}

#videoPlayer {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    border-radius: 16px;
    border: 1px solid transparent;
    background: transparent;
    object-fit: contain;
}

/* Project Description */

.project-description {
    margin-bottom: 0;
}

.project-description h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--accent-primary);
    font-weight: 600;
}

.project-description p {
    color: var(--text-secondary);
    line-height: 1.7;
    text-align: justify;
    font-size: 0.95rem;
}

.project-contributions {
    margin-top: 0.5rem;
}

.project-contributions h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--accent-primary);
    font-weight: 600;
}

.project-contributions p {
    color: var(--text-secondary);
    line-height: 1.7;
    text-align: justify;
    font-size: 0.95rem;
}

/* Project Links */

.project-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    grid-column: 1 / -1;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.project-link:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
}

/* ===========================
   Projects Navigation (Bottom)
   =========================== */

.projects-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    background: rgba(248, 249, 250, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(224, 226, 229, 0.9);
    padding: 1rem 0;
    height: 120px;
    overflow: visible;
    z-index: 1000;
}

.projects-nav-container {
    display: flex;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    align-items: center;
    gap: 1rem;
    height: 100%;
    padding: 0 2rem;
}

.projects-nav-container.projects-nav-centered {
    justify-content: center;
}

.nav-scroll-prev, .nav-scroll-next {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-scroll-prev:hover, .nav-scroll-next:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.projects-nav-scroll {
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
}

.projects-nav-scroll::-webkit-scrollbar {
    height: 4px;
}

.projects-nav-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.projects-nav-scroll::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 2px;
}

.projects-nav-items {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
    width: max-content;
    min-width: 0;
    justify-content: flex-start;
}


.nav-project-item {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 6px;
    overflow: visible;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: all 0.2s ease;
    position: relative;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    scroll-snap-align: center;
}


.nav-project-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nav-project-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: all 0.2s ease;
}

.nav-project-item:hover::after,
.nav-project-item.active::after {
    opacity: 1;
}

.nav-project-item:hover {
    border-color: var(--accent-primary);
    transform: translateY(-3px);
}

.nav-project-item.active {
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(44, 62, 80, 0.15);
}

.nav-project-name {
    position: absolute;
    bottom: 5px;
    left: 5px;
    right: 5px;
    font-size: 0.7rem;
    color: var(--text-primary);
    opacity: 0;
    transition: opacity 0.2s ease;
    background: rgba(255, 255, 255, 0.85);
    padding: 2px 4px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.nav-project-item:hover .nav-project-name,
.nav-project-item.active .nav-project-name {
    opacity: 1;
}

/* ===========================
   About View / Modal
   =========================== */

.about-view {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 2000;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(6px);
    overflow-y: auto;
    animation: slideIn 0.3s ease;
    padding: 1.5rem 1rem;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1100px) {
    .project-content {
        display: flex;
        flex-direction: column;
        padding: 2rem;
    }

    .project-media,
    .project-video,
    .project-description,
    .project-links {
        grid-column: 1 / -1;
    }

    .project-video {
        order: 2;
    }
}

.about-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 2rem;
    position: relative;
}

.close-about-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.close-about-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.about-content {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
}

.about-content h2 {
    font-size: 2.2rem;
    margin-bottom: 2rem;
    color: var(--accent-primary);
    font-weight: 600;
}

.about-intro {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: flex-start;
}

.about-image {
    flex-shrink: 0;
}

.about-image img {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    object-fit: cover;
    background: var(--bg-secondary);
}

.about-intro p {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 0.95rem;
    flex: 1;
}

/* About Section */

.about-section {
    margin-bottom: 3rem;
}

.about-section h3 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--accent-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    font-weight: 600;
}

/* Highlights Grid */

.highlights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.highlight-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.highlight-item:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
    transform: translateY(-3px);
}

.highlight-icon {
    font-size: 1.8rem;
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

.highlight-item h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--accent-primary);
    font-weight: 600;
}

.highlight-item p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Experience List */

.experience-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.experience-item {
    background: var(--bg-secondary);
    border-left: 3px solid var(--accent-primary);
    border-radius: 4px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.experience-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(5px);
}

.experience-item h4 {
    color: var(--accent-primary);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.exp-company {
    color: var(--text-tertiary);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.exp-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Skills Grid */

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.skill-category {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.skill-category:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.skill-category h4 {
    color: var(--accent-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.skill-category ul {
    list-style: none;
}

.skill-category li {
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 0.4rem 0;
    padding-left: 1rem;
    position: relative;
}

.skill-category li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-weight: bold;
}

/* Contact Links */

.contact-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background: white;
    border: 1px solid var(--border-color);
    color: var(--accent-primary);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
}

.contact-link:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

/* ===========================
   Responsive Design
   =========================== */

@media (max-width: 1024px) {
    .project-content {
        padding: 2rem;
        max-width: 100%;
    }

    .project-header h2 {
        font-size: 2rem;
    }

    .about-intro {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .about-image img {
        width: 150px;
        height: 150px;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 0 1rem;
    }

    .logo h1 {
        font-size: 1.4rem;
    }

    .nav {
        gap: 1rem;
    }

    .project-content {
        padding: 1.5rem;
    }

    .project-header h2 {
        font-size: 1.5rem;
    }

    .projects-nav-container {
        padding: 0 1rem;
    }

    .nav-project-item {
        width: 80px;
        height: 80px;
        min-width: 80px;
    }

    .about-container {
        padding: 2rem 1rem;
    }

    .about-content {
        padding: 1.5rem;
    }

    .highlights-grid,
    .skills-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .carousel-item img {
        max-height: 60vh;
    }
}

@media (max-width: 480px) {
    .project-display {
        flex-direction: column;
    }

    .project-background {
        display: none;
    }

    .project-content {
        padding: 1rem;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }

    .project-header h2 {
        font-size: 1.2rem;
    }

    .projects-nav {
        height: 100px;
    }

    .nav-project-item {
        width: 70px;
        height: 70px;
        min-width: 70px;
    }

    .carousel-prev, .carousel-next {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }

    .contact-links {
        flex-direction: column;
    }

    .contact-link {
        width: 100%;
        justify-content: center;
    }
}

/* ===========================
   Scrollbar Styling
   =========================== */

.project-content::-webkit-scrollbar {
    width: 8px;
}

.project-content::-webkit-scrollbar-track {
    background: transparent;
}

.project-content::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 4px;
}

.project-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ===========================
   Loading Animation
   =========================== */

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

.carousel-item {
    animation: fadeIn 0.3s ease;
}
