/**
 * EchoNotifications Component Styles
 * Uses v2-* portal design tokens. Shared across client app and admin shell.
 */

/* --- Notification type badges --- */
.notif-type-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

/* --- Skeleton placeholder --- */
.notif-recipient-skeleton {
    padding: var(--v2-space-5) 0;
}

/* --- Phone number display --- */
.notif-phone {
    font-family: var(--v2-font-mono);
    font-variant-numeric: tabular-nums;
}

/* --- Modal checkboxes (single-channel modal, vertical list) --- */
.notif-modal-types {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.notif-modal-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: var(--v2-text-sm);
    color: var(--v2-fg);
}

.notif-modal-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--v2-accent);
    cursor: pointer;
}

.notif-sms-consent {
    padding: var(--v2-space-3);
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-sm);
    background: var(--v2-surface-muted, var(--v2-bg-subtle));
}

.notif-sms-consent-check {
    align-items: flex-start;
    line-height: 1.45;
}

.notif-sms-consent-check input[type="checkbox"] {
    margin-top: 2px;
    flex: 0 0 auto;
}

.notif-sms-consent-links a {
    color: var(--v2-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* --- Admin-only: Notification history timeline --- */
.notif-history-timeline {
    padding: 0 var(--v2-space-4);
}

.notif-history-item {
    display: flex;
    align-items: flex-start;
    gap: var(--v2-space-3);
    padding: var(--v2-space-3) var(--v2-space-2);
    margin: 0 calc(-1 * var(--v2-space-2));
    border-bottom: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-sm);
    cursor: pointer;
    transition: background 0.12s ease;
}

.notif-history-item:hover {
    background: var(--v2-surface-hover);
}

.notif-history-item.active-row {
    background: var(--v2-accent-subtle, rgba(139, 92, 246, 0.08));
    border-left: 2px solid var(--v2-accent, #8b5cf6);
}

.notif-history-item:last-child {
    border-bottom: none;
}

.notif-history-channel-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.notif-history-channel-icon.email {
    background: var(--v2-info-bg);
    color: var(--v2-accent);
}

.notif-history-channel-icon.sms {
    background: var(--v2-success-bg);
    color: var(--v2-success);
}

.notif-history-body {
    flex: 1;
    min-width: 0;
}

.notif-history-row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--v2-space-2);
}

.notif-history-headline {
    font-size: var(--v2-text-sm);
    font-weight: 500;
    color: var(--v2-fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-history-meta {
    display: flex;
    align-items: center;
    gap: var(--v2-space-2);
    margin-top: 2px;
    font-size: var(--v2-text-xs);
    color: var(--v2-fg-muted);
}

/* Message preview row — sits between headline and meta */
.notif-history-preview {
    margin-top: 4px;
}

.notif-history-subject {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: var(--v2-text-xs);
    line-height: var(--v2-leading-normal);
    color: var(--v2-fg-muted);
}

.notif-history-call-link {
    color: var(--v2-accent);
    text-decoration: none;
    font-weight: 500;
}

.notif-history-call-link:hover {
    text-decoration: underline;
}

/* --- History stats --- */
.notif-history-stats {
    display: flex;
    gap: var(--v2-space-6);
    padding: var(--v2-space-3) var(--v2-space-4);
    border-bottom: 1px solid var(--v2-border);
}

.notif-history-stat-value {
    font-size: var(--v2-text-lg);
    font-weight: 600;
    color: var(--v2-fg);
}

.notif-history-stat-label {
    font-size: var(--v2-text-xs);
    color: var(--v2-fg-muted);
    text-transform: uppercase;
    letter-spacing: var(--v2-tracking-wide);
}

/* --- History filters --- */
.notif-history-filters {
    display: flex;
    gap: 4px;
}

.notif-history-filter-btn {
    padding: 4px 10px;
    font-size: var(--v2-text-xs);
    font-weight: 500;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-full);
    background: transparent;
    color: var(--v2-fg-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.notif-history-filter-btn:hover {
    background: var(--v2-surface-hover);
    color: var(--v2-fg);
}

.notif-history-filter-btn.active {
    background: var(--v2-accent);
    border-color: var(--v2-accent);
    color: var(--v2-fg-on-accent);
}

/* --- History pagination --- */
.notif-history-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--v2-space-3);
    padding: var(--v2-space-3) var(--v2-space-4);
    border-top: 1px solid var(--v2-border);
}

.notif-history-page-btn {
    padding: 4px 12px;
    font-size: var(--v2-text-xs);
    font-weight: 500;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-md);
    background: transparent;
    color: var(--v2-fg);
    cursor: pointer;
}

.notif-history-page-btn:hover:not(:disabled) {
    background: var(--v2-surface-hover);
}

.notif-history-page-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.notif-history-page-info {
    font-size: var(--v2-text-xs);
    color: var(--v2-fg-muted);
}

/* --- Template variable tag (admin) --- */
.notif-variable-tag {
    display: inline-block;
    padding: 2px 8px;
    font-family: var(--v2-font-mono);
    font-size: var(--v2-text-xs);
    background: var(--v2-surface-hover);
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-sm);
    color: var(--v2-fg-muted);
}

/* --- Sidebar: email iframe preview --- */
.notif-sidebar-email-label {
    font-size: var(--v2-text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--v2-tracking-wide);
    color: var(--v2-fg-muted);
    margin-bottom: var(--v2-space-2);
}

.notif-sidebar-email-preview {
    width: 100%;
    height: 400px;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius-md);
    /* D04: white background simulates real email client (emails are written for white bg). */
    background: white;
    display: block;
}

/* --- Sidebar: SMS gallery preview ---
   D04: All `.sms-gallery-*` colors below are intentional iOS/iMessage brand simulation.
   Black bezel (#000), iMessage blue (#007AFF), iOS gray (#8e8e93/#c7c7cc/#e5e5e5),
   white screen (#fff), and the SF Pro font stack reproduce the iOS Messages app chrome.
   These are NOT general portal colors and must not be tokenized. */
.notif-sidebar-sms-preview {
    margin-top: var(--v2-space-3);
    display: flex;
    justify-content: center;
}

.notif-sidebar-sms-preview .sms-gallery-phone {
    width: min(320px, 100%);
    background: #000;
    border-radius: 40px;
    padding: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 0 0 2px #333;
}

.notif-sidebar-sms-preview .sms-gallery-screen {
    background: #fff;
    color-scheme: light;
    border-radius: 30px;
    overflow: hidden;
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

.notif-sidebar-sms-preview .sms-gallery-statusbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px 0;
    font-size: 12px;
    font-weight: 600;
    color: #000;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
}

.notif-sidebar-sms-preview .sms-gallery-statusbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.notif-sidebar-sms-preview .sms-gallery-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 16px 12px;
    border-bottom: 0.5px solid #e5e5e5;
}

.notif-sidebar-sms-preview .sms-gallery-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #007AFF;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    color: #fff;
}

.notif-sidebar-sms-preview .sms-gallery-contact {
    font-size: 13px;
    font-weight: 600;
    color: #000;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
}

.notif-sidebar-sms-preview .sms-gallery-messages {
    flex: 1;
    padding: 12px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notif-sidebar-sms-preview .sms-gallery-timestamp {
    text-align: center;
    font-size: 11px;
    color: #8e8e93;
    margin-bottom: 4px;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
}

.notif-sidebar-sms-preview .sms-gallery-bubble {
    max-width: 85%;
    padding: 8px 14px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.35;
    word-break: break-word;
    white-space: pre-wrap;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
}

.notif-sidebar-sms-preview .sms-gallery-bubble.sent {
    align-self: flex-end;
    background: #007AFF;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.notif-sidebar-sms-preview .sms-gallery-bubble.delivered-label {
    align-self: flex-end;
    font-size: 11px;
    color: #8e8e93;
    padding: 2px 4px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
}

.notif-sidebar-sms-preview .sms-gallery-home-indicator {
    display: flex;
    justify-content: center;
    padding: 8px 0 6px;
}

.notif-sidebar-sms-preview .sms-gallery-home-indicator div {
    width: 134px;
    height: 5px;
    background: #000;
    border-radius: 3px;
}

.notif-sidebar-sms-preview .sms-gallery-inputbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 4px;
    border-top: 0.5px solid #e5e5e5;
}

.notif-sidebar-sms-preview .sms-gallery-input-field {
    flex: 1;
    height: 34px;
    border-radius: 18px;
    border: 0.5px solid #c7c7cc;
    padding: 0 12px;
    font-size: 15px;
    color: #c7c7cc;
    display: flex;
    align-items: center;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
}

.notif-sidebar-sms-preview .sms-gallery-send-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #007AFF;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}

.notif-sidebar-sms-preview .sms-gallery-send-btn svg {
    width: 16px;
    height: 16px;
}
