/* modals.css */

/* Modaalin tausta */
.modal_overlay {
    position: fixed;
    inset: 0;
    /* korvaa top, left, right, bottom: 0; */
    background: rgb(0 0 0 / 60%);
    display: none;
    /* Piilotettu oletuksena */
    justify-content: center;
    align-items: center;
    z-index: var(--z-modal);
}

/* Blur-taustainen overlay kuvamodaalille */
.modal_overlay_blur {
    background: rgb(0 0 0 / 80%);
    backdrop-filter: blur(4px);
}

/* Modaalin sisältö */
.modal {
    background-color: var(--bg_color);
    /* color: #000; */
    padding: 20px;
    /* border-radius: 8px; */
    border: 1px solid var(--border_color);
    border-radius: var(--border_radius);
    width: 100%;
    max-width: 700px;
    box-sizing: border-box;
    box-shadow: var(--add_row_form_box_shadow);
    max-height: 95vh;
    overflow-y: auto;
    position: relative;
}

/* Otsikko ja sulkemisnapin layout */
.modal_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0rem;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border_color);
}

.modal_header h1,
.modal_header h2,
.modal_header h3,
.modal_header h4,
.modal_header h5,
.modal_header h6 {
    margin: 0;
}

.modal h2 {
    margin-top: 0;
}

.modal label {
    margin: 10px 0 5px;
}

.modal input,
.modal select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: var(--border_radius_small);
}

.modal .form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.modal .form-actions button {
    padding: 8px 16px;
    margin-left: 10px;
    border: none;
    border-radius: var(--border_radius_small);
    cursor: pointer;
}

.modal .form-actions .cancel-button {
    background-color: var(--bg_color);
}

.modal .form-actions .submit-button {
    background-color: #4CAF50;
    color: #fff;
}

.modal .form-actions .submit-button:hover {
    background-color: #45a049;
}

/* Sulkemispainike */
.modal_close_button {
    position: static;
    color: #fff;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.9);
    padding: 3px 10px;
    border-radius: var(--border_radius_small);
    margin-left: 1rem;
}

/* Styles specifically for image modals */
.image_modal {
    padding: 0;
    border-radius: 0;
    max-width: none;
    overflow: hidden;
    min-width: 200px;
    min-height: 200px;
}

.image_modal img {
    min-width: 200px;
    min-height: 200px;
}

.image_modal .modal_close_button {
    position: fixed;
    top: 15px;
    right: 20px;
    color: #fff;
}

.image_modal_wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg_color_image);
    max-width: 100vw;
    max-height: 100vh;
}

.modal * {
    letter-spacing: 0.5px;
}

.modal p, .modal ul, .modal ol {
    /* margin-top: 10px; */
    margin-bottom: 10px;
    line-height: 1.4em;
}

.modal_body h1, .modal_body h2, .modal_body h3, .modal_body h4, .modal_body h5, .modal_body h6 {
    margin-top: 40px;
    margin-bottom: 10px;
}