* {
    box-sizing: border-box;
}

img {
    display: block;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: Arial, sans-serif;
}

.main-box {
    width: 75%;
    max-width: 1600px;
    margin: 0 auto;
}

.site-banner {
    height: 70px;
}

.page {
    height: calc(100vh - 70px);
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
}


.topbar {
    display: flex;
    gap: 20px;
    margin-left: 20px;
    align-items: center;
    margin-top: 5px;
    margin-bottom: 5px;
}

.topbar button[type="submit"] {
    margin-right: 20px;
}

.main-layout {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(90px, 14vw) 1fr;
    gap: 8px;
}


.dates {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;   /* tärkeä */
}

.date-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;   /* scroll vain täällä */
}

.date-controls {
    flex-shrink: 0;
    padding-top: 8px;
    background: inherit;
}


.date-button {
    display: block;
    width: 100%;
    margin-bottom: 4px;
    font-size: clamp(10px, 1.4vw, 16px);
    cursor: pointer;
    border-radius: clamp(2px, 0.3vw, 6px);
    padding: clamp(4px, 0.5vw, 12px);
}

.main-image-box {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border: 2px solid #003040;
    text-align: center;
    padding: 8px;
    box-sizing: border-box;
}


#dateLabel {
    font-size: clamp(14px, 1.8vw, 24px);
    margin-bottom: 6px;
}


#mainImage {
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    display: block;
    margin: auto;
    transform-origin: center center;
    object-fit: contain;
    transition: transform 0.05s linear;
    transform-origin: center center;
    cursor: grab;
    overflow: hidden;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: auto;
    background-color: #f0f0f0;
}

#mainImage {
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    display: block;
    margin: auto;
    transform-origin: center center;
}



.products {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;

    padding: 8px;

    min-height: 60px;
    overflow-x: auto;
}


.product-button {
    font-size: clamp(12px, 1.3vw, 20px);
    cursor: pointer;
    border-radius: clamp(2px, 0.3vw, 6px);
    padding: clamp(4px, 0.5vw, 14px);
}


.bottom-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 10px;
}


.mode-buttons,
.products {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}


.mode-button,
.product-button {
    padding: clamp(8px, 0.5vw, 14px);
    font-size: clamp(8px, 1vw, 16px);
    cursor: pointer;
    border: 1px solid #003040;
    background: white;
    border-radius: clamp(2px, 0.3vw, 6px);
}

.mode-button:hover,
.product-button:hover {
    background: #dbeafe;
}


.active-button {
    background-color: #003040;
    color: white;
    font-weight: bold;
}


.site-banner {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 8px 18px;
    box-sizing: border-box;

    background: white;
    border-bottom: 2px solid #003040;
}

.banner-left,
.banner-right {
    display: flex;
    align-items: center;
    gap: 30px;
}

.banner-logo {
    height: clamp(10px, 5vw, 50px);
    width: auto;
    object-fit: contain;
}

.institute-logo {
    height: clamp(10px, 5vw, 50px);
    width: auto;
    object-fit: contain;
}

.site-title {
    font-size: clamp(10px, 2.2vw, 28px);
    font-weight: bold;
    color: #006090;
    white-space: nowrap;
}


.menu-container {
    position: relative;
}

.menu-button {
    font-size: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #003040;
    padding: 4px 10px;
}

.menu-button:hover {
    color: #006090;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 50px;
    min-width: 220px;
    background: white;
    border: 1px solid #003040;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1000;
}

.dropdown-menu a {
    display: block;
    padding: 12px;
    text-decoration: none;
    color: #003040;
    font-weight: bold;
}

.dropdown-menu a:hover {
    background: #003040;
    color: white;
}

.download-table {
    border-collapse: collapse;
    width: 75%;
    margin: 20px auto;
    font-size: clamp(12px, 1vw, 18px);
    background: white;
}

.download-table th {
    background: #003040;
    color: white;
    padding: 12px;
    text-align: center;
}

.download-table td {
    border: 1px solid #cccccc;
    padding: 10px;
    text-align: center;
}


.download-table tr:nth-child(even) {
    background: #f5f5f5;
}


.download-table a {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: none;
    color: #0060a0;
    font-weight: bold;
    transition: background 0.15s;
}

.download-table a:hover {
    color: white;
    background: #0060a0;
}

.download-table caption {
    caption-side: top;
    font-size: clamp(10px, 1.4vw, 20px);
    font-weight: bold;
    background: #003040;
    color: white;
    padding: 14px;
    border-radius: 8px 8px 0 0;
}


.topbar button {
    padding: 6px 12px;
    font-size: clamp(10px, 1vw, 18px);
    cursor: pointer;
    border: 1px solid #003040;
    background: white;
    border-radius: 4px;
}

.topbar button:hover {
    background: #003040;
    color: white;
}

.date-separator {
    margin: 18px 0;
    border: none;
    height: 2px;
    background: linear-gradient(to right,
                transparent,
                #003040,
                transparent);
}

.reset-button {
    width: 100%;
    padding: clamp(4px, 0.5vw, 10px);
    font-size: clamp(10px, 1vw, 18px);
    border-radius: clamp(2px, 0.3vw, 6px);
}


.bottom-separator {
    width: 2px;
    height: 40px;
    background: linear-gradient(to bottom,
                transparent,
                #003040,
                transparent);
}