/* Bot links: Telegram/WhatsApp publishing workspace */
.bot-links-page {
    max-width: 1440px;
    margin: 0 auto;
}

.bot-links-header {
    align-items: flex-end;
    margin-bottom: 24px;
}

.bot-links-header h1 {
    margin: 11px 0 8px;
}

.bot-links-header p {
    max-width: 680px;
    margin: 0;
}

.bot-links-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.bot-link-generator,
.bot-links-published-section {
    margin-bottom: 30px;
}

.bot-link-generator {
    padding: 28px;
}

.bot-link-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.bot-link-section-heading h2 {
    margin: 8px 0 0;
    color: var(--brand-dark);
    font-size: 23px;
}

.bot-link-section-heading p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.bot-link-section-mark {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    place-items: center;
    border: 1px solid rgba(240, 90, 65, .24);
    border-radius: 15px;
    background: var(--coral-soft);
    color: var(--brand-accent);
}

.bot-link-section-mark svg {
    width: 21px;
    height: 21px;
}

.bot-link-generator-form {
    display: grid;
    grid-template-columns: minmax(190px, .9fr) minmax(190px, .9fr) minmax(260px, 1.2fr);
    gap: 16px;
    align-items: start;
}

.bot-link-generator-form .field {
    margin: 0;
}

.bot-link-generator-form textarea {
    min-height: 48px;
    resize: vertical;
}

.bot-link-generator-form small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

.bot-link-message-field {
    grid-row: span 2;
}

.bot-link-message-field textarea {
    min-height: 120px;
}

.bot-link-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    grid-column: 1 / -1;
    gap: 16px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.bot-link-form-actions > span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 11px;
}

.bot-link-form-actions > span svg {
    width: 16px;
    height: 16px;
    color: #15803d;
}

.bot-links-published-section {
    padding: 26px;
    border: 1px solid rgba(6, 59, 47, .08);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, .46);
}

.bot-links-published-heading {
    margin-bottom: 18px;
}

.bot-links-published-heading .badge {
    flex-shrink: 0;
}

.bot-links-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.bot-link-card {
    display: flex;
    min-width: 0;
    padding: 20px;
    flex-direction: column;
}

.bot-link-card-top,
.bot-link-card-title,
.bot-link-card-meta,
.bot-link-card-actions,
.bot-link-url-row {
    display: flex;
    align-items: center;
}

.bot-link-card-top,
.bot-link-card-title {
    justify-content: space-between;
    gap: 12px;
}

.bot-link-type,
.bot-link-published {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.bot-link-type {
    padding: 6px 9px;
    border-radius: 999px;
}

.bot-link-type.is-telegram {
    background: rgba(217, 119, 6, .12);
    color: #a16207;
}

.bot-link-type.is-whatsapp {
    background: rgba(22, 163, 74, .12);
    color: #15803d;
}

.bot-link-type svg,
.bot-link-published svg {
    width: 14px;
    height: 14px;
}

.bot-link-published {
    color: #15803d;
    text-transform: none;
}

.bot-link-published .status-dot {
    width: 7px;
    height: 7px;
    margin: 0;
    background: #16a34a;
}

.bot-link-card-title {
    align-items: flex-start;
    margin: 20px 0 16px;
}

.bot-link-card-title h3 {
    overflow: hidden;
    margin: 0;
    color: var(--brand-dark);
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bot-link-card-title p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.bot-link-card-title code {
    color: var(--brand-accent);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.bot-link-card-icon {
    display: grid;
    width: 37px;
    height: 37px;
    flex: 0 0 37px;
    place-items: center;
    border-radius: 12px;
    background: var(--coral-soft);
    color: var(--brand-accent);
}

.bot-link-card-icon svg {
    width: 18px;
    height: 18px;
}

.bot-link-url-label {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.bot-link-url-row {
    gap: 8px;
}

.bot-link-url-row input {
    min-width: 0;
    flex: 1;
    padding: 11px 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--deep);
    color: var(--text);
    font-size: 11px;
    text-overflow: ellipsis;
}

.bot-link-url-row .icon-button {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
}

.bot-link-url-row .icon-button svg {
    width: 17px;
    height: 17px;
}

.bot-link-card-meta {
    gap: 14px;
    margin-top: 15px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.bot-link-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.bot-link-card-meta svg {
    width: 14px;
    height: 14px;
    color: var(--brand-accent);
}

.bot-link-card-actions {
    gap: 7px;
    margin-top: auto;
    padding-top: 16px;
    flex-wrap: wrap;
}

.bot-link-card-actions form {
    margin: 0;
}

.bot-link-card-actions .btn {
    min-height: 38px;
    padding: 0 11px;
    font-size: 11px;
    white-space: nowrap;
}

.bot-link-card-actions .btn-danger {
    border-color: rgba(201, 79, 64, .28);
}

.bot-link-edit {
    position: relative;
}

.bot-link-edit > summary {
    list-style: none;
    cursor: pointer;
}

.bot-link-edit > summary::-webkit-details-marker {
    display: none;
}

.bot-link-edit-form {
    position: absolute;
    z-index: 3;
    right: 0;
    bottom: calc(100% + 10px);
    display: grid;
    width: min(340px, calc(100vw - 52px));
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.bot-link-edit-form .field {
    margin: 0;
}

.bot-link-edit-form textarea {
    min-height: 80px;
    resize: vertical;
}

.bot-link-edit-form .quick-actions {
    margin: 0;
}

.bot-link-empty {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px;
}

.bot-link-empty-icon {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border-radius: 13px;
    background: var(--coral-soft);
    color: var(--brand-accent);
}

.bot-link-empty-icon svg {
    width: 20px;
    height: 20px;
}

.bot-link-empty strong,
.bot-link-empty p {
    display: block;
}

.bot-link-empty strong {
    color: var(--brand-dark);
    font-size: 13px;
}

.bot-link-empty p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.bot-link-empty .btn {
    margin-left: auto;
    flex-shrink: 0;
}

.bot-links-empty {
    min-height: 165px;
}

.field-optional {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

@media (max-width: 1020px) {
    .bot-link-generator-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bot-link-message-field {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .bot-link-message-field textarea {
        min-height: 92px;
    }
}

@media (max-width: 820px) {
    .bot-links-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .bot-links-header,
    .bot-link-section-heading,
    .bot-links-published-heading,
    .bot-link-form-actions,
    .bot-link-empty {
        align-items: flex-start;
        flex-direction: column;
    }

    .bot-links-header-actions,
    .bot-links-header-actions .btn,
    .bot-link-form-actions .btn,
    .bot-link-empty .btn {
        width: 100%;
    }

    .bot-link-generator,
    .bot-links-published-section {
        padding: 18px;
    }

    .bot-link-generator-form {
        grid-template-columns: 1fr;
    }

    .bot-link-message-field {
        grid-column: auto;
    }

    .bot-link-card {
        padding: 16px;
    }

    .bot-link-card-actions {
        align-items: stretch;
    }

    .bot-link-card-actions .bot-link-edit,
    .bot-link-card-actions > a,
    .bot-link-card-actions > form {
        flex: 1;
    }

    .bot-link-card-actions .btn {
        width: 100%;
    }

    .bot-link-edit-form {
        position: fixed;
        top: 50%;
        right: 16px;
        bottom: auto;
        left: 16px;
        width: auto;
        transform: translateY(-50%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .bot-link-edit-form {
        transition: none;
    }
}
