/* ============================================================
   mustvee-ametnikud — public/style.css  v3
   ============================================================ */

/* ── Päise laius ────────────────────────────────────────────── */
/* .mv-page__content on 760px, .mv-container on 1200px —
   laiendame sisuala konteineriga samaks                       */
.mv-page__content:has(.mvo-wrap) {
    max-width: 100% !important;
}

.mvo-wrap {
    width: 100%;
    overflow-x: auto;
}

/* ── Osakond ────────────────────────────────────────────────── */
.mvo-dept { margin-bottom: 2.5rem; }

.mvo-dept__header {
    border-bottom: 2px solid #1a5276;
    margin-bottom: .75rem;
    padding-bottom: .5rem;
}

.mvo-dept__nimi {
    color: #1a5276;
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 .2rem;
}

.mvo-dept__meta { color: #555; font-size: .85rem; margin: .2rem 0 0; }

.mvo-dept__teade {
    background: #fef9e7;
    border-left: 3px solid #f0b00b;
    color: #7d6608;
    font-size: .84rem;
    margin: .5rem 0 0;
    padding: .4rem .75rem;
}

/* ── Tabel ──────────────────────────────────────────────────── */
.mvo-tabel { border-collapse: collapse; width: 100%; }

.mvo-tabel thead th {
    background: #f5f7f9;
    border-bottom: 2px solid #d0d8e0;
    color: #444;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .03em;
    padding: .5rem .75rem;
    text-align: left;
    text-transform: uppercase;
}

/* Päise ikoon */
.mvo-th-icon {
    display: inline-block;
    height: 13px;
    margin-right: .3rem;
    opacity: .6;
    vertical-align: middle;
    width: 13px;
}

.mvo-th-icon svg {
    display: block;
    height: 100%;
    width: 100%;
}

.mvo-th__nimi      { width: 16%; }
.mvo-th__ametikoht { width: 20%; }
.mvo-th__telefon   { width: 14%; }
.mvo-th__email     { width: 22%; }
.mvo-th__lisainfo  { width: 28%; }

.mvo-tabel tbody tr { border-bottom: 1px solid #eaecef; }
.mvo-tabel tbody tr:last-child { border-bottom: none; }
.mvo-tabel tbody tr:hover { background: #f8fafc; }

.mvo-tabel tbody td {
    font-size: .9rem;
    padding: .55rem .75rem;
    vertical-align: top;
}

/* ── Ametikoht + asukoht ────────────────────────────────────── */
.mvo-row__asukoht {
    color: #666;
    display: block;
    font-size: .8rem;
    font-style: normal;
    font-weight: 400;
    margin-top: .1rem;
}

.mvo-popup__asukoht {
    color: #666;
    font-size: .85rem;
    font-weight: 400;
}

/* ── Lisainfo tulp (puhkus + vastuvõtt) ────────────────────── */
.mvo-row__lisainfo {
    vertical-align: top;
}

.mvo-lisainfo__puhkus {
    color: #7d6608;
    display: block;
    font-size: .83rem;
}

.mvo-lisainfo__vastuvott {
    color: #444;
    display: block;
    font-size: .83rem;
    line-height: 1.45;
    margin-top: .15rem;
}

/* ── Nime nupp ──────────────────────────────────────────────── */
.mvo-nimi-btn {
    background: none;
    border: none;
    color: #1a5276;
    cursor: pointer;
    display: block;
    font-family: inherit;
    font-size: inherit;
    font-weight: 600;
    line-height: 1.3;
    padding: 0;
    text-align: left;
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: text-decoration-color .15s, color .15s;
    white-space: nowrap;
    width: 100%;
}

.mvo-nimi-btn:hover,
.mvo-nimi-btn:focus {
    color: #2980b9;
    outline: none;
    text-decoration-color: currentColor;
}

.mvo-nimi-btn:focus-visible {
    border-radius: 2px;
    outline: 2px solid #2980b9;
    outline-offset: 2px;
}

.mvo-tabel a { color: #1a5276; text-decoration: none; }
.mvo-tabel a:hover { text-decoration: underline; }

.mvo-row__telefon a { white-space: nowrap; }

/* ── Popup overlay ──────────────────────────────────────────── */
.mvo-overlay {
    align-items: center;
    background: rgba(0,0,0,.45);
    bottom: 0; left: 0; right: 0; top: 0;
    display: flex;
    justify-content: center;
    position: fixed;
    z-index: 9999;
}
.mvo-overlay[hidden] { display: none; }
.mvo-body-lock { overflow: hidden; }

/* ── Modal ──────────────────────────────────────────────────── */
.mvo-modal {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0,0,0,.22);
    max-height: 90vh;
    max-width: 480px;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    width: calc(100% - 2rem);
}

.mvo-modal__sule {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    padding: .2rem .4rem;
    position: absolute;
    right: 1rem;
    top: 1rem;
    transition: color .15s;
}
.mvo-modal__sule:hover { color: #1a1a1a; }

/* ── Popup sisu ─────────────────────────────────────────────── */
.mvo-popup__pealkiri { margin-bottom: 1rem; padding-right: 2rem; }
.mvo-popup__nimi { color: #1a1a1a; font-size: 1.2rem; font-weight: 700; margin: 0 0 .25rem; }
.mvo-popup__amet { color: #1a5276; font-size: .9rem; font-weight: 500; }

.mvo-popup__haridus {
    align-items: baseline;
    background: #f4f7fa;
    border-radius: 6px;
    display: flex;
    font-size: .88rem;
    gap: .4rem;
    margin-bottom: .9rem;
    padding: .5rem .75rem;
}
.mvo-popup__haridus-tekst strong { font-weight: 600; }

.mvo-popup__kontakt { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; }
.mvo-popup__tel, .mvo-popup__email {
    align-items: center;
    color: #1a5276;
    display: flex;
    font-size: .9rem;
    gap: .4rem;
    text-decoration: none;
}
.mvo-popup__tel:hover, .mvo-popup__email:hover { text-decoration: underline; }

.mvo-popup__ajuhend { margin-bottom: .9rem; }
.mvo-popup__ajuhend-link {
    align-items: center;
    background: #fdf5f5;
    border: 1px solid #e8c4c0;
    border-radius: 5px;
    color: #c0392b;
    display: inline-flex;
    font-size: .86rem;
    font-weight: 600;
    gap: .35rem;
    padding: .35rem .8rem;
    text-decoration: none;
    transition: background .15s;
}
.mvo-popup__ajuhend-link:hover { background: #f9e0de; }

.mvo-popup__vastuvott {
    background: #f4f7fa;
    border-radius: 6px;
    margin-bottom: .9rem;
    padding: .5rem .75rem;
}

.mvo-popup__vastuvott-pealkiri {
    color: #444;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .04em;
    margin-bottom: .25rem;
    text-transform: uppercase;
}

.mvo-popup__vastuvott-tekst {
    color: #222;
    font-size: .88rem;
    line-height: 1.5;
}

.mvo-popup__lisainfo {
    border-top: 1px solid #eee;
    color: #666;
    font-size: .83rem;
    line-height: 1.5;
    margin-top: .75rem;
    padding-top: .75rem;
}

.mvo-popup__puhkus {
    background: #fef9e7;
    border: 1px solid #f0b00b;
    border-radius: 6px;
    font-size: .85rem;
    margin-top: .75rem;
    padding: .55rem .8rem;
}
.mvo-popup__puhkus-märk { color: #7d6608; display: block; font-weight: 600; }
.mvo-popup__asendaja { color: #555; margin-top: .3rem; }
.mvo-popup__asendaja a { color: #1a5276; }

/* ── Mobiil ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .mvo-wrap { width: 100%; }
    .mvo-tabel thead { display: none; }
    .mvo-tabel tbody tr { display: block; padding: .4rem 0; }
    .mvo-tabel tbody td { display: block; padding: .15rem .5rem; }
    .mvo-row__nimi { font-size: 1rem; }
    .mvo-row__ametikoht { color: #555; font-size: .83rem; }
    .mvo-th__lisainfo { font-size: .82rem; color: #555; }
    .mvo-modal { padding: 1.5rem 1.25rem; }
}

/* ── Frontend admin — osakonna päis ───────────────────────── */
.mvo-wrap--admin .mvo-dept__header-row {
    align-items: center;
    display: flex;
    gap: .6rem;
}

.mvo-drag-handle {
    color: #aaa;
    cursor: grab;
    font-size: 1.1rem;
    user-select: none;
}

.mvo-drag-handle:active { cursor: grabbing; }

.mvo-dept.mvo-dragging {
    opacity: .45;
    outline: 2px dashed #2980b9;
}

.mvo-dept.mvo-drag-over {
    outline: 2px solid #2980b9;
    outline-offset: 2px;
}

.mvo-dept-edit-btn {
    align-items: center;
    background: #f0f6fc;
    border: 1px solid #c3d9f0;
    border-radius: 4px;
    color: #1a5276;
    cursor: pointer;
    display: inline-flex;
    font-size: .78rem;
    font-weight: 500;
    gap: .25rem;
    padding: .25rem .6rem;
    white-space: nowrap;
    transition: background .15s;
}

.mvo-dept-edit-btn:hover { background: #d6eaf8; }

/* ── Frontend admin — muutmise vorm ───────────────────────── */
.mvo-dept-form {
    background: #f8fafc;
    border: 1px solid #d0dce8;
    border-radius: 6px;
    margin: .75rem 0;
    padding: 1rem 1.1rem;
}

.mvo-dept-form__grid {
    display: grid;
    gap: .65rem;
    grid-template-columns: 1fr 1fr;
}

.mvo-dept-form label {
    color: #444;
    display: flex;
    flex-direction: column;
    font-size: .82rem;
    font-weight: 600;
    gap: .25rem;
}

.mvo-dept-form input,
.mvo-dept-form textarea {
    background: #fff;
    border: 1px solid #c8d8e8;
    border-radius: 4px;
    color: #222;
    font-family: inherit;
    font-size: .88rem;
    font-weight: 400;
    padding: .4rem .6rem;
    resize: vertical;
    width: 100%;
}

.mvo-dept-form input:focus,
.mvo-dept-form textarea:focus {
    border-color: #2980b9;
    outline: none;
}

.mvo-dept-form__btns {
    align-items: center;
    display: flex;
    gap: .5rem;
    margin-top: .75rem;
}

.mvo-dept-form__save {
    background: #1a5276;
    border: none;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: .85rem;
    padding: .4rem 1rem;
}

.mvo-dept-form__save:hover { background: #2980b9; }

.mvo-dept-form__cancel {
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #555;
    cursor: pointer;
    font-size: .85rem;
    padding: .4rem .9rem;
}

.mvo-dept-form__cancel:hover { background: #f0f0f0; }

.mvo-dept-form__status {
    color: #196f3d;
    font-size: .83rem;
}

@media (max-width: 640px) {
    .mvo-dept-form__grid { grid-template-columns: 1fr; }
}

/* ── Ametniku rea drag handle ───────────────────────────────── */
.mvo-th__handle { width: 24px; }

.mvo-row__handle {
    color: #bbb;
    cursor: grab;
    font-size: 1rem;
    text-align: center;
    user-select: none;
    width: 24px;
}

.mvo-row__handle:active { cursor: grabbing; }

.mvo-row.mvo-dragging-row {
    opacity: .4;
    outline: 2px dashed #2980b9;
}

/* Osakond sihtmärgina */
.mvo-dept--drop-target {
    outline: 3px solid #2980b9;
    outline-offset: 3px;
    border-radius: 4px;
}

.mvo-dept--drop-target .mvo-dept__header {
    background: #eaf4fb;
    border-radius: 4px 4px 0 0;
    padding: .4rem .5rem;
    margin: -.4rem -.5rem .2rem;
}

/* Drop märgis päises */
.mvo-drop-label {
    background: #2980b9;
    border-radius: 10px;
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    margin-left: .6rem;
    padding: 2px 10px;
    vertical-align: middle;
    animation: mvDropPulse .6s ease-in-out infinite alternate;
}

@keyframes mvDropPulse {
    from { opacity: .7; }
    to   { opacity: 1; }
}

/* ── Drag indikaator — täpne joon ──────────────────────────── */
.mvo-drop-ind__cell { padding: 0 !important; border: none !important; }
.mvo-drop-ind__line {
    background: #2980b9;
    border-radius: 2px;
    height: 3px;
    margin: 0 4px;
    position: relative;
}
.mvo-drop-ind__line::before {
    background: #2980b9;
    border-radius: 50%;
    content: '';
    height: 10px;
    left: -4px;
    position: absolute;
    top: -3.5px;
    width: 10px;
}
.mvo-row--dragging { opacity: .4; }

/* ── Admin: takista teksti selekteerimist drag ajal ──────── */
.mvo-wrap--admin .mvo-row,
.mvo-wrap--admin .mvo-row td,
.mvo-wrap--admin .mvo-row td * {
    -webkit-user-select: none;
    user-select: none;
}

.mvo-wrap--admin .mvo-row {
    cursor: grab;
}

.mvo-wrap--admin .mvo-row:active {
    cursor: grabbing;
}

/* Lingid ja nuppud säilitavad oma kursori */
.mvo-wrap--admin .mvo-row a,
.mvo-wrap--admin .mvo-row button {
    cursor: pointer;
    user-select: text;
}

/* Osakonna drag indikaator */
.mvo-dept-drop-ind {
    background: #2980b9;
    border-radius: 2px;
    height: 4px;
    margin: 6px 0;
    position: relative;
}
.mvo-dept-drop-ind::before {
    background: #2980b9;
    border-radius: 50%;
    content: '';
    height: 12px;
    left: -5px;
    position: absolute;
    top: -4px;
    width: 12px;
}

/* ── Popup redigeerimisvorm ─────────────────────────────────── */
.mvo-popup-edit-btn {
    background: #1a5276;
    border: none;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 600;
    margin-top: 1.2rem;
    padding: .55rem 1.2rem;
    width: 100%;
}
.mvo-popup-edit-btn:hover { background: #2980b9; }

.mvo-edit__pealkiri {
    color: #1a5276;
    font-size: 1.15rem;
    margin: 0 0 1rem;
}

.mvo-edit {
    display: flex;
    flex-direction: column;
    gap: .7rem;
}

.mvo-edit__rida {
    display: grid;
    gap: .7rem;
    grid-template-columns: 1fr 1fr;
}

.mvo-edit label {
    color: #444;
    display: flex;
    flex-direction: column;
    font-size: .8rem;
    font-weight: 600;
    gap: .25rem;
}

.mvo-edit input,
.mvo-edit textarea {
    background: #fff;
    border: 1px solid #c8d8e8;
    border-radius: 4px;
    color: #222;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 400;
    padding: .45rem .65rem;
    resize: vertical;
    width: 100%;
}

.mvo-edit input:focus,
.mvo-edit textarea:focus {
    border-color: #2980b9;
    outline: none;
}

.mvo-edit__btns {
    align-items: center;
    border-top: 1px solid #eee;
    display: flex;
    gap: .6rem;
    margin-top: .5rem;
    padding-top: 1rem;
}

.mvo-edit__save {
    background: #1a5276;
    border: none;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 600;
    padding: .5rem 1.3rem;
}
.mvo-edit__save:hover { background: #2980b9; }

.mvo-edit__cancel {
    background: none;
    border: 1px solid #ccc;
    border-radius: 5px;
    color: #555;
    cursor: pointer;
    font-size: .9rem;
    padding: .5rem 1.1rem;
}
.mvo-edit__cancel:hover { background: #f0f0f0; }

/* ── Puhkuseperioodide repeater (frontend kiirmuutmine) ──────── */
.mvo-edit__puhkused {
    border-top: 1px solid #eee;
    margin-top: .3rem;
    padding-top: .8rem;
}
.mvo-edit__puhkused h4 {
    color: #1a5276;
    font-size: .85rem;
    margin: 0 0 .6rem;
}
.mvo-edit-puhkus-row {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    margin-bottom: .6rem;
}
.mvo-edit-puhkus-remove {
    align-self: flex-start;
    background: none;
    border: 1px solid #e0a0a0;
    border-radius: 4px;
    color: #a83232;
    cursor: pointer;
    font-size: .78rem;
    padding: .25rem .6rem;
}
.mvo-edit-puhkus-remove:hover { background: #fdecec; }
.mvo-edit-puhkus-sep {
    border: none;
    border-top: 1px dashed #ddd;
    margin: .3rem 0 0;
}
.mvo-edit-puhkus-add {
    background: none;
    border: 1px dashed #185fa5;
    border-radius: 5px;
    color: #185fa5;
    cursor: pointer;
    font-size: .82rem;
    font-weight: 600;
    padding: .4rem .8rem;
    width: 100%;
}
.mvo-edit-puhkus-add:hover { background: #eaf2fa; }

.mvo-edit__status {
    color: #196f3d;
    font-size: .85rem;
}

@media (max-width: 640px) {
    .mvo-edit__rida { grid-template-columns: 1fr; }
}
/* ── Üksik ametnik [mv_ametnik] — tabelirea vaade ───────────── */
.mvo-wrap--single {
    margin: 0;
}

.mvo-wrap--single .mvo-tabel {
    border: 1px solid #eaecef;
    border-radius: 8px;
    overflow: hidden;
}

.mvo-single-editlink {
    color: #1a5276;
    display: inline-block;
    font-size: .82rem;
    margin-top: .5rem;
    text-decoration: none;
}

.mvo-single-editlink:hover {
    text-decoration: underline;
}

.mvo-single-error {
    background: #fdf3d0;
    border: 1px solid #f0c96b;
    border-radius: 6px;
    color: #7d6608;
    font-size: .88rem;
    padding: .7rem 1rem;
}
