/* /srv/tpult/app/cabinet/static/cabinet/css/main.css */
/* оформляет мобильный личный кабинет тПульт */

:root {
    --bg: #f5f7fc;
    --card: #ffffff;
    --text: #171923;
    --muted: #646b79;
    --accent: #315cff;
    --accent-dark: #2346c7;
    --border: #dfe4ef;
    --danger: #c62828;
    --radius: 24px;
    --shadow: 0 18px 48px rgba(21, 31, 61, 0.10);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    color: var(--text);
    background: var(--bg);
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: var(--accent);
}

.cabinet-container {
    width: min(760px, calc(100% - 24px));
    margin: 0 auto;
}


/* Header */

.cabinet-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--border);
    background: rgba(245, 247, 252, 0.94);
    backdrop-filter: blur(14px);
}

.header-inner {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cabinet-logo {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

.cabinet-logo img {
    display: block;
    width: auto;
    height: 42px;
    max-width: 180px;
}

.cabinet-footer-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--muted);
    background: transparent;
    text-decoration: none;
    font-size: 14px;
}

.cabinet-footer-link:hover {
    color: var(--accent);
    border-color: rgba(49, 92, 255, 0.35);
}

.header-account {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.header-phone {
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}

.header-account form {
    margin: 0;
}

.logout-button {
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 13px;
    color: var(--danger);
    background: #ffffff;
    font-weight: 700;
}


/* Main */

.cabinet-main {
    padding: 16px 0 38px;
}

.tariff-current-card {
    display: grid;
    width: 100%;
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    color: var(--text);
    background: var(--card);
    text-align: left;
}

.tariff-current-card span {
    color: var(--muted);
    font-size: 12px;
}

.tariff-current-card strong {
    margin-top: 2px;
    color: var(--accent);
    font-size: 19px;
}

.tariff-current-card small {
    margin-top: 3px;
    color: var(--muted);
}

.tariff-features {
    display: grid;
    gap: 10px;
    min-height: 150px;
    margin: 0 0 22px;
    padding: 0;
    list-style: none;
}

.tariff-features li {
    position: relative;
    padding-left: 28px;
    color: var(--muted);
    line-height: 1.5;
}

.tariff-features li::before {
    content: "✓";

    position: absolute;
    top: 0;
    left: 0;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 20px;
    height: 20px;

    border-radius: 50%;

    color: #ffffff;
    background: var(--accent);

    font-size: 12px;
    font-weight: 900;
}


@media (max-width: 620px) {
    .tariff-features {
        min-height: 0;
    }

    .tariff-features li {
        font-size: 15px;
    }
}


/* Yandex ads */

.yandex-ad {
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.yandex-ad > div {
    width: 100%;
    min-width: 0;
}

.yandex-ad-top {
    margin-bottom: 16px;
}

.yandex-ad-bottom {
    margin-top: 16px;
}


/* Gate selector */

.gate-selector-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--card);
}

.gate-select-wrapper {
    width: 100%;
}

.field-caption {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 13px;
}

.gate-select-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52px;
    gap: 8px;
}

.gate-select {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 15px;
    color: var(--text);
    background: #ffffff;
    font-size: 17px;
    font-weight: 700;
}

.add-gate-button {
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 15px;
    color: #ffffff;
    background: var(--accent);
    font-size: 31px;
    font-weight: 500;
    line-height: 1;
}

.add-gate-button:hover {
    background: var(--accent-dark);
}


/* Gate card */

.gate-main-card {
    margin-top: 16px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
}

.gate-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.gate-title-row h1 {
    margin: 0;
    font-size: 30px;
    letter-spacing: -0.05em;
}

.settings-button {
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--accent);
    background: #ffffff;
    font-weight: 700;
}

.gate-open-button {
    display: block;
    width: min(300px, 78vw);
    aspect-ratio: 1 / 1;
    margin: 34px auto 22px;
    padding: 24px;
    border: 0;
    border-radius: 50%;
    color: #ffffff;
    background: var(--accent);
    box-shadow:
        0 20px 50px rgba(49, 92, 255, 0.34),
        inset 0 -10px 24px rgba(0, 0, 0, 0.12);
    font-size: clamp(28px, 8vw, 46px);
    font-weight: 900;
    line-height: 1;
    word-break: break-word;
}

.gate-open-button:active {
    transform: scale(0.97);
}

.gate-hint {
    max-width: 500px;
    margin: 0 auto;
    color: var(--muted);
    text-align: center;
    line-height: 1.5;
}


/* Footer */

.cabinet-footer {
    padding: 0 0 28px;
}

.footer-inner {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.footer-inner button {
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--muted);
    background: transparent;
    font-size: 14px;
}

.footer-inner button:hover {
    color: var(--accent);
    border-color: rgba(49, 92, 255, 0.35);
}


/* Modals */

.modal[hidden] {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 15, 25, 0.64);
}

.modal-window {
    position: absolute;
    left: 50%;
    bottom: 16px;
    width: min(620px, calc(100% - 24px));
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    transform: translateX(-50%);
    padding: 24px;
    border-radius: 26px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: #f0f2f7;
    font-size: 27px;
}

.modal-window h2 {
    margin: 0 46px 20px 0;
    font-size: 28px;
    letter-spacing: -0.04em;
}

.modal-window h3 {
    margin: 24px 0 12px;
}

.document-modal p {
    color: var(--muted);
    line-height: 1.55;
}

.document-note {
    margin-top: 24px;
    padding: 14px;
    border-radius: 14px;
    background: #f5f7fc;
}


/* Tariffs */

.tariff-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.tariff-card {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 20px;
}

.tariff-card h3 {
    margin: 0 0 12px;
}

.tariff-price {
    margin-bottom: 12px;
    color: var(--accent);
    font-size: 32px;
    font-weight: 900;
}

.tariff-card p {
    min-height: 48px;
    color: var(--muted);
    line-height: 1.4;
}

.primary-button {
    min-height: 52px;
    width: 100%;
    padding: 0 18px;
    border: 0;
    border-radius: 15px;
    color: #ffffff;
    background: var(--accent);
    font-weight: 800;
}

.primary-button:hover {
    background: var(--accent-dark);
}

.promo-code-block {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.promo-code-block label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

.promo-code-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.promo-code-row input,
.settings-form input {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 15px;
}

.promo-code-row button {
    padding: 0 16px;
    border: 0;
    border-radius: 15px;
    color: #ffffff;
    background: var(--text);
    font-weight: 700;
}

.promo-code-block small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
}


/* Settings */

.settings-form {
    display: grid;
    gap: 16px;
}

.settings-form label {
    display: grid;
    gap: 8px;
    font-weight: 700;
}


/* Contacts and requisites */

.contact-links {
    display: grid;
    gap: 8px;
}

.contact-links a {
    display: flex;
    align-items: center;
    min-height: 50px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--accent);
    background: #ffffff;
    text-decoration: none;
    font-weight: 700;
}

.requisites-list {
    display: grid;
    gap: 1px;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--border);
}

.requisites-list div {
    padding: 12px 14px;
    background: #ffffff;
}

.requisites-list dt {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
}

.requisites-list dd {
    margin: 0;
    font-weight: 650;
    overflow-wrap: anywhere;
}


/* Mobile */

@media (max-width: 620px) {
    .header-inner {
        min-height: 60px;
    }

    .cabinet-logo img {
        height: 32px;
        max-width: 118px;
    }

    .header-account {
        gap: 5px;
    }

    .header-phone {
        max-width: 126px;
        overflow: hidden;
        font-size: 11px;
        text-overflow: ellipsis;
    }

    .logout-button {
        min-height: 36px;
        padding: 0 9px;
        border-radius: 11px;
        font-size: 12px;
    }

    .cabinet-main {
        padding-top: 12px;
    }

    .gate-selector-card {
        padding: 14px;
    }

    .gate-select-row {
        grid-template-columns: minmax(0, 1fr) 48px;
    }

    .gate-select {
        min-height: 48px;
        font-size: 16px;
    }

    .add-gate-button {
        width: 48px;
        height: 48px;
        font-size: 29px;
    }

    .gate-main-card {
        padding: 18px;
    }

    .gate-title-row h1 {
        font-size: 26px;
    }

    .settings-button {
        min-height: 42px;
        padding: 0 10px;
        font-size: 13px;
    }

    .gate-open-button {
        width: min(270px, 76vw);
        margin-top: 28px;
    }

    .footer-inner {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-inner button:last-child {
        grid-column: 1 / -1;
    }

    .modal-window {
        bottom: 0;
        width: 100%;
        max-height: 92vh;
        border-radius: 26px 26px 0 0;
    }

    .tariff-list {
        grid-template-columns: 1fr;
    }

    .tariff-card p {
        min-height: auto;
    }

    .promo-code-row {
        grid-template-columns: 1fr;
    }

    .promo-code-row button {
        min-height: 48px;
    }
}

/* How it works */

.cabinet-how-list {
    display: grid;
    gap: 12px;
}

.cabinet-how-step {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #ffffff;
}

.cabinet-how-step > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 15px;
    color: #ffffff;
    background: var(--accent);
    font-size: 19px;
    font-weight: 900;
}

.cabinet-how-step h3 {
    margin: 0 0 7px;
    font-size: 18px;
}

.cabinet-how-step p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}


@media (max-width: 620px) {
    .cabinet-how-step {
        grid-template-columns: 40px minmax(0, 1fr);
        gap: 11px;
        padding: 14px;
    }

    .cabinet-how-step > span {
        width: 40px;
        height: 40px;
        border-radius: 13px;
        font-size: 17px;
    }

    .cabinet-how-step h3 {
        font-size: 17px;
    }

    .cabinet-how-step p {
        font-size: 14px;
    }
}

.cabinet-messages {
    display: grid;
    gap: 10px;
    margin: 0 0 16px;
}

.cabinet-message {
    padding: 12px 14px;
    border-radius: 16px;
    background: #eef2ff;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.4;
}

.cabinet-message-success {
    background: #ecfdf5;
    color: #065f46;
}

.cabinet-message-warning {
    background: #fffbeb;
    color: #92400e;
}

.cabinet-message-error {
    background: #fef2f2;
    color: #991b1b;
}

.gate-service-number-card {
    display: grid;
    gap: 5px;
    margin: 18px 0 0;
    padding: 14px;
    border-radius: 18px;
    background: #f3f4f6;
}

.gate-service-number-card span {
    color: #6b7280;
    font-size: 13px;
    font-weight: 700;
}

.gate-service-number-card strong {
    color: #111827;
    font-size: 22px;
    line-height: 1.15;
}

.gate-service-number-card small {
    color: #4b5563;
    font-size: 13px;
    line-height: 1.35;
}

.gate-service-number-card-warning {
    background: #fffbeb;
}

.gate-service-number-card-warning strong {
    color: #92400e;
}

.gate-open-button:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.gate-open-status {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 16px;
    background: #f3f4f6;
    color: #374151;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.35;
    text-align: center;
}

.gate-open-status-pending {
    background: #eff6ff;
    color: #1d4ed8;
}

.gate-open-status-success {
    background: #ecfdf5;
    color: #047857;
}

.gate-open-status-warning {
    background: #fffbeb;
    color: #92400e;
}

.gate-open-status-error {
    background: #fef2f2;
    color: #b91c1c;
}

/* Gate phone validation */
.gate-phone-input-error {
    border-color: #c62828 !important;
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.12);
}

.gate-phone-input-error-text {
    display: block;
    margin-top: 6px;
    color: #c62828;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

/* Gate deletion */

.settings-danger-zone {
    display: grid;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.settings-danger-zone h3 {
    margin: 0;
    color: var(--danger);
    font-size: 17px;
}

.settings-danger-zone p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.settings-danger-zone form {
    margin: 0;
}

.delete-gate-button {
    width: 100%;
    min-height: 50px;
    padding: 0 16px;
    border: 1px solid rgba(198, 40, 40, 0.45);
    border-radius: 15px;
    color: var(--danger);
    background: #ffffff;
    font-weight: 800;
}

.delete-gate-button:hover {
    color: #ffffff;
    background: var(--danger);
}

@media (max-width: 620px) {
    .delete-gate-button {
        min-height: 54px;
    }
}

/* Styled gate deletion confirmation */

.delete-confirm-window {
    max-width: 480px;
    text-align: center;
}

.delete-confirm-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    color: #ffffff;
    background: var(--danger);
    font-size: 34px;
    font-weight: 900;
}

.delete-confirm-window h2 {
    margin: 0 44px 12px;
    text-align: center;
}

.delete-confirm-text {
    max-width: 380px;
    margin: 0 auto;
    color: var(--muted);
    line-height: 1.5;
}

.delete-confirm-device {
    margin: 18px 0 0;
    padding: 14px;
    border-radius: 16px;
    color: var(--text);
    background: #f5f7fc;
    font-size: 17px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.delete-confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 22px;
}

.delete-confirm-cancel,
.delete-confirm-submit {
    min-height: 52px;
    padding: 0 16px;
    border-radius: 15px;
    font-weight: 800;
}

.delete-confirm-cancel {
    border: 1px solid var(--border);
    color: var(--text);
    background: #ffffff;
}

.delete-confirm-submit {
    border: 0;
    color: #ffffff;
    background: var(--danger);
}

.delete-confirm-submit:disabled {
    cursor: wait;
    opacity: 0.65;
}

@media (max-width: 620px) {
    .delete-confirm-window {
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }

    .delete-confirm-actions {
        grid-template-columns: 1fr;
    }

    .delete-confirm-submit {
        order: -1;
        min-height: 56px;
    }

    .delete-confirm-cancel {
        min-height: 52px;
    }
}

/* Delete confirmation click-through protection */

#delete-gate-confirm-modal {
    z-index: 220;
    touch-action: manipulation;
}

#delete-gate-confirm-modal .modal-backdrop {
    z-index: 0;
}

#delete-gate-confirm-modal .delete-confirm-window {
    z-index: 1;
}

.delete-confirm-submit:disabled {
    pointer-events: none;
    cursor: wait;
    opacity: 0.5;
}

.delete-gate-button,
.delete-confirm-submit,
.delete-confirm-cancel {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}


/* Delete confirmation device label */

.delete-confirm-device {
    position: relative;
    display: grid;
    gap: 4px;
    margin: 20px 0 0;
    padding: 14px 0 2px 18px;
    border-radius: 0;
    color: var(--text);
    background: transparent;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.3;
    text-align: left;
    overflow-wrap: anywhere;
}

.delete-confirm-device::before {
    content: "";
    position: absolute;
    top: 12px;
    bottom: 0;
    left: 0;
    width: 4px;
    border-radius: 4px;
    background: var(--danger);
}

.delete-confirm-device::after {
    content: "Удаляемое устройство";
    order: -1;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

@media (max-width: 620px) {
    .delete-confirm-device {
        margin-top: 18px;
        padding-left: 16px;
        font-size: 17px;
    }
}
