/* ========================================
 *  MAIN.CSS – Perusrakenteet (ilman teemoja)
 *  ======================================== */

/* ===== RESET & PERUSASETUKSET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition), color var(--transition);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== NAVBAR ===== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg-nav);
    color: var(--text-primary);
    box-shadow: 0 2px 12px var(--shadow-color);
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-light);
    transition: background-color var(--transition), border-color var(--transition);
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    min-height: 68px;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: color var(--transition);
}

.navbar-brand:hover {
    color: var(--text-muted);
}

/* ---- navbar toggle (hampurilaisvalikko) ---- */
.navbar-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 22px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.navbar-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--text-primary);
    border-radius: 4px;
    transition: all 0.25s ease;
}

.navbar-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 6px);
}

.navbar-toggle.active span:nth-child(2) {
    opacity: 0;
}

.navbar-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -6px);
}

/* ---- navbar linkit ---- */
.navbar-menu {
    display: flex;
    list-style: none;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    align-items: center;
}

.navbar-menu li a {
    display: block;
    padding: 0.6rem 1.2rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    border-radius: 6px;
    transition: background var(--transition), color var(--transition);
    font-size: 1rem;
}

.navbar-menu li a:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.navbar-menu li a.active {
    background-color: var(--accent-color);
    color: #ffffff;
}

/* ===== PÄÄSISÄLTÖ ===== */
.main-content {
    flex: 1 0 auto;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

#viewContainer {
animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ===== FOOTER ===== */
.site-footer {
    flex-shrink: 0;
    background-color: var(--bg-footer);
    color: var(--text-muted);
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    margin-top: 2rem;
    transition: background-color var(--transition), border-color var(--transition);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem 1rem;
    font-size: 0.95rem;
}

.footer-container span {
    white-space: nowrap;
}

/* ===== TEEMANVAIHTO ===== */
.theme-switcher {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.theme-switcher button {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.theme-switcher button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.theme-switcher button.active-theme {
    background: var(--accent-color);
    color: #ffffff;
    border-color: var(--accent-color);
}

.theme-switcher button svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    display: block;
}

/* ===== AUTH / PROFIILI ===== */
.nav-auth {
    position: relative;
    margin-left: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#authLink {
display: flex !important;
align-items: center !important;
justify-content: center !important;
width: 44px;
height: 44px;
padding: 0 !important;
margin: 0;
border-radius: 50%;
overflow: hidden;
text-decoration: none;
color: var(--text-secondary);
transition: background var(--transition), transform 0.15s;
flex-shrink: 0;
line-height: 1;
background: transparent;
border: none;
outline: none;
}

#authLink:hover {
background: rgba(255, 255, 255, 0.08);
transform: scale(1.05);
}

#authLink svg {
width: 28px;
height: 28px;
stroke: currentColor;
display: block;
flex-shrink: 0;
}

#profileAvatarNav {
width: 36px;
height: 36px;
border-radius: 50%;
object-fit: cover;
border: 2px solid var(--accent-color);
transition: border-color var(--transition), transform 0.15s;
display: block;
margin: 0 auto !important;
padding: 0 !important;
flex-shrink: 0;
background: var(--bg-card);
}

#profileAvatarNav:hover {
border-color: var(--accent-light);
transform: scale(1.05);
}

/* Dropdown */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-dropdown);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-width: 180px;
    padding: 0.4rem 0;
    box-shadow: 0 8px 24px var(--shadow-color);
    z-index: 1000;
    transition: background var(--transition), border-color var(--transition);
}

.dropdown-menu a {
    display: block;
    padding: 0.5rem 1.2rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background var(--transition), color var(--transition);
    border-radius: 0;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    background: transparent;
}

.dropdown-menu a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-menu a:last-child {
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
    padding-top: 8px;
    color: #ef4444;
}

.dropdown-menu a:last-child:hover {
    background: var(--bg-hover);
    color: #f87171;
}

/* ===== MOBIILI ===== */
@media (max-width: 768px) {
    .navbar-container {
        min-height: 60px;
    }

    .navbar-toggle {
        display: flex;
    }

    .navbar-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        background-color: var(--bg-nav);
        padding: 0.5rem 0 1rem 0;
        gap: 0.125rem;
        border-top: 1px solid var(--border-light);
        margin-top: 0.5rem;
    }

    .navbar-menu.open {
        display: flex;
    }

    .navbar-menu li a {
        padding: 0.75rem 1rem;
        width: 100%;
        border-radius: 4px;
        text-align: center;
    }

    .navbar-menu li a.active {
        background-color: var(--accent-color);
    }

    .main-content {
        padding: 1.25rem 1rem;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .theme-switcher {
        width: 100%;
        justify-content: center;
        margin-top: 0.3rem;
    }

    .theme-switcher button {
        padding: 0.3rem 0.7rem;
    }

    .theme-switcher button svg {
        width: 18px;
        height: 18px;
    }

    .nav-auth {
        margin-left: 0;
        width: 100%;
        justify-content: center;
        padding: 0.25rem 0;
    }

    #authLink {
    width: 48px;
    height: 48px;
    }

    #profileAvatarNav {
    width: 40px;
    height: 40px;
    }

    .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0.25rem 0;
        margin-top: 0.25rem;
        width: 100%;
        border-radius: 0;
    }

    .dropdown-menu a {
        padding: 0.6rem 1.5rem;
        text-align: center;
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.03);
        margin-bottom: 2px;
    }

    .dropdown-menu a:hover {
        background: rgba(255, 255, 255, 0.08);
    }

    .dropdown-menu a:last-child {
        border-top: 1px solid var(--border-color);
        margin-top: 6px;
        padding-top: 10px;
    }
}

@media (max-width: 480px) {
    .navbar-brand {
        font-size: 1.2rem;
    }

    .main-content {
        padding: 1rem 0.75rem;
    }

    .navbar {
        padding: 0 0.75rem;
    }

    .site-footer {
        padding: 0.75rem 0.75rem;
    }

    .theme-switcher button {
        padding: 0.25rem 0.5rem;
    }

    .theme-switcher button svg {
        width: 16px;
        height: 16px;
    }
}
