/* ==========================================================
   ADMIN
========================================================== */

.app {
    width: min(100%, clamp(596px, 86vw, 880px));
    box-sizing: border-box;
    margin: 0 auto;
    padding: 22px 18px 100px;
}

.admin-card {
    width: 100%;
    max-width: 760px;
    box-sizing: border-box;
    margin: 24px auto 0;
    background: var(--surface);
    border-radius: 24px;
    padding: clamp(18px, 4vw, 28px);
    border: 1px solid rgba(255, 255, 255, .06);
}

.moderation-lock-notice {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 20px;
    box-sizing: border-box;
    background: rgba(4, 6, 12, 0);
    opacity: 0;
    transition: background .16s ease, opacity .16s ease;
}

.moderation-lock-notice.is-visible {
    background: rgba(4, 6, 12, .45);
    opacity: 1;
}

.moderation-lock-notice-card {
    width: min(100%, 360px);
    padding: 20px;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 18px 46px rgba(0, 0, 0, .34);
}

.moderation-lock-notice-card p {
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.45;
    text-align: center;
}

.moderation-lock-notice-card button {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.admin-grid > * {
    min-width: 0;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.field.full {
    grid-column: 1/-1;
}

.field label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
    line-height: 1.3;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    max-width: 100%;
    background: var(--surface-2);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 14px;
    color: var(--text);
    min-height: 48px;
    box-sizing: border-box;
    padding: 11px 14px;
    font-size: 16px;
    outline: none;
    transition: .2s;
    font-family: inherit;
}

.field input[type="date"],
.field input[type="time"] {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    inline-size: 100%;
    -webkit-appearance: none;
    appearance: none;
}

.field input[type="date"]::-webkit-date-and-time-value,
.field input[type="time"]::-webkit-date-and-time-value,
.field input[type="date"]::-webkit-datetime-edit,
.field input[type="time"]::-webkit-datetime-edit {
    min-width: 0;
    text-align: left;
}

.field textarea {
    resize: vertical;
    min-height: 108px;
}

.time-mode {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
}

.radio-option input {
    appearance: none;
    width: 17px;
    height: 17px;
    min-height: 17px;
    flex: 0 0 17px;
    margin: 0;
    padding: 0;
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    background: transparent;
}

.radio-option input:checked {
    border-color: var(--primary);
    background: radial-gradient(circle, var(--primary) 0 45%, transparent 48%);
}

.radio-option:has(input:checked) {
    border-color: rgba(255, 175, 119, .65);
    background: rgba(255, 175, 119, .12);
    color: var(--text);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 175, 119, .2);
}

.telegram-username-input {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 14px;
    background: var(--surface-2);
}

.telegram-username-input > span {
    flex: 0 0 auto;
    padding-left: 14px;
    color: var(--text-secondary);
    font-size: 15px;
    white-space: nowrap;
}

.field .telegram-username-input input {
    min-width: 0;
    min-height: 46px;
    padding-left: 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.telegram-username-input:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 175, 119, .2);
}

.field-hint {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.35;
}

.primary-btn {
    margin-top: 14px;
    width: 100%;
    border: none;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #3d2518;
    font-size: 16px;
    font-weight: 700;
    padding: 16px;
    cursor: pointer;
    transition: .2s;
}

.primary-btn:hover {
    transform: translateY(-2px);
}

/* ==========================================================
   ADMIN PANEL
   ========================================================== */

.admin-actions {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    margin-bottom: 0;
}

#createEventBtn {

    width: 100%;

    border: none;

    border-radius: 18px;

    padding: 16px;

    background: linear-gradient(135deg,
            #ffaf77,
            #e9894a);

    color: #3d2518;

    font-weight: 700;

    cursor: pointer;

    box-shadow:

        0 10px 25px rgba(255, 145, 77, .30);

    transition: .25s;

}

#createEventBtn:hover {

    transform: translateY(-3px);

}

#adminEvents {

    display: flex;

    flex-direction: column;

    gap: 16px;

}

/* ==========================================================
   SETTINGS
   ========================================================== */

.settings h2 {
    margin: 0 0 16px;
}

.settings > h2 {
    text-align: center;
}

.map-picker {
    width: min(100%, 390px);
}

.map-picker-hint {
    margin: 0 0 14px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
}

.map-picker.is-map-preferences > h2 {
    margin: 0;
    text-align: left;
}

.map-picker.is-map-preferences .map-picker-hint {
    margin: 6px 0 16px;
    text-align: left;
}

.map-service-choices {
    display: grid;
    gap: 9px;
}

.map-service-choices .primary-button {
    width: 100%;
    min-height: 46px;
}

.map-service-choices .map-preference-button {
    justify-content: space-between;
    padding-right: 15px;
}

.map-service-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    box-sizing: border-box;
    border: 1px solid rgba(232, 238, 255, .64);
    border-radius: 5px;
    color: transparent;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
}

.map-preference-button.is-selected .map-service-check {
    border-color: var(--primary);
    background: var(--primary);
    color: #191b27;
}

.map-service-choices .primary-button.is-selected {
    border-color: rgba(255, 175, 119, .7);
    background: rgba(255, 175, 119, .14);
}

.map-memory-choice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}

.map-memory-choice input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.setting-row {

    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 20px;

}

@media(max-width:700px) {

    .admin-grid {
        grid-template-columns: 1fr;
    }

    .time-mode {
        grid-template-columns: 1fr 1fr;
    }

    .proposal-modal-card {
        border-radius: 22px;
    }

}

@media (min-width: 600px) {
    .app {
        padding: 30px clamp(24px, 4vw, 36px) 120px;
    }

    .admin-card {
        padding: clamp(24px, 4vw, 34px);
    }

    .field label,
    .field-hint {
        font-size: 15px;
    }

    .field input,
    .field select,
    .field textarea {
        min-height: 54px;
        padding: 13px 16px;
        font-size: 18px;
    }

    .field textarea {
        min-height: 132px;
    }

    .primary-btn,
    .secondary-button,
    .settings .primary-button {
        min-height: 54px;
        font-size: 17px;
    }
}

.secondary-button {
    width: 100%;
    margin-top: 0;
    min-height: 50px;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.suggestion-preview {
    width: 100%;
    box-sizing: border-box;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-2);
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.suggestion-preview strong,
.suggestion-preview span {
    display: block;
}

.admin-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 42px;
    margin: 0 0 10px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.admin-topbar {
    display: block;
}

.admin-topbar .title-block h1 {
    font-size: 27px;
}

.admin-topbar .title-block p:empty {
    display: none;
}

.route-transition {
    position: fixed;
    inset: 0;
    z-index: 1100;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    background: var(--bg);
    transition: opacity .18s ease, visibility 0s linear .18s;
}

html.route-transition-pending .route-transition,
.route-transition.is-active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition: opacity .18s ease;
}

.route-transition.is-revealing {
    visibility: visible;
    opacity: 0;
    pointer-events: auto;
    transition: opacity .22s ease;
}

.admin-topbar + .admin-card {
    margin-top: 12px;
}

.admin-back svg {
    width: 19px;
    height: 19px;
}

.statistics-heading h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
}

.statistics-heading p {
    margin: 4px 0 14px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
}

.statistics-periods {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border-radius: 14px;
    background: var(--surface-2);
}

.statistics-period {
    min-height: 36px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.statistics-period.is-active {
    background: var(--primary);
    color: #3d2518;
    box-shadow: var(--shadow);
}

.statistics-period:disabled {
    cursor: default;
    opacity: .5;
}

.statistics-date {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 24px;
    align-items: center;
    gap: 8px;
    margin: 18px 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

.statistics-date-nav {
    display: grid;
    place-items: center;
    width: 28px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.statistics-date-nav:disabled {
    opacity: .35;
    cursor: default;
}

.statistics-date-control {
    position: relative;
    display: block;
    min-width: 0;
    cursor: pointer;
}

.statistics-date-control span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.statistics-date-control input {
    position: absolute;
    inset: 0;
    width: 100%;
    opacity: 0;
    cursor: pointer;
}

.statistics-date svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.statistics-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.statistics-metric {
    min-height: 104px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-2);
}

.statistics-metric span {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.3;
}

.statistics-metric strong {
    display: block;
    margin-top: 12px;
    color: var(--text);
    font-size: 25px;
    line-height: 1;
}

.statistics-popular {
    margin-top: 24px;
}

.statistics-popular h3 {
    margin: 0;
    font-size: 17px;
}

.statistics-popular p {
    margin: 10px 0 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
}

.statistics-table {
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
}

.statistics-row {
    display: grid;
    grid-template-columns: minmax(105px, 1.25fr) repeat(3, minmax(0, 1fr));
    align-items: center;
    min-height: 58px;
    border-top: 1px solid var(--border);
}

.statistics-row:first-child {
    border-top: 0;
}

.statistics-row > * {
    min-width: 0;
    padding: 10px 8px;
    text-align: center;
}

.statistics-row > :first-child {
    color: var(--text-secondary);
    text-align: left;
}

.statistics-header {
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.statistics-row strong {
    color: var(--text);
    font-size: 20px;
    font-weight: 700;
}

.suggestion-preview span {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 14px;
}

.field input.has-error,
.field select.has-error,
.field textarea.has-error {
    border-color: #ef5b68;
}

.field-error {
    min-height: 0;
    color: #ff8e98;
    font-size: 12px;
}

.field-error:not(:empty) {
    margin-top: 2px;
}

.proposal-modal-card {
    width: min(100%, 620px);
    box-sizing: border-box;
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    padding: 18px clamp(16px, 4vw, 28px) max(22px, env(safe-area-inset-bottom));
}

.proposal-modal-card h2 {
    margin: 0 0 8px;
    line-height: 1.2;
}

.proposal-form-hint,
.proposal-feedback {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.45;
}

.proposal-form {
    margin-top: 16px;
}

.proposal-modal-card .close-button {
    position: sticky;
    top: -8px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: -8px -8px 4px auto;
    font-size: 24px;
    line-height: 1;
}

.proposal-form .field.full:last-child {
    gap: 0;
}

.proposal-form .primary-btn {
    margin-top: 10px;
}

.admin-actions .primary-btn {
    margin-top: 0;
}

.settings {
    width: min(100%, 420px);
    box-sizing: border-box;
    padding: 22px;
}

.settings .setting-row + .setting-row {
    margin-top: 10px;
}

.settings .primary-button {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-2);
}

.support-menu p {
    margin: 0 0 16px;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
}

.support-menu svg {
    width: 21px;
    height: 21px;
}

#supportHeartIcon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

#supportHeartIcon svg {
    display: block;
}

.proposal-feedback.is-success {
    color: #6fda94;
}

.proposal-feedback.is-error {
    color: #ff8e98;
}

.optional-label {
    color: var(--text-secondary);
    font-weight: 400;
}

.form-actions {
    display: grid;
    gap: 10px;
    width: 100%;
    margin-top: 14px;
}

.form-actions .primary-btn {
    margin-top: 0;
}

.draft-delete-button {
    width: 100%;
    min-height: 48px;
    border: 1px solid rgba(239, 91, 104, .45);
    border-radius: 16px;
    background: rgba(239, 91, 104, .12);
    color: #ff9da5;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.form-actions .secondary-button,
.form-actions .draft-delete-button {
    min-height: 48px;
    padding: 13px 16px;
    border-radius: 16px;
}

.publish-event-button {
    width: 100%;
    min-height: 48px;
    border: 1px solid rgba(111, 218, 148, .48);
    border-radius: 16px;
    background: rgba(111, 218, 148, .12);
    color: #91e7ad;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.inline-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    margin: 0 0 12px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.inline-back svg {
    width: 18px;
    height: 18px;
}

.drafts-modal-card {
    width: min(100%, 520px);
    box-sizing: border-box;
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    padding: 18px clamp(16px, 4vw, 28px) max(22px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    min-height: min(460px, calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 40px));
}

.drafts-heading h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
}

.drafts-heading p {
    margin: 6px 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
}

.drafts-count {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
}

.drafts-list,
.admin-page-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.drafts-list {
    flex: 1;
    min-height: 220px;
}

.drafts-list > .drafts-empty,
.admin-page-list > .drafts-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    margin: 0;
    padding: 24px 8px;
    text-align: center;
    font-size: 15px;
}

.draft-preview {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 15px 16px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: var(--surface-2);
    color: var(--text);
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.draft-preview strong,
.draft-preview span {
    display: block;
}

.draft-preview span {
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 13px;
}

.swipe-row {
    --swipe-radius: 17px;
    position: relative;
    overflow: hidden;
    border-radius: var(--swipe-radius);
    touch-action: pan-y;
    isolation: isolate;
}

.swipe-row--event {
    --swipe-radius: 20px;
}

.swipe-content {
    position: relative;
    z-index: 1;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border-radius: inherit;
    transition: transform .2s ease;
    will-change: transform;
}

.swipe-row.is-open .swipe-content {
    transform: translateX(-76px);
}

.swipe-delete {
    position: absolute;
    inset: 0 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    z-index: 0;
    border: 0;
    background: #d64045;
    color: #fff;
    pointer-events: none;
    visibility: hidden;
    cursor: pointer;
}

.swipe-row.is-revealing .swipe-delete,
.swipe-row.is-open .swipe-delete {
    visibility: visible;
}

.swipe-content > .event-preview,
.swipe-content > .draft-preview {
    border-radius: var(--swipe-radius);
    transition: border-radius .2s ease, transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.swipe-row.is-revealing .swipe-content > .event-preview,
.swipe-row.is-revealing .swipe-content > .draft-preview,
.swipe-row.is-open .swipe-content > .event-preview,
.swipe-row.is-open .swipe-content > .draft-preview {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.swipe-row.is-open .swipe-delete {
    pointer-events: auto;
}

.swipe-delete svg {
    width: 28px;
    height: 28px;
}

.swipe-content .event-preview:hover {
    transform: none;
    border-color: rgba(255, 255, 255, .08);
    box-shadow: none;
}

.swipe-content .event-preview:hover img {
    transform: none;
}

.swipe-content .event-preview:hover .event-preview-title {
    color: var(--text);
}

.admin-view-list {
    display: flex;
    flex-direction: column;
    max-width: 560px;
    min-height: calc(100dvh - 150px);
    margin-top: 0;
    padding: 0;
    background: transparent;
    border: 0;
}

.admin-page-title {
    padding: clamp(18px, 4vw, 28px);
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 24px;
    background: var(--surface);
}

.admin-page-title h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
}

.admin-page-title p,
.drafts-empty {
    margin: 8px 0 0;
    color: var(--text-secondary);
    line-height: 1.45;
}

.admin-view-list > .admin-page-list {
    margin-top: 14px;
}

.admin-view-list.drafts-page .admin-page-title {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.admin-view-list.suggestions-page .admin-page-title {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

@media (prefers-reduced-motion: reduce) {
    .route-transition,
    .swipe-content,
    .swipe-content > .event-preview,
    .swipe-content > .draft-preview {
        animation-duration: .01ms;
        transition-duration: .01ms;
    }
}
