/* =====================================================
   ADMIN ESZKÖZSZERKESZTŐ
   - Eszköz alapadatok szerkesztőfelülete
   - Helyszínkeresés és koordináta mezők
   - Feature választó táblázat
   - Eszköz műveleti gombok
   - Eszköztörlés megerősítő modal
   - Firmware-kezelő felület
   - Reszponzív eszközszerkesztő elrendezés
===================================================== */

.admin-device-edit-modal,
.admin-device-create-modal {
    width: min(88vw, 1180px);
    min-width: 720px;
}

.admin-device-edit-subtitle {
    margin-top: 3px;
    color: #7f919b;
    font-size: 12px;
}

.admin-device-edit-section {
    padding: 18px;
    border: 1px solid #1d303b;
    border-radius: 8px;
    background: #08141b;
}

.admin-device-edit-section + .admin-device-edit-section {
    margin-top: 18px;
}

.admin-device-edit-section-title {
    margin-bottom: 14px;
    color: #edf3f7;
    font-size: 15px;
    font-weight: 700;
}

.admin-device-edit-firmware-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px;
    gap: 12px;
    align-items: end;
}

.admin-device-edit-compile-btn,
.admin-device-edit-fw-action-btn,
.admin-device-edit-key-btn {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid #314654;
    border-radius: 6px;
    background: #172734;
    color: #eef4f7;
    font-size: 12px;
    font-weight: 650;
}

.admin-device-edit-compile-btn:disabled,
.admin-device-edit-fw-action-btn:disabled,
.admin-device-edit-key-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.admin-device-edit-note {
    margin-top: 12px;
}

.admin-device-edit-note textarea {
    width: 100%;
    min-height: 78px;
    resize: vertical;
    padding: 10px 12px;
    box-sizing: border-box;
    border: 1px solid #1f3440;
    border-radius: 6px;
    outline: none;
    background: #071219;
    color: #eef4f7;
    font: inherit;
}

.admin-device-edit-key-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 130px;
    gap: 10px;
    margin-top: 12px;
    align-items: end;
}

.admin-device-edit-fw-table {
    margin-top: 14px;
    overflow: hidden;
    border: 1px solid #1d303b;
    border-radius: 7px;
}

.admin-device-edit-fw-grid {
    display: grid;
    grid-template-columns: 1.1fr 150px 1.4fr;
    align-items: center;
}

.admin-device-edit-fw-head {
    min-height: 40px;
    background: #16232c;
    color: #aebbc3;
    font-size: 12px;
    font-weight: 650;
}

.admin-device-edit-fw-head > div,
.admin-device-edit-fw-row > div {
    padding: 10px 12px;
    box-sizing: border-box;
}

.admin-device-edit-fw-row {
    min-height: 58px;
    border-top: 1px solid #13242e;
    color: #8fa0aa;
    font-size: 12px;
}

.admin-device-edit-fw-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}


/* =====================================================
   ESZKOZ ALAPADATOK - KOMPAKT KETOLDALAS ELRENDEZES
   Bal oldal:
   - ESP32 Vezerlo + Eszkoz neve
   - Telepites datuma + Licenc

   Jobb oldal:
   - Helyszin teljes szelessegen
   - Szelesseg + Hosszusag
   - Alaprelek a jobb oldal 1/4 szelessegeben
===================================================== */

.admin-device-edit-basic-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.admin-device-edit-basic-left {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
    min-width: 0;
}

.admin-device-edit-basic-right {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 12px;
    align-items: start;
    min-width: 0;
}

.admin-device-edit-basic-grid .admin-create-field,
.admin-device-edit-basic-left .admin-create-field,
.admin-device-edit-basic-right .admin-create-field {
    min-width: 0;
}

.admin-device-edit-location-field {
    grid-column: 1 / -1;
    min-width: 0;
}

.admin-device-edit-latitude-field {
    grid-column: 1 / 3;
}

.admin-device-edit-longitude-field {
    grid-column: 3 / 5;
}

.admin-device-edit-base-relays-field {
    grid-column: 1 / 2;
}

.admin-device-edit-vfd-field {
    grid-column: 2 / 5;
    min-width: 0;
}

/* =====================================================
   DEVICE CREATE + DEVICE EDIT KOZOS ELRENDEZES
   A Create ugyanazt a meretet es vizualis ritmust hasznalja,
   mint a Device Edit. A generic .admin-create-modal tovabbra is
   hasznalhato az Ugyfel/Admin letrehozo ablakokhoz.
===================================================== */

.admin-device-create-main-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.admin-device-create-left {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
    min-width: 0;
}

.admin-device-create-right {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 12px;
    align-items: start;
    min-width: 0;
}

.admin-device-create-left .admin-create-field,
.admin-device-create-right .admin-create-field {
    min-width: 0;
}

.admin-device-create-location-wrap {
    position: relative;
}

.admin-device-create-location-field {
    grid-column: 1 / -1;
    min-width: 0;
}

.admin-device-create-latitude-field {
    grid-column: 1 / 3;
}

.admin-device-create-longitude-field {
    grid-column: 3 / 5;
}

.admin-device-create-base-relays-field {
    grid-column: 1 / 2;
}

.admin-device-create-vfd-field {
    grid-column: 2 / 5;
    min-width: 0;
}

.admin-device-create-vfd-field select.admin-create-input {
    width: 100%;
    cursor: pointer;
}

.admin-device-create-feature-title {
    margin-top: 14px;
    margin-bottom: 8px;
    color: #bdc9cf;
    font-size: 13px;
    font-weight: 600;
}

.admin-device-create-feature-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 8px;
    background: transparent;
}

.admin-device-create-feature-cell {
    min-width: 0;
    display: grid;
    grid-template-rows: 42px 42px;
    overflow: hidden;
    border: 1px solid #263943;
    border-radius: 5px;
    background: #09151d;
    box-sizing: border-box;
}

.admin-device-create-feature-head {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 8px;
    border-bottom: 1px solid #263943;
    background: #17242d;
    color: #bdc9cf;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    box-sizing: border-box;
}

.admin-device-create-feature-check {
    position: relative;
    width: 100%;
    height: 42px;
    margin: 0;
    padding: 0;
    background: #0a151d;
    cursor: pointer;
}

.admin-device-create-feature-check input[type="checkbox"] {
    position: absolute;
    left: 50%;
    top: calc(50% - 4px);
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    transform: translate(-50%, -50%);
    cursor: pointer;
}

.admin-device-edit-readonly {
    opacity: 0.78;
}

.admin-device-edit-vfd-field select.admin-create-input {
    width: 100%;
    cursor: pointer;
}

.admin-device-edit-location-wrap {
    position: relative;
}

.admin-device-edit-location-results {
    position: absolute;
    z-index: 40;
    left: 0;
    right: 0;
    top: calc(100% - 2px);
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #2a3d49;
    border-radius: 6px;
    background: #0d1a22;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.admin-device-edit-location-result {
    width: 100%;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    border: 0;
    border-bottom: 1px solid #1a2a34;
    background: transparent;
    color: #e5edf1;
    text-align: left;
    cursor: pointer;
}

.admin-device-edit-location-result:hover,
.admin-device-edit-location-result.is-keyboard-active {
    background: #123044;
}

.admin-device-edit-location-label {
    font-size: 13px;
    font-weight: 600;
}

.admin-device-edit-location-coord,
.admin-device-edit-location-source {
    color: #81919a;
    font-size: 10px;
}

.admin-device-edit-location-source {
    margin-top: 4px;
}

.admin-device-edit-feature-title {
    margin-top: 14px;
    margin-bottom: 8px;
    color: #bdc9cf;
    font-size: 13px;
    font-weight: 600;
}

/* ChP: ezt az igazítást nem valtoztatjuk. */
.admin-device-edit-feature-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 8px;
}

.admin-device-edit-feature-cell {
    min-width: 0;
    display: grid;
    grid-template-rows: 42px 42px;
    overflow: hidden;
    border: 1px solid #263943;
    border-radius: 5px;
    background: #09151d;
    box-sizing: border-box;
}

.admin-device-edit-feature-head {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border-bottom: 1px solid #263943;
    background: #17242d;
    color: #bdc9cf;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    box-sizing: border-box;
}

.admin-device-edit-feature-check {
    position: relative;
    width: 100%;
    height: 42px;
    margin: 0;
    padding: 0;
}

.admin-device-edit-feature-check input[type="checkbox"] {
    position: absolute;
    left: 50%;
    top: calc(50% - 4px);
    width: 16px;
    height: 16px;
    margin: 0;
    transform: translate(-50%, -50%);
}

.admin-device-edit-general-error {
    margin-top: 10px;
    min-height: 15px;
    color: #e37b7b;
    font-size: 12px;
}

.admin-device-edit-section-actions {
    margin-top: 16px;
    padding-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-top: 1px solid #1c2d37;
}

.admin-device-edit-feature-actions,
.admin-device-edit-main-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-device-edit-feature-actions {
    justify-content: flex-start;
}

.admin-device-edit-main-actions {
    justify-content: flex-end;
}

.admin-device-feature-bulk-btn {
    min-width: 132px;
    min-height: 40px;
    padding: 5px 14px;
    border: 1px solid #314654;
    border-radius: 6px;
    background: #172734;
    color: #eef4f7;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.15;
    text-align: center;
    cursor: pointer;
    white-space: nowrap;
    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.admin-device-feature-bulk-on {
    border-color: #2f7855;
    background: #173b2b;
    color: #dff7e9;
}

.admin-device-feature-bulk-on:hover {
    background: #1d4c36;
    border-color: #3e9a6c;
}

.admin-device-feature-bulk-off {
    border-color: #7b373c;
    background: #30171a;
    color: #ec969d;
}

.admin-device-feature-bulk-off:hover {
    background: #421d21;
    border-color: #9a454c;
}

.admin-device-edit-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: 100%;
}

.admin-device-delete-open-btn {
    min-width: 112px;
    min-height: 42px;
    padding: 5px 16px 4px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    border: 1px solid #7b373c;
    border-radius: 6px;
    background: #30171a;
    color: #ec969d;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.admin-device-delete-open-btn:hover:not(:disabled) {
    background: #421d21;
    border-color: #9a454c;
}

.admin-device-delete-open-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    filter: grayscale(0.25);
}

.admin-device-edit-action-danger {
    min-height: 40px;
    flex-direction: row;
    padding: 0 16px;
}

.admin-device-suspend-btn {
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid #7b652a;
    border-radius: 6px;
    background: #302711;
    color: #edcf75;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
}

.admin-device-suspend-btn:hover:not(:disabled) {
    background: #433716;
    border-color: #9a8138;
}

.admin-device-suspend-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.admin-device-delete-overlay {
    position: fixed;
    inset: 0;
    z-index: 7100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    background: rgba(1, 7, 11, 0.78);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.admin-device-delete-overlay.visible { opacity: 1; }

.admin-device-delete-modal {
    width: min(560px, 94vw);
    max-height: calc(100vh - 48px);
    overflow: auto;
    border: 1px solid #56373a;
    border-radius: 10px;
    background: #0a151d;
    box-shadow: 0 24px 70px rgba(0,0,0,0.55);
    color: #edf3f7;
}

.admin-device-delete-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 22px;
    border-bottom: 1px solid #38282c;
    background: #1b1115;
}

.admin-device-delete-header h2 {
    margin: 0;
    font-size: 20px;
    color: #f6ecee;
}

.admin-device-delete-icon { font-size: 25px; }

.admin-device-delete-subtitle {
    margin-top: 3px;
    color: #c9aeb2;
    font-size: 13px;
}

.admin-device-delete-body { padding: 22px; }

.admin-device-delete-warning {
    padding: 13px 14px;
    border: 1px solid #62343b;
    border-radius: 7px;
    background: #261419;
    color: #efb5bc;
    font-size: 13px;
    line-height: 1.45;
}

.admin-device-delete-warning strong { color: #ffe9eb; }

.admin-device-delete-accept {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    margin: 18px 0;
    color: #e1e8ec;
    font-size: 13px;
    cursor: pointer;
}

.admin-device-delete-accept input[type="checkbox"] {
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    flex: 0 0 auto;
}

.admin-device-delete-password-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-device-delete-password-field > span {
    color: #bdc9cf;
    font-size: 13px;
    font-weight: 600;
}

.admin-device-delete-password {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid #1f3440;
    border-radius: 6px;
    outline: none;
    box-sizing: border-box;
    background: #071219;
    color: #eef4f7;
    font-size: 14px;
}

.admin-device-delete-password:focus {
    border-color: #247eb9;
    box-shadow: 0 0 0 2px rgba(36,126,185,0.12);
}

.admin-device-delete-password.is-invalid {
    border-color: #b24b55;
    box-shadow: 0 0 0 2px rgba(178,75,85,0.12);
}

.admin-device-delete-password-error {
    min-height: 17px;
    color: #ef848d;
    font-size: 12px;
}

.admin-device-delete-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 17px 22px 20px;
    border-top: 1px solid #1c2d37;
    background: #09141b;
}

.admin-device-delete-confirm-btn,
.admin-device-delete-cancel-btn {
    min-width: 106px;
    min-height: 40px;
    padding: 0 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}

.admin-device-delete-confirm-btn {
    border: 1px solid #86424a;
    background: #4a1f25;
    color: #ffe9eb;
}

.admin-device-delete-confirm-btn:hover:not(:disabled) {
    background: #642932;
    border-color: #a9545f;
}

.admin-device-delete-confirm-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    filter: grayscale(0.25);
}

.admin-device-delete-cancel-btn {
    border: 1px solid #715b2c;
    background: #2d2515;
    color: #f1d68d;
}

.admin-device-delete-cancel-btn:hover {
    background: #3a301b;
    border-color: #8c7138;
}

@media (max-width: 900px) {
    .admin-device-edit-modal,
    .admin-device-create-modal {
        width: min(96vw, 900px);
        min-width: 0;
    }

    .admin-device-edit-feature-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .admin-device-create-feature-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .admin-device-create-main-grid {
        grid-template-columns: 1fr;
    }

    .admin-device-create-left {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-device-create-right {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .admin-device-create-feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-device-edit-firmware-top,
    .admin-device-edit-key-row,
    .admin-device-edit-basic-grid {
        grid-template-columns: 1fr;
    }

    .admin-device-edit-basic-left {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-device-edit-basic-right {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
.admin-device-edit-feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
.admin-device-edit-section-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-device-edit-feature-actions,
    .admin-device-edit-main-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .admin-device-edit-feature-actions {
        justify-content: flex-start;
    }

    .admin-device-edit-main-actions {
        justify-content: flex-end;
    }

    .admin-device-edit-fw-table {
        overflow-x: auto;
    }

    .admin-device-edit-fw-grid {
        min-width: 660px;
    }
}


@media (max-width: 460px) {
    .admin-device-edit-basic-left {
        grid-template-columns: 1fr;
    }

    .admin-device-edit-basic-right {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-device-edit-location-field {
        grid-column: 1 / -1;
    }

    .admin-device-edit-latitude-field,
    .admin-device-edit-longitude-field {
        grid-column: auto;
    }

    .admin-device-edit-base-relays-field {
        grid-column: 1 / 2;
    }

    .admin-device-edit-vfd-field {
        grid-column: 2 / -1;
    }
}


@media (max-width: 460px) {
    .admin-device-create-left {
        grid-template-columns: 1fr;
    }

    .admin-device-create-right {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-device-create-location-field {
        grid-column: 1 / -1;
    }

    .admin-device-create-latitude-field,
    .admin-device-create-longitude-field {
        grid-column: auto;
    }

    .admin-device-create-base-relays-field {
        grid-column: 1 / 2;
    }

    .admin-device-create-vfd-field {
        grid-column: 2 / -1;
    }
}
