/* Windows XP Teema */
:root {
    --xp-blue-light: #245edb;
    --xp-blue-dark: #003096;
    --xp-silver: #ece9d8;
    --xp-border: #003096;
    --text-color: #000000;
    --bg-color: #008080; /* Klassinen "Teal" työpöytätausta */
    --sidebar-width: 220px;
}

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

body {
    font-family: 'Tahoma', 'Inter', sans-serif; /* Tahoma oli XP:n vakiofontti */
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    min-height: 100vh;
    padding: 40px;
}

/* Sivuston yläotsikko */
.site-header {
    max-width: 1200px;
    margin: 0 auto 0 auto;
    background: linear-gradient(to bottom, #245edb 0%, #3f8cf3 9%, #245edb 18%, #245edb 92%, #333 100%);
    padding: 15px 20px;
    border-radius: 8px 8px 0 0;
    border: 3px solid #003096;
    border-bottom: 3px solid #003096; /* Yhdistetään sivureunoihin */
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.3);
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.site-header::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

.site-header h1 {
    font-size: 2rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
    letter-spacing: 1px;
    margin: 0;
    font-family: 'Tahoma', sans-serif;
    color: white;
}

.site-header p {
    font-size: 0.95rem;
    font-style: italic;
    color: white;
    margin-top: 5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    opacity: 0.9;
}

/* Asettelu */
.layout {
    display: flex;
    gap: 0; /* Poistettu väli ikkunoiden väliltä */
    max-width: 1200px;
    margin: 0 auto;
    align-items: stretch; /* Venyttää sisällön samalle korkeudelle */
}

.sidebar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: linear-gradient(to bottom, #748aff 0%, #d2d8ff 100%);
    padding: 10px;
    border: 3px solid var(--xp-border);
    border-right: none;
    border-bottom: none;
    border-top: none; /* Poistetaan yläraja, koska headerissa on jo alaraja */
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.3);
    border-radius: 0; /* Kaikki kulmat suoriksi */
}

/* Windows XP Task Pane Tyyli */
.task-group {
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.task-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 5px 5px 0 0;
}

/* Ensimmäinen ryhmä on tummempi sininen */
.task-group.primary .task-group-header {
    background: linear-gradient(to right, #2151d1 0%, #7aa1e5 100%);
    color: white;
}

/* Muut ryhmät ovat vaaleampia */
.task-group.secondary .task-group-header {
    background: linear-gradient(to right, #ffffff 0%, #c6d3f7 100%);
    color: #2151d1;
}

.task-group-header:hover {
    filter: brightness(1.1);
}

.task-group-content {
    background: linear-gradient(to right, #d6dff7 0%, #ffffff 100%);
    padding: 10px;
    border: 1px solid #ffffff;
    border-top: none;
}

.task-group-content ul {
    list-style: none;
}

.task-group-content li {
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px; /* Tilaa ikonin ja tekstin välille */
}

.task-group-content a {
    color: #2151d1;
    text-decoration: none;
    font-size: 0.85rem;
}

.task-group-content a:hover {
    text-decoration: underline;
}

/* Task Pane Toggle-painike */
.task-toggle {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    border: 1px solid #2151d1;
}

.task-toggle::after {
    content: "▲";
    font-size: 8px;
    color: #2151d1;
}

.task-group.primary .task-toggle {
    border: 1px solid #ffffff;
}

.task-group.primary .task-toggle::after {
    color: #2151d1;
}

/* Windows XP Ikkuna-tyyli (Pääsisällölle) */
.xp-window {
    background: var(--xp-silver);
    border: 3px solid var(--xp-border);
    border-top: none; /* Poistetaan yläraja */
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex; /* Jotta sisältö voi venyä */
    flex-direction: column;
    border-bottom: none; /* Status bar tulee alle */
    border-radius: 0; /* Kaikki kulmat suoriksi */
}

/* Windows XP Tilapalkki (Status Bar) */
.status-bar {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--xp-silver);
    border: 3px solid var(--xp-border);
    border-top: 1px solid #91a7b4; /* Ohuempi yläreuna, joka erottaa sen ikkunasta */
    display: flex;
    padding: 2px;
    font-size: 0.75rem;
    gap: 2px;
    border-radius: 0 0 8px 8px; /* Pyöristetyt alalaidat */
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.3);
}

.status-bar-item {
    padding: 3px 8px;
    border: 1px solid;
    border-color: #91a7b4 #ffffff #ffffff #91a7b4; /* Inset-efekti */
    background: #f1f0e7;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-bar-item.main {
    flex-grow: 1;
}

.status-bar-item.icon {
    flex-shrink: 0;
    min-width: 100px;
}

.status-bar a {
    color: #000;
    text-decoration: none;
}

.status-bar a:hover {
    text-decoration: underline;
}

.window-header {
    background: linear-gradient(to bottom, var(--xp-blue-light) 0%, var(--xp-blue-dark) 100%);
    padding: 5px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    flex-shrink: 0; /* Estää kutistumisen */
}

.window-title {
    font-size: 0.9rem;
}

.window-controls {
    display: flex;
    gap: 3px;
}

.control {
    width: 21px;
    height: 21px;
    border: 1px solid white;
    border-radius: 3px;
    position: relative;
    cursor: pointer;
}

.control.minimize { background: linear-gradient(to bottom, #4a8eff, #0055d4); }
.control.minimize::after {
    content: "";
    position: absolute;
    bottom: 4px;
    left: 4px;
    width: 8px;
    height: 2px;
    background: white;
}

.control.maximize { background: linear-gradient(to bottom, #4a8eff, #0055d4); }
.control.maximize::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 9px;
    height: 7px;
    border: 2px solid white;
    border-top-width: 3px;
}

.control.close { background: linear-gradient(to bottom, #f28f73, #d83a00); }
.control.close::after {
    content: "\2715"; /* Kerto-merkki */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* Ikkunan sisältö */
.window-content {
    background: white;
    padding: 20px;
    margin: 3px;
    border: 1px solid #91a7b4;
    min-height: 100px;
    flex-grow: 1; /* Venyttää sisällön koko ikkunan korkeudelle */
    display: flex;
    flex-direction: column;
}

.window-content p {
    margin-bottom: 1.2em; /* Lisätty väliä kappaleiden välille */
}

.window-content p:last-child {
    margin-bottom: 1.2em; /* Väli viimeisen kappaleen jälkeen */
}

.window-inner-footer {
    margin-top: auto;
    padding: 10px;
    background-color: #f5f5f5;
    border-top: 1px solid #ece9d8;
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
    text-align: center;
}

/* Tavalliset linkit */
a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Ajankohtaista lista */
.status-list {
    list-style: none;
    font-size: 0.85rem;
}

.status-list li {
    margin-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-icon {
    font-size: 1.8rem; /* Suurempi ikoni */
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
}

.status-info {
    flex-grow: 1;
}

.status-info span {
    display: block;
    color: #333;
}

.status-list li:last-child {
    border-bottom: none;
}

.last-updated {
    margin-top: 15px;
    font-size: 0.75rem;
    color: #666;
    font-style: italic;
    text-align: right;
    border-top: 1px dashed #ccc;
    padding-top: 5px;
}

/* Arkisto lista */
.archive-tree, .archive-tree ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.85rem; /* Yhtenäinen koko muiden valikkojen kanssa */
}

.archive-tree li {
    display: block; /* Estetään flex-asettelu periytyvän task-group-contentista */
    margin-bottom: 5px;
}

.archive-tree .year-toggle {
    cursor: pointer;
    font-weight: bold;
    color: #003096;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 5px;
    border-radius: 3px;
    line-height: 1.2;
}

.archive-tree .year-toggle:hover {
    background-color: #316ac5;
    color: white;
}

.archive-tree .year-toggle::before {
    content: "▶"; /* Nuoli oikealle oletuksena */
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.archive-tree .active .year-toggle::before {
    transform: rotate(90deg); /* Nuoli alas kun auki */
}

.archive-tree .archive-content {
    display: none;
    padding-left: 20px;
    margin-top: 5px;
}

.archive-tree .active .archive-content {
    display: block;
}

.archive-month-title {
    font-weight: bold;
    color: #666;
    margin-top: 10px;
    margin-bottom: 5px;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.archive-posts {
    list-style: none;
    padding-left: 10px;
}

.archive-posts li {
    margin-bottom: 3px;
    display: flex; /* Palautetaan flex vain postaus-riveille jos tarpeen */
    align-items: center;
}

.archive-posts a {
    color: #2151d1;
    text-decoration: none;
}

.archive-posts a:hover {
    text-decoration: underline;
}

/* Päiväkirjapostaukset */
.diary-post {
    background: #fff;
    border: 1px solid #91a7b4;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.05);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 2px solid #ece9d8;
    margin-bottom: 15px;
    padding-bottom: 10px;
}

.post-title {
    font-size: 1.25rem;
    color: #003096;
    margin-bottom: 0;
    border-bottom: none;
}

.post-date {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
}

.post-body p {
    margin-bottom: 1.2em;
    color: #333;
}

.post-body ul, .post-body ol {
    margin: 15px 0 20px 40px;
    color: #333;
}

.post-body li {
    margin-bottom: 8px;
    display: list-item; /* Varmistetaan että on list-item eikä flex */
    list-style-type: disc; /* Oletuspallo */
}

.post-body h3 {
    margin: 25px 0 15px 0;
    color: #003096;
    font-size: 1.1rem;
    border-bottom: 1px solid #ece9d8;
}

/* Kuvagalleria blogipostauksissa */
.post-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin: 20px 0;
    padding: 15px;
    background: #f5f5f5;
    border: 1px solid #91a7b4;
    border-radius: 5px;
}

.gallery-item {
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
    transition: transform 0.2s, border-color 0.2s;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.gallery-item:hover {
    transform: scale(1.05);
    border-color: #316ac5;
}

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

/* Lightbox (Kuvan suurennus) */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    border: 4px solid white;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    cursor: default;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

/* Yksittäinen kuva postauksessa */
.post-body img {
    max-width: 100%;
    height: auto;
    border: 1px solid #91a7b4;
    margin: 10px 0;
}

/* Päivitykset */
.task-group-content p {
    font-size: 0.85rem;
    margin-bottom: 10px;
    line-height: 1.4;
}

.updates p {
    border-bottom: 1px dotted #ccc;
    padding-bottom: 5px;
}

.updates p:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* Pääsisältö */
.container {
    flex-grow: 1;
}



h2 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: #003096;
    border-bottom: 2px solid #ece9d8;
}

footer {
    text-align: center;
    margin-top: 40px;
    font-size: 0.8rem;
    color: #666;
}

/* Mobiili-valikon painike */
.menu-toggle {
    display: none;
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: var(--xp-blue-light);
    border: 2px solid white;
    padding: 5px;
    border-radius: 5px;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: white;
    margin: 4px 0;
}

/* Mobiilioptimointi */
@media (max-width: 768px) {
    body {
        padding: 10px;
        padding-top: 50px;
    }

    .layout {
        flex-direction: column;
    }

    .menu-toggle {
        display: block;
    }

    .sidebar-wrapper {
        position: fixed;
        top: 0;
        left: -100%;
        height: 100vh;
        z-index: 999;
        transition: 0.3s;
        width: 280px;
        padding: 20px;
        background: rgba(0, 128, 128, 0.9);
        overflow-y: auto;
    }

    .sidebar-wrapper.active {
        left: 0;
    }

    .container {
        width: 100%;
    }

    .xp-window {
        border-radius: 0;
    }

    .sidebar-wrapper {
        border-radius: 0;
    }

    .status-bar {
        flex-direction: column;
        border-radius: 0 0 5px 5px; /* Pyöristys vain alas */
        margin-top: 0; /* Poistetaan rako */
    }

    .status-bar-item {
        width: 100%;
        justify-content: center;
    }

    .status-bar-item.icon {
        min-width: 0;
    }

    .site-header {
        margin-top: 50px; /* Tilaa valikkopainikkeelle */
        margin-bottom: 0;
        padding: 15px;
        border-radius: 5px 5px 0 0;
        width: 100%;
    }

    .site-header h1 {
        font-size: 1.5rem;
    }

    .site-header p {
        font-size: 0.8rem;
    }
}

/* Windows XP Kirjautumisruutu */
.login-screen {
    background: #5a7edc radial-gradient(circle at 50% 50%, #5a7edc 0%, #4a6ecb 100%);
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Tahoma', 'Verdana', sans-serif;
    overflow: hidden;
    color: white;
}

.login-header {
    height: 80px;
    background: #003096 linear-gradient(to bottom, #003096 0%, #002070 100%);
    border-bottom: 2px solid #ff8a00;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 40px;
}

.login-main {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(to right, 
        rgba(0,0,0,0.1) 0%, 
        transparent 15%, 
        transparent 85%, 
        rgba(0,0,0,0.1) 100%
    );
}

.login-container {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1000px;
    height: 450px;
    position: relative;
}

.login-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-right: 60px;
    text-align: right;
}

.login-divider {
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%);
    box-shadow: 1px 0 0 rgba(0,0,0,0.1);
}

.login-right {
    flex: 1;
    padding-left: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Logo tyylit */
.xp-logo-large {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.logo-icon {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    width: 70px;
    height: 70px;
    transform: skew(-5deg);
}

.logo-icon div {
    border-radius: 2px;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.logo-icon .red { background: #eb4d2d; }
.logo-icon .green { background: #78b83e; }
.logo-icon .blue { background: #00a1e5; }
.logo-icon .yellow { background: #f6b300; }

.logo-text {
    display: flex;
    flex-direction: column;
    color: white;
}

.logo-text .ms { font-size: 0.9rem; margin-bottom: -5px; opacity: 0.9; }
.logo-text .win { font-size: 2.8rem; font-weight: bold; line-height: 1; }
.logo-text .xp { font-size: 1.4rem; font-weight: bold; color: #ff8a00; align-self: flex-end; margin-top: -10px; }

.login-instruction {
    color: white;
    font-size: 1.2rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    opacity: 0.95;
}

/* Käyttäjätili */
.user-account {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    width: fit-content;
    border: 1px solid transparent;
}

.user-account:hover {
    background: rgba(255, 255, 255, 0.1);
}

.user-account.active {
    background: #316ac5;
    border: 1px solid #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

.user-icon-wrapper {
    width: 70px;
    height: 70px;
    border: 2px solid #ff8a00;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}

.user-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.username {
    color: white;
    font-size: 1.6rem;
    font-weight: normal;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

/* Salasanakenttä */
.password-box {
    display: none;
    margin-top: 8px;
    flex-direction: column;
}

.user-account.active .password-box {
    display: flex;
}

.pass-label {
    color: white;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.input-wrapper {
    display: flex;
    gap: 8px;
}

.password-box input {
    border: 1px solid #003096;
    padding: 4px 8px;
    border-radius: 3px;
    outline: none;
    width: 160px;
}

.go-button {
    background: #78b83e;
    color: white;
    border: 1px solid #fff;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    font-weight: bold;
    font-size: 1.1rem;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.go-button:hover {
    background: #8cd04a;
}

/* Login Footer */
.login-footer {
    height: 100px;
    background: #003096 linear-gradient(to bottom, #003096 0%, #002070 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 60px;
    border-top: 2px solid #ff8a00;
    flex-shrink: 0;
}

.shutdown-button {
    background: none;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 1.1rem;
}

.shutdown-icon {
    width: 32px;
    height: 32px;
    background: #eb4d2d;
    border: 2px solid white;
    border-radius: 6px;
    position: relative;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.shutdown-symbol {
    width: 14px;
    height: 14px;
    border: 2px solid white;
    border-radius: 50%;
    border-top-color: transparent;
    position: relative;
}

.shutdown-symbol::after {
    content: "";
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 8px;
    background: white;
}

.footer-right {
    font-size: 0.9rem;
    text-align: right;
    opacity: 0.9;
    line-height: 1.4;
    color: white;
}

@media (max-width: 768px) {
    .login-header { height: 40px; }
    .login-container {
        flex-direction: column;
        height: auto;
        gap: 40px;
        padding: 40px 0;
    }
    .login-left {
        padding-right: 0;
        align-items: center;
        text-align: center;
    }
    .login-right {
        padding-left: 0;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .login-divider {
        width: 80%;
        height: 1px;
    }
    .login-footer {
        flex-direction: column;
        height: auto;
        padding: 20px;
        gap: 15px;
    }
    .footer-right {
        text-align: center;
    }
}
