/* Besked WhatsApp Notifications - Admin Styles */

/* Header */
.besked-admin-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px 0;
}

.besked-admin-header .besked-logo svg {
    display: block;
}

.besked-version {
    background: #38BDF8;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Tabs */
.besked-tabs {
    margin-bottom: 0 !important;
}

.besked-tabs .nav-tab {
    border-bottom-color: transparent;
    padding: 8px 16px;
    font-weight: 500;
}

.besked-tabs .nav-tab-active {
    background: #fff;
    border-bottom-color: #fff;
    color: #1e1e1e;
}

/* Cards */
.besked-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px 24px;
    margin: 16px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.besked-card h2 {
    margin-top: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e1e1e;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.besked-card .form-table th {
    padding-top: 16px;
    padding-bottom: 16px;
    font-weight: 500;
}

/* Input groups */
.besked-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.besked-input-group .button .dashicons {
    margin-top: 4px;
}

/* Toggle switch (iOS style) */
.besked-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.besked-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.besked-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s ease;
    border-radius: 26px;
}

.besked-toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.besked-toggle input:checked + .besked-toggle-slider {
    background-color: #38BDF8;
}

.besked-toggle input:checked + .besked-toggle-slider::before {
    transform: translateX(22px);
}

.besked-toggle input:focus + .besked-toggle-slider {
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.3);
}

/* Notifications */
.besked-notification-card {
    padding: 0;
    overflow: hidden;
}

.besked-notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}

.besked-notification-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.besked-notification-title h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.besked-notification-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.besked-badge-admin {
    background: #FEF3C7;
    color: #92400E;
}

.besked-badge-customer {
    background: #DBEAFE;
    color: #1E40AF;
}

.besked-notification-body {
    padding: 16px 20px;
}

.besked-template-editor {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    min-height: 100px;
}

/* Placeholders */
.besked-placeholders {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.besked-placeholder-tag {
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
    background: #f0f6fc;
    color: #0969da;
    font-size: 12px;
    transition: all 0.2s;
    border: 1px solid #d0d7de;
}

.besked-placeholder-tag:hover {
    background: #0969da;
    color: #fff;
    border-color: #0969da;
}

.besked-placeholder-tag.copied {
    background: #1a7f37;
    color: #fff;
    border-color: #1a7f37;
}

/* Badges */
.besked-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.besked-badge-success {
    background: #D1FAE5;
    color: #065F46;
}

.besked-badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.besked-badge-error {
    background: #FEE2E2;
    color: #991B1B;
}

.besked-badge-muted {
    background: #F3F4F6;
    color: #6B7280;
}

/* Health Check */
.besked-health-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

#besked-health-badge .besked-badge {
    font-size: 13px;
    padding: 4px 14px;
}

#besked-health-check .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

#besked-health-info {
    margin-top: 4px;
}

#besked-fix-session {
    text-decoration: none;
}

/* Table */
.besked-table th,
.besked-table td {
    vertical-align: middle;
}

.besked-table .check-column {
    text-align: center !important;
    vertical-align: middle !important;
    padding: 0 !important;
    width: 26px;
}

.besked-table .check-column input[type="checkbox"] {
    display: block;
    margin: 0 auto;
}

.besked-table code {
    background: transparent;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.besked-msg-preview,
.besked-msg-error {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Contacts toolbar */
.besked-contacts-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 16px 0;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    gap: 12px;
    flex-wrap: wrap;
}

.besked-filter-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.besked-filter-form select,
.besked-filter-form input[type="search"] {
    height: 32px;
}

.besked-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.besked-total-count {
    color: #666;
    font-size: 13px;
}

/* Bulk action bar */
.besked-bulk-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    padding: 8px 12px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    flex-wrap: wrap;
}

.besked-bulk-count-label {
    color: #666;
    font-size: 13px;
    margin-left: 4px;
}

/* List badges in contacts table */
.besked-list-badge {
    display: inline-flex !important;
    align-items: center;
    gap: 3px;
    background: #EFF6FF;
    color: #1D4ED8;
    border: 1px solid #BFDBFE;
    border-radius: 10px;
    font-size: 11px;
    padding: 2px 8px;
    white-space: nowrap;
    margin: 1px 2px;
    cursor: default;
    transition: background 0.15s, border-color 0.15s;
}

.besked-list-badge:hover {
    background: #DBEAFE;
    border-color: #93C5FD;
}

.besked-badge-remove {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    color: #1E40AF;
    transition: opacity 0.15s, color 0.1s;
    flex-shrink: 0;
    margin-left: 1px;
}

.besked-list-badge:hover .besked-badge-remove {
    opacity: 0.65;
}

.besked-badge-remove:hover {
    opacity: 1 !important;
    color: #DC2626 !important;
}

/* Improved pagination */
.besked-pagination-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 20px 0 8px;
    padding: 16px 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
}

.besked-pagination-info {
    color: #555;
    font-size: 13px;
}

.besked-pagination-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

.besked-pagination-links .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    background: #fff;
    color: #2271b1;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.besked-pagination-links .page-numbers:hover {
    background: #f0f6fc;
    border-color: #2271b1;
}

.besked-pagination-links .page-numbers.current {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
    font-weight: 600;
    pointer-events: none;
}

.besked-pagination-links .page-numbers.dots {
    border-color: transparent;
    background: transparent;
    color: #999;
    min-width: auto;
    pointer-events: none;
}

/* Delete link */
.besked-delete-link {
    color: #b32d2e;
    text-decoration: none;
}

.besked-delete-link:hover {
    color: #a00;
}

/* Inline phone edit trigger */
.besked-phone-edit {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    cursor: pointer;
    color: inherit;
}

.besked-phone-edit .besked-phone-value {
    cursor: pointer;
}

.besked-phone-edit-icon {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
    color: #2271b1;
    opacity: 0.35;
    transition: opacity 0.15s;
}

.besked-phone-edit:hover .besked-phone-edit-icon,
.besked-phone-edit:focus .besked-phone-edit-icon {
    opacity: 0.85;
}

/* On touch devices there is no hover state, so keep the edit cue visible. */
@media (hover: none) {
    .besked-phone-edit-icon {
        opacity: 0.6;
    }
}

/* Non-mobile / landline warning triangle */
.besked-phone-warning {
    font-size: 15px;
    width: 15px;
    height: 15px;
    line-height: 15px;
    color: #d97706;
    cursor: help;
}

/* Approve-number checkbox row inside the edit modal */
.besked-phone-approve-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: #1e1e1e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 4px;
    padding: 8px 10px;
    cursor: pointer;
}

.besked-phone-approve-row input[type="checkbox"] {
    margin: 2px 0 0;
    flex-shrink: 0;
}

/* Modal */
.besked-modal {
    position: fixed;
    inset: 0;
    z-index: 100050;
    display: flex;
    align-items: center;
    justify-content: center;
}

.besked-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.besked-modal-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 92%;
    max-width: 420px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    padding: 24px;
}

.besked-modal-dialog h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e1e1e;
}

.besked-phone-modal-label {
    font-weight: 500;
    font-size: 13px;
    color: #1e1e1e;
}

.besked-phone-modal-input {
    width: 100%;
    height: 40px;
    padding: 6px 10px;
    font-size: 16px;
    box-sizing: border-box;
}

.besked-phone-modal-hint {
    margin: 0;
    color: #666;
    font-size: 12px;
    line-height: 1.5;
}

.besked-phone-modal-msg {
    margin: 0;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 13px;
    background: #FEE2E2;
    color: #991B1B;
}

.besked-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

/* Responsive */
@media screen and (max-width: 782px) {
    .besked-input-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .besked-contacts-toolbar {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .besked-filter-form {
        flex-wrap: wrap;
    }

    .besked-notification-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
