@import url('https://fonts.googleapis.com/css2?family=Tahoma&display=swap');

body {
    font-family: 'Tahoma', sans-serif;
    background: url('assets/bliss.jpg') no-repeat center center fixed;
    background-size: cover;
    overflow: hidden;
    margin: 0;
    user-select: none;
}

#desktop {
    width: 100vw;
    height: calc(100vh - 30px);
    position: relative;
    padding: 0px;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    margin: 15px;
    text-align: center;
    float: left; 
    cursor: pointer;
}

.desktop-icon img {
    width: 48px;
    height: 48px;
    margin-bottom: 5px;
}

.desktop-icon span {
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    font-size: 14px;
    padding: 2px;
}

.window {
    display: none;
    position: absolute !important;
    transition: transform 0.3s ease-in, opacity 0.25s ease-in;
    transform-origin: center;
}

.window.active {
    z-index: 100 !important;
}

.window.active .title-bar {
    background: linear-gradient(180deg, #0055e7, #0046d5 8%, #003cc2 15%, #003cc2 89%, #004ff1 95%, #0063ff);
}

.window.active .title-bar-text {
    color: white;
}

#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background: linear-gradient(180deg, #1e57e5, #2465f5 5%, #2364f3 12%, #2566f8 88%, #1e5aeb 94%, #184dd6);
    border-top: 0px solid #3c82f8;
    box-shadow: inset 0 1px 0 #5da2ff;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    padding: 0 4px 0 0;
    z-index: 1000;
}

#taskbar-clock {
    background-color: #2a73f6;
    border: 1px solid #1c52b1;
    border-top-color: #1849a0;
    box-shadow: inset 1px 1px 0 #67a1ff;
    padding: 2px 10px;
    color: white;
    font-size: 12px;
    height: 22px;
    line-height: 18px;
    align-self: center;
}



#start-button {
    display: flex;
    align-items: center;
    height: 30px; 
    padding: 0 20px 0 6px;
    margin: 0;
    border: 1px solid #1e872c;
    text-decoration: none;
    cursor: pointer;
    position: relative; 
    overflow: hidden; 
    border-radius: 4px 15px 15px 4px; 
    background: linear-gradient(to bottom, #59d168 0%, #3aae4a 49%, #289b37 50%, #52c561 100%);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.4);
    transition: all 0.1s ease-in-out;
}

#start-button::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    right: 1px;
    height: 45%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.8), rgba(255,255,255,0.2));
    border-radius: 3px 12px 12px 3px; 
}

#start-button img {
    height: 22px;
    margin-right: 8px;
    position: relative; 
    z-index: 2;
}

#start-button .start-text {
    color: white;
    font-family: 'Tahoma', sans-serif;
    font-size: 19px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
    position: relative;
    z-index: 2;
}


#start-button:hover {
    filter: brightness(1.1);
}

#start-button:active {
    filter: brightness(0.9);
    transform: translateY(1px);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}

#start-button:active::before {
    background: linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(255,255,255,0.1));
}


#start-menu {
    display: none;
    position: absolute;
    bottom: 30px;
    left: 0;
    width: 380px;
    border: 1px solid #00268c;
    background-color: #ffffff;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    z-index: 2000;
}

.start-menu-header {
    background: linear-gradient(to bottom, #1e57e5, #2465f5 5%, #2364f3 12%, #2566f8 88%, #1e5aeb 94%, #184dd6);
    padding: 6px;
    display: flex;
    align-items: center;
    color: white;
}

.user-icon {
    width: 40px;
    height: 40px;
    border: 2px solid white;
    margin-right: 10px;
}

.username {
    font-weight: bold;
    font-size: 16px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.start-menu-body { display: flex; }
.start-menu-column.left { width: 60%; background-color: #ffffff; }
.start-menu-column.right { width: 40%; background-color: #d6e8ff; border-left: 1px solid #99b9e5; }
.start-menu-column ul { list-style: none; padding: 5px 0; margin: 0; }
.menu-item { display: flex; align-items: center; padding: 6px 10px; cursor: pointer; font-size: 14px; }
.menu-item:hover { background-color: #316ac5; color: white; }
.menu-item img { width: 24px; height: 24px; margin-right: 10px; }
.menu-separator { border: 0; border-top: 1px solid #e0e0e0; margin: 5px; }

.start-menu-footer {
    background: linear-gradient(to bottom, #1e57e5, #2465f5 5%, #2364f3 12%, #2566f8 88%, #1e5aeb 94%, #184dd6);
    padding: 5px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    border-top: 1px solid #3c82f8;
}

.footer-button { display: flex; align-items: center; color: white; margin-left: 15px; cursor: pointer; }
.footer-button:hover { filter: brightness(1.2); }
.footer-button img { width: 20px; height: 20px; margin-right: 5px; }


.project-icons-container { display: flex; flex-wrap: wrap; padding-top: 15px; }
.project-icon { display: flex; flex-direction: column; align-items: center; width: 90px; margin: 10px; text-align: center; cursor: pointer; }
.project-icon img { width: 48px; height: 48px; margin-bottom: 5px; }
.project-icon span { color: #000; font-size: 14px; padding: 2px; }
.project-icon:hover { background-color: #e8f0ff; border: 1px dotted #a2c2ff; }



.browser-body { padding: 0; display: flex; flex-direction: column; height: 100%; }
.tab-bar { display: flex; background-color: #ece9d8; padding: 3px 3px 0 3px; border-bottom: 1px solid #a0a0a0; flex-shrink: 0; }
.tab { padding: 5px 10px; border: 1px solid #a0a0a0; border-bottom: none; margin-right: 2px; background-color: #d4d0c8; cursor: pointer; border-radius: 4px 4px 0 0; }
.tab.active { background-color: #f5f5f5; font-weight: bold; }
.tab-content { flex-grow: 1; position: relative; }
.tab-pane { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; }
.tab-pane.active { display: block; }
.tab-pane iframe { width: 100%; height: 100%; border: none; }



#taskbar-tabs { display: flex; flex-grow: 1; height: 100%; overflow: hidden; padding: 2px 0; }
.taskbar-tab { display: flex; align-items: center; max-width: 150px; padding: 0 10px; margin: 0 2px; border: 1px solid #003c74; border-radius: 2px; background: linear-gradient(to bottom, #3d81ee, #2362dd); color: white; font-size: 12px; cursor: pointer; box-shadow: inset 1px 1px 0 #6892ca; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.taskbar-tab:hover { filter: brightness(1.1); }
.task-tab.active { background: linear-gradient(to bottom, #1e4b96, #0a275a); box-shadow: inset 1px 1px 3px rgba(0,0,0,0.5); font-weight: bold; }



.window.minimizing { transform: scale(0) translate(var(--tx, 0), var(--ty, 0)); opacity: 0; }



.ui-resizable-se { cursor: nwse-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }



.skills-container { padding-top: 10px; }
.skill { margin-bottom: 18px; padding: 0 5px; }
.skill-name { display: block; margin-bottom: 5px; font-size: 14px; }
.skill-bar-container { width: 100%; height: 22px; background-color: #fff; border: 2px solid; border-color: #808080 #DFDFDF #DFDFDF #808080; box-sizing: border-box; padding: 2px; }
.skill-bar { height: 100%; background: linear-gradient(to right, #0055e7, #0078FF); color: white; font-size: 12px; font-weight: bold; display: flex; align-items: center; justify-content: center; transition: width 1.5s cubic-bezier(0.25, 1, 0.5, 1); }
.skill-bar.special-skill { background: linear-gradient(to right, #b22287, #9c076a); }
.skill-separator { margin: 20px 0; border: 0; border-top: 1px solid #d4d0c8; }
.window:not([style*="display: none"]) .skill-bar { width: var(--skill-level, 0); }


.about-me-content {
    display: flex;
    align-items: center; 
    padding: 20px; 
    height: auto;
    box-sizing: border-box;
}

.about-me-photo {
    width: 220px;
    height: 280px;
    border: 3px inset #fff; 
    margin-right: 25px; 
    object-fit: cover;
    object-position: center top;
    flex-shrink: 0;
}

.about-me-text {
    font-size: 15px; 
    line-height: 1.7; 
}

.about-me-text p {
    margin-top: 0;
    margin-bottom: 1em;
}


.iframe-container-body {
    height: 100%; 
    padding: 0 !important;
    box-sizing: border-box;
}

.iframe-container-body iframe {
    border: none;
    overflow: hidden;
}


.project-icon img.wide-logo {
    object-fit: contain;
}


.project-window-body {
    display: flex;
    flex-direction: column;
    padding: 0;
    height: 93%; 
    box-sizing: border-box;
}

.iframe-project-content {
    flex-grow: 1;
    min-height: 0;
    border-bottom: 1px solid #808080;
}

.iframe-project-content iframe {
    width: 100%;
    height: 100%;
    border: 2px solid;
    border-color: #808080 #DFDFDF #DFDFDF #808080;
}

.project-footer {
    flex-shrink: 0;
    padding: 10px 15px;
    background-color: #ECE9D8;
    border-top: 1px solid #fff;
    max-height: 162px;
    overflow-y: auto;
}

.project-footer h4 {
    margin: 0 0 8px 0;
    font-weight: bold;
    font-size: 14px;
    color: #000;
}

.project-footer p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .iframe-container-body iframe {
        height: 100%;
    }
}



#shutdown-overlay {
    display: none; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 5, 45, 0.7);
    z-index: 3000;
    justify-content: center;
    align-items: center;
}

#shutdown-overlay.active {
    display: flex;
}

.shutdown-message-box {
    background-color: #f0f0f0;
    border: 2px outset #fff;
    box-shadow: 3px 3px 5px rgba(0,0,0,0.4);
    padding: 25px 30px;
    text-align: center;
    width: 350px;
}

.shutdown-message-box h2 {
    font-size: 25px;
    margin-top: 0;
    margin-bottom: 15px;
    color: #003399;
}

.shutdown-message-box p {
    font-size: 25px;
    margin-bottom: 25px;
}

.shutdown-message-box button {
    min-width: 80px;
}


#contact-form {
    padding-top: 10px;
}

.form-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 15px;
}

#form-status {
    margin-right: auto; 
    font-size: 13px;
    font-weight: bold;
}

#form-status.success {
    color: #008000; 
}

#form-status.error {
    color: #ff0000;
}

#contact-form textarea {
    width: 100%;                 
    box-sizing: border-box;      
    resize: none;                 
}

@media (max-width: 768px) {
    .desktop-icon {
        width: 70px;
        margin: 10px;
    }

    .desktop-icon img {
        width: 40px;
        height: 40px;
    }

    .desktop-icon span {
        font-size: 12px;
    }

    .window {
        width: 95% !important;
        height: 85% !important;
        left: 2.5% !important;
        top: 5% !important;
        flex-direction: column;
    }

    .window[style*="display: block"] {
        display: flex !important;
    }

    .window-body {
        flex-grow: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
    }

    #window-buscaminas {
        width: 90vw !important;
        height: 75vh !important;
    }

    #window-proyectos {
        height: auto !important;
    }

    .window-body.project-view-body {
        display: flex;
        flex-direction: column;
        padding: 0 !important;
        height: 93% !important;
    }

    .about-me-content {
        flex-direction: column;
        text-align: center;
    }

    .about-me-photo {
        margin-right: 0;
        margin-bottom: 15px;
        width: 150px;
        height: 190px;
    }

    #start-menu {
        width: 100%;
    }

    .project-icons-container {
        justify-content: center;
    }

    .window-body.project-view-body .iframe-project-content {
        height: 55vh;
    }
}


/* ================================================================== */
/* ========= SOLUCIÓN FINAL PARA EL LAYOUT DE LAS VENTANAS ========= */
/* ================================================================== */

/* 1. Define CADA ventana como un contenedor flexible vertical. */
.window {
    display: flex;
    flex-direction: column;
}

/* 2. ¡LA REGLA MÁS IMPORTANTE!
      Esto anula el `style="display: block;"` que añade el JavaScript,
      forzando a que la ventana SIEMPRE sea flexible cuando está visible. */
.window[style*="display: block"] {
    display: flex !important;
}

/* 3. Le ordena al "cuerpo" de la ventana que CREZCA (flex-grow: 1)
      y ocupe todo el espacio vertical sobrante que deja la barra de título.
      `min-height: 0` es un truco esencial para evitar problemas de desbordamiento en flexbox. */
.window-body {
    flex-grow: 1;
    min-height: 0;
}