/* MekryPro – sovelluksen runko */
body { margin: 0; }

/* Ghost toast – slides in, stays visible ~5s+, then fades out (non-blocking) */
@keyframes mekry-ghost-toast-drift {
    0% {
        opacity: 0;
        transform: translate(-20px, 12px);
        animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    4% {
        opacity: 1;
        transform: translate(0, 0);
        animation-timing-function: linear;
    }
    96% {
        opacity: 1;
        transform: translate(0, 0);
        animation-timing-function: ease-in;
    }
    100% {
        opacity: 0;
        transform: translate(0, 0);
    }
}

@keyframes mekry-ghost-toast-drift-mobile {
    0% {
        opacity: 0;
        transform: translate(-14px, 8px);
        animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    4% {
        opacity: 1;
        transform: translate(0, 0);
        animation-timing-function: linear;
    }
    96% {
        opacity: 1;
        transform: translate(0, 0);
        animation-timing-function: ease-in;
    }
    100% {
        opacity: 0;
        transform: translate(0, 0);
    }
}

.mekry-ghost-toast {
    position: fixed;
    left: 1rem;
    top: clamp(4.5rem, 12vh, 7rem);
    z-index: 99999;
    pointer-events: none;
    padding: 0;
    max-width: calc(100vw - 2rem);
    transform: none;
}

.mekry-ghost-toast-item {
    display: inline-block;
    max-width: min(28rem, calc(100vw - 2rem));
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 500;
    text-align: left;
    box-shadow: var(--shadow-main);
    opacity: 0;
    will-change: transform, opacity;
}

.mekry-ghost-toast-item.visible {
    animation-name: mekry-ghost-toast-drift;
    animation-duration: 5.5s;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

.mekry-ghost-toast-item.mekry-ghost-toast-success {
    background: var(--panel-bg);
    border: 1px solid var(--accent-border);
    color: var(--accent-main);
}

.mekry-ghost-toast-item.mekry-ghost-toast-error {
    background: var(--panel-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger-main);
}

/* Ghost toast – mobile (same ~5s visible hold) */
@media (max-width: 768px) {
    .mekry-ghost-toast {
        left: 0.75rem;
        top: clamp(4.25rem, 10vh, 6.5rem);
        max-width: calc(100vw - 1.5rem);
    }
    .mekry-ghost-toast-item {
        padding: 12px 16px;
        font-size: 0.875rem;
        max-width: 100%;
        box-sizing: border-box;
    }
    .mekry-ghost-toast-item.visible {
        animation-name: mekry-ghost-toast-drift-mobile;
        animation-duration: 5.5s;
    }
}

@media (prefers-reduced-motion: reduce) {
    @keyframes mekry-ghost-toast-fade-only {
        0% {
            opacity: 0;
            animation-timing-function: ease-out;
        }
        4% {
            opacity: 1;
            animation-timing-function: linear;
        }
        96% {
            opacity: 1;
            animation-timing-function: ease-in;
        }
        100% {
            opacity: 0;
        }
    }

    .mekry-ghost-toast-item.visible {
        animation-name: mekry-ghost-toast-fade-only;
        animation-duration: 5.5s;
        animation-timing-function: linear;
        animation-fill-mode: forwards;
    }
}

/* Notices – hidden (ghost toast shows instead) */
.mekry-notice {
    display: none;
}
body:not(.mekry-auth-page) { margin: 1rem; }
h1 { margin-top: 0; }

/* Topbar – fixed header */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 1rem;
    margin: 0;
    background: var(--bg-main-2);
    border-bottom: 1px solid var(--border-light);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}
body:not(.mekry-auth-page) {
    margin: 1rem;
    margin-top: 0;
    padding-top: calc(56px + 1rem); /* fixed topbar + edge margin */
}
body.home-page .topbar {
    padding: 14px clamp(18px, 3vw, 36px);
    background: var(--bg-main-2);
    border-bottom: 1px solid var(--border-light);
}
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
}
.topbar-logo {
    font-weight: 800;
    font-size: 18px;
    color: inherit;
    text-decoration: none;
}
body.home-page .topbar-logo {
    color: var(--text-main);
}
.topbar-logo:hover {
    text-decoration: none;
    opacity: 0.9;
}
.topbar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Kielivalinta: 4 nappia FI/EN/SV/ET */
.lang-switch {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
}

.lang-btn {
    box-sizing: border-box;
    min-width: 44px;
    height: 32px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    background: var(--field-bg-soft);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    line-height: 1;
    transition: all 0.2s ease;
    flex-shrink: 0;
    white-space: nowrap;
}

.lang-btn:hover {
    background: var(--list-hover);
}

.lang-btn.is-active {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--accent-main);
    cursor: default;
}

.lang-switch span.lang-btn {
    cursor: default;
}

body.home-page .lang-btn {
    border: 1px solid var(--border-default);
    background: var(--field-bg-soft);
    color: var(--text-main);
}

body.home-page .lang-btn:hover {
    background: var(--list-hover);
}

body.home-page .lang-btn.is-active {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--accent-main);
}
.topbar-link {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: inherit;
    text-decoration: none;
    border-radius: 10px;
    transition: background 0.18s ease, color 0.18s ease;
}
.topbar-link:hover {
    background: var(--list-hover);
    text-decoration: none;
}
body.home-page .topbar-link {
    color: var(--text-main);
}
body.home-page .topbar-link:hover {
    background: var(--list-hover);
    color: var(--text-main);
}
.topbar-link-primary {
    background: var(--accent-soft);
    color: var(--bg-main);
}
body.home-page .topbar-link-primary {
    background: var(--accent-button-bg);
    border: 1px solid var(--accent-border);
    color: var(--accent-toggle-text);
}
.topbar-link-primary:hover {
    background: linear-gradient(180deg, rgba(54, 211, 165, 0.22), rgba(54, 211, 165, 0.14));
    border-color: var(--accent-hover);
}

/* Footer – © 2025 - 2026 - All rights Reserved - {company_name} */
.app-footer {
    padding: 24px 1rem 32px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-default);
    margin-top: 2rem;
}
body.home-page .app-footer,
body.home-page.features-page .app-footer {
    color: var(--text-muted);
    border-top-color: var(--border-light);
}

.app-footer-legal {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem 0.5rem;
    margin-bottom: 0.65rem;
    font-size: 0.8125rem;
}

.app-footer-legal a {
    color: #94a3b8;
    text-decoration: none;
}

.app-footer-legal a:hover {
    color: #e2e8f0;
    text-decoration: underline;
}

.app-footer-legal-sep {
    color: #475569;
    user-select: none;
}

/* Flatpickr — today shortcut (all pages) */
body.mekry-app .flatpickr-calendar .mekry-flatpickr-today-wrap {
    padding: 0.45rem 0.65rem 0.6rem;
    border-top: 1px solid #334155;
    box-sizing: border-box;
}

body.mekry-app .flatpickr-calendar .mekry-flatpickr-today-btn {
    width: 100%;
    min-height: 2rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    box-sizing: border-box;
}
