/* ==========================================================================
   Alert Modal — single source of truth for all alert-modal styles
   ========================================================================== */

/* ═══════════════════════════════════════════════════════════════
   TV ALERT MODAL
   ═══════════════════════════════════════════════════════════════ */

.tv-alert-modal.hidden {
    display: none;
}

.tv-alert-modal {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
}

.tv-alert-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(2px);
}

.tv-alert-dialog {
    position: relative;
    width: min(480px, calc(100vw - 32px));
    background: var(--ui-panel,#F3F4F6);
    border: 1px solid var(--ui-panel-border,#e0e3eb);
    border-radius: 14px;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
    overflow: hidden;
    color: var(--ui-fg,#131722);
}

.tv-alert-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ui-panel-border,#e0e3eb);
}

.tv-alert-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.tv-alert-title {
    margin: 0;
    font-size: 18px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.tv-alert-symbol-btn,
.tv-alert-icon-btn,
.tv-alert-menu-btn,
.tv-alert-inline-btn,
.tv-alert-add-link,
.tv-alert-footer-btn {
    font: inherit;
}

.tv-alert-symbol-btn {
    border: none;
    background: transparent;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    color: var(--ui-fg,#131722);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.tv-alert-symbol-badge {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2b7de9;
    color: var(--ui-panel,#F3F4F6);
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.tv-alert-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tv-alert-icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--ui-muted,#4b5563);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.tv-alert-icon-btn:hover {
    background: var(--ui-button,#e5e7eb);
    color: var(--ui-fg,#131722);
}

.tv-alert-body {
    padding: 14px 16px;
}

.tv-alert-section {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ui-panel-border,#e0e3eb);
}

.tv-alert-row,
.tv-alert-summary-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
}

.tv-alert-label {
    color: var(--ui-muted,#6b7280);
    font-size: 13px;
    font-weight: 600;
    line-height: 34px;
}

.tv-alert-condition-stack {
    display: grid;
    gap: 8px;
}

.tv-alert-static-field,
.tv-alert-value-input,
.tv-alert-datetime-input,
.tv-alert-text-input {
    width: 100%;
    min-height: 34px;
    box-sizing: border-box;
    border: 1px solid var(--ui-panel-border,#e0e3eb);
    border-radius: 6px;
    background: var(--ui-bg,#F3F4F6);
    color: var(--ui-fg,#131722);
    padding: 0 10px;
    font-size: 13px;
}

.tv-alert-static-field {
    display: flex;
    align-items: center;
    font-weight: 500;
}

.tv-alert-menu-wrap {
    position: relative;
}

.tv-alert-menu-btn {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--ui-panel-border,#e0e3eb);
    border-radius: 6px;
    background: var(--ui-panel,#F3F4F6);
    color: var(--ui-fg,#131722);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 10px;
    cursor: pointer;
}

.tv-alert-menu-btn-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.tv-alert-condition-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ui-fg,#131722);
    flex-shrink: 0;
}

.tv-alert-value-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tv-alert-input-wrap {
    position: relative;
}

.tv-alert-value-input:focus,
.tv-alert-datetime-input:focus,
.tv-alert-text-input:focus {
    outline: none;
    border-color: #2962ff;
    box-shadow: 0 0 0 1px #2962ff inset;
    background: var(--ui-panel,#F3F4F6);
}

.tv-alert-add-link {
    border: none;
    background: transparent;
    color: #2962ff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 2px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    width: fit-content;
}

.tv-alert-summary {
    padding-top: 12px;
    display: grid;
    gap: 8px;
}

.tv-alert-summary-row {
    align-items: center;
}

.tv-alert-summary-row .tv-alert-label {
    line-height: 1.4;
}

.tv-alert-summary-control {
    min-width: 0;
}

.tv-alert-inline-btn {
    width: 100%;
    min-height: 28px;
    border: none;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 0;
    color: var(--ui-fg,#131722);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.tv-alert-menu.hidden {
    display: none;
}

.tv-alert-menu {
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    width: 100%;
    min-width: 220px;
    padding: 6px;
    background: var(--ui-panel,#F3F4F6);
    border: 1px solid var(--ui-panel-border,#e0e3eb);
    border-radius: 10px;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
    z-index: 4;
}

.tv-alert-menu-compact {
    width: min(320px, calc(100vw - 64px));
}

.tv-alert-menu-item {
    width: 100%;
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--ui-fg,#131722);
    text-align: left;
    cursor: pointer;
}

.tv-alert-menu-item:hover {
    background: var(--ui-button,#e5e7eb);
}

.tv-alert-menu-item.active {
    background: #2f2f33;
    color: var(--ui-panel,#F3F4F6);
}

.tv-alert-menu-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tv-alert-menu-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.tv-alert-menu-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
}

.tv-alert-menu-subtitle {
    font-size: 11px;
    line-height: 1.35;
    color: var(--ui-muted,#6b7280);
}

.tv-alert-menu-item.active .tv-alert-menu-subtitle {
    color: rgba(255, 255, 255, 0.8);
}

.tv-alert-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--ui-panel-border,#e0e3eb);
    background: var(--ui-panel,#F3F4F6);
}

.tv-alert-footer-btn {
    min-width: 80px;
    height: 34px;
    border-radius: 6px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.tv-alert-footer-btn-secondary {
    border: 1px solid var(--ui-panel-border,#e0e3eb);
    background: var(--ui-panel,#F3F4F6);
    color: var(--ui-fg,#131722);
}

.tv-alert-footer-btn-primary {
    border: 1px solid var(--ui-fg,#131722);
    background: var(--ui-fg,#131722);
    color: var(--ui-panel,#F3F4F6);
}

.tv-alert-toast {
    position: fixed;
    right: 24px;
    bottom: 8px;
    z-index: 10030;
    min-width: 260px;
    max-width: min(420px, calc(100vw - 32px));
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--ui-fg,#131722);
    color: var(--ui-panel,#F3F4F6);
    font-size: 13px;
    line-height: 1.45;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.24);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.tv-alert-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================
   Responsive Overrides
   ========================================================== */

@media (max-width: 760px) {
    .tv-alert-dialog {
        width: min(100vw - 20px, 560px);
    }

    .tv-alert-row,
    .tv-alert-summary-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .tv-alert-label {
        line-height: 1.2;
    }

    .tv-alert-value-row {
        grid-template-columns: 1fr;
    }
}

/* Small mobile */
@media (max-width: 479px) {
    .tv-alert-dialog {
        width: 98vw !important;
        margin: auto;
        border-radius: 12px;
        max-height: 85vh !important;
    }
}

/* Medium mobile */
@media (min-width: 480px) and (max-width: 767px) {
    .tv-alert-dialog { max-height: 85vh; }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
    .tv-alert-dialog { max-height: 80vh; }
}

/* Small mobile (pane controls context) */
@media (max-width: 479px) {
    .tv-alert-dialog { max-height: 80vh !important; }
}
