/* ═══════════════════════════════════════════════════════
 * GP WhatsApp — Complete Stylesheet
 * ═══════════════════════════════════════════════════════ */

/* ─── Base / Wrap ──────────────────────────── */
.gpwa-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #1e293b;
    line-height: 1.5;
    max-width: 100%;
}

/* ─── Card ─────────────────────────────────── */
.gpwa-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.gpwa-card__title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Section Header ───────────────────────── */
.gpwa-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.gpwa-section-header__left,
.gpwa-section-header__right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.gpwa-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.gpwa-count {
    font-size: 13px;
    color: #64748b;
    font-weight: 400;
}

/* ─── Form Elements ────────────────────────── */
.gpwa-form-group {
    margin-bottom: 16px;
}

.gpwa-form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.gpwa-form-row .gpwa-form-group {
    flex: 1;
    min-width: 200px;
}

.gpwa-form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.gpwa-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.gpwa-input,
.gpwa-select,
.gpwa-textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    color: #1e293b;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.gpwa-input:focus,
.gpwa-select:focus,
.gpwa-textarea:focus {
    outline: none;
    border-color: #6c5ce7;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.gpwa-input--sm,
.gpwa-select--sm {
    padding: 6px 10px;
    font-size: 13px;
}

.gpwa-textarea {
    resize: vertical;
    min-height: 80px;
}

.gpwa-hint {
    display: block;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

.gpwa-field-error {
    display: none;
    font-size: 12px;
    color: #ef4444;
    margin-top: 4px;
}

/* ─── Buttons ──────────────────────────────── */
.gpwa-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.gpwa-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.gpwa-btn--primary {
    background: #6c5ce7;
    color: #fff;
}
.gpwa-btn--primary:hover:not(:disabled) {
    background: #5a4bd1;
}

.gpwa-btn--secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}
.gpwa-btn--secondary:hover:not(:disabled) {
    background: #e2e8f0;
}

.gpwa-btn--danger {
    background: #ef4444;
    color: #fff;
}
.gpwa-btn--danger:hover:not(:disabled) {
    background: #dc2626;
}

.gpwa-btn--outline {
    background: transparent;
    color: #6c5ce7;
    border: 1px solid #c4b5fd;
}
.gpwa-btn--outline:hover:not(:disabled) {
    background: #f5f3ff;
}

.gpwa-btn--danger-outline {
    background: transparent;
    color: #ef4444;
    border: 1px solid #fca5a5;
}
.gpwa-btn--danger-outline:hover:not(:disabled) {
    background: #fef2f2;
}

.gpwa-btn--sm {
    padding: 6px 12px;
    font-size: 13px;
}

.gpwa-btn--xs {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 6px;
}

/* ─── Recipient Bar ────────────────────────── */
.gpwa-recipient-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ─── Tags ─────────────────────────────────── */
.gpwa-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.gpwa-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    background: #ede9fe;
    color: #6c5ce7;
    border-radius: 20px;
}

.gpwa-tag--rm {
    background: #e0f2fe;
    color: #0284c7;
}

.gpwa-tag--sm {
    padding: 2px 8px;
    font-size: 11px;
}

.gpwa-tag__x {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
    opacity: 0.7;
}
.gpwa-tag__x:hover {
    opacity: 1;
}

/* ─── Badges ───────────────────────────────── */
.gpwa-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: capitalize;
    white-space: nowrap;
}

.gpwa-badge--active, .gpwa-badge--sent, .gpwa-badge--completed {
    background: #dcfce7;
    color: #16a34a;
}
.gpwa-badge--inactive, .gpwa-badge--failed {
    background: #fee2e2;
    color: #dc2626;
}
.gpwa-badge--sending, .gpwa-badge--pending, .gpwa-badge--draft {
    background: #fef3c7;
    color: #d97706;
}
.gpwa-badge--paused {
    background: #e0e7ff;
    color: #4f46e5;
}
.gpwa-badge--manual {
    background: #ede9fe;
    color: #7c3aed;
}
.gpwa-badge--csv {
    background: #dbeafe;
    color: #2563eb;
}
.gpwa-badge--mobile {
    background: #d1fae5;
    color: #059669;
}
.gpwa-badge--text {
    background: #f1f5f9;
    color: #475569;
}
.gpwa-badge--image {
    background: #fce7f3;
    color: #db2777;
}
.gpwa-badge--text_image {
    background: #fff7ed;
    color: #ea580c;
}
.gpwa-badge--document {
    background: #ecfdf5;
    color: #059669;
}
.gpwa-badge--blocked {
    background: #fecaca;
    color: #b91c1c;
}
.gpwa-badge--info {
    background: #dbeafe;
    color: #2563eb;
}

/* ─── Status Indicators ────────────────────── */
.gpwa-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
}
.gpwa-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.gpwa-status--success::before { background: #22c55e; }
.gpwa-status--info::before { background: #3b82f6; }
.gpwa-status--danger::before { background: #ef4444; }
.gpwa-status--default::before { background: #94a3b8; }

/* ─── Table ────────────────────────────────── */
.gpwa-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.gpwa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.gpwa-table thead {
    background: #f8fafc;
}

.gpwa-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: #64748b;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.gpwa-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.gpwa-table tr:last-child td {
    border-bottom: none;
}

.gpwa-table tr:hover {
    background: #fafbff;
}

.gpwa-table code {
    font-size: 12px;
    color: #6c5ce7;
    background: #f5f3ff;
    padding: 2px 6px;
    border-radius: 4px;
}

.gpwa-actions-cell {
    display: flex;
    gap: 4px;
    white-space: nowrap;
}

/* ─── Stats Row ────────────────────────────── */
.gpwa-stats-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.gpwa-stat-card {
    flex: 1;
    min-width: 120px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 18px;
    text-align: center;
}

.gpwa-stat-num {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.gpwa-stat-label {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

.gpwa-stat--sent .gpwa-stat-num { color: #3b82f6; }
.gpwa-stat--delivered .gpwa-stat-num { color: #22c55e; }
.gpwa-stat--read .gpwa-stat-num { color: #6c5ce7; }
.gpwa-stat--failed .gpwa-stat-num { color: #ef4444; }

/* ─── Campaign Cards ───────────────────────── */
.gpwa-campaign-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 12px;
    transition: box-shadow 0.2s;
}

.gpwa-campaign-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.gpwa-campaign-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.gpwa-campaign-card__header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

.gpwa-campaign-card__header > div {
    display: flex;
    gap: 6px;
}

.gpwa-campaign-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 10px;
}

.gpwa-campaign-card__meta i {
    margin-right: 3px;
}

.gpwa-campaign-card__actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.gpwa-text-danger {
    color: #ef4444 !important;
}

/* ─── Progress Bar ─────────────────────────── */
.gpwa-progress {
    height: 6px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
}

.gpwa-progress__bar {
    height: 100%;
    background: linear-gradient(90deg, #6c5ce7, #a78bfa);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ─── Pagination ───────────────────────────── */
.gpwa-pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
}

.gpwa-page {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.gpwa-page:hover {
    background: #f5f3ff;
    border-color: #c4b5fd;
}

.gpwa-page--on {
    background: #6c5ce7;
    color: #fff;
    border-color: #6c5ce7;
}

/* ─── Loading / Empty ──────────────────────── */
.gpwa-loading {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.gpwa-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    text-align: center;
    color: #94a3b8;
}

.gpwa-empty h3 {
    margin: 16px 0 4px;
    color: #64748b;
    font-size: 16px;
}

.gpwa-empty p {
    margin: 0;
    font-size: 13px;
}

/* ─── Notices ──────────────────────────────── */
.gpwa-notice {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 12px;
    line-height: 1.5;
}

.gpwa-notice--success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.gpwa-notice--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.gpwa-notice--info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.gpwa-notice--warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.gpwa-notice--warning i {
    color: #f59e0b;
    margin-right: 4px;
}

/* ─── Modal ────────────────────────────────── */
.gpwa-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gpwa-modal__backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.gpwa-modal__content {
    position: relative;
    background: #fff;
    border-radius: 14px;
    padding: 28px;
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    z-index: 1;
}

.gpwa-modal__content--md {
    max-width: 560px;
}

.gpwa-modal__content--lg {
    max-width: 700px;
}

.gpwa-modal__content h3 {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gpwa-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

/* ─── Contact Picker ───────────────────────── */
.gpwa-picker-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 4px;
}

.gpwa-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}

.gpwa-picker-item:hover {
    background: #f8fafc;
}

.gpwa-picker-item input[type="checkbox"] {
    flex-shrink: 0;
}

.gpwa-picker-item code {
    font-size: 12px;
    color: #6c5ce7;
    background: #f5f3ff;
    padding: 2px 6px;
    border-radius: 4px;
}

/* ─── Bulk Action Bar ──────────────────────── */
.gpwa-bulk-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: #1e293b;
    border-radius: 10px;
    color: #fff;
    font-size: 13px;
    margin-top: 12px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

/* ─── Toast ────────────────────────────────── */
.gpwa-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    z-index: 99999;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 400px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

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

.gpwa-toast--success { background: #16a34a; }
.gpwa-toast--error { background: #dc2626; }
.gpwa-toast--info { background: #2563eb; }
.gpwa-toast--warning { background: #d97706; }


/* ═══════════════════════════════════════════════════════
 * TEMPLATE UI Components
 * ═══════════════════════════════════════════════════════ */

/* ─── Send Mode Toggle ──────────────────────── */
.gpwa-toggle-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.gpwa-toggle-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    flex: 1;
    min-width: 200px;
    transition: all 0.2s ease;
    background: #fff;
    font-size: 14px;
    font-weight: 500;
    color: #475569;
}

.gpwa-toggle-option:hover {
    border-color: #a5b4fc;
    background: #f8faff;
}

.gpwa-toggle-option--active {
    border-color: #6c5ce7;
    background: #f5f3ff;
    color: #4c1d95;
}

.gpwa-toggle-option--active i {
    color: #6c5ce7;
}

.gpwa-toggle-option input[type="radio"] {
    margin-top: 2px;
}

.gpwa-hint-inline {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #94a3b8;
    margin-top: 2px;
}

.gpwa-toggle-option--active .gpwa-hint-inline {
    color: #7c3aed;
}

/* ─── Template Preview Card ─────────────────── */
.gpwa-template-preview {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 14px 16px;
    margin: 10px 0;
    font-size: 13px;
    line-height: 1.6;
}

.gpwa-template-preview__header {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.gpwa-template-preview__body {
    color: #1e293b;
    white-space: pre-wrap;
}

.gpwa-template-preview__body mark {
    background: #fef08a;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.gpwa-template-preview__footer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #bbf7d0;
    color: #64748b;
    font-size: 12px;
    font-style: italic;
}

/* ─── Template Badge ────────────────────────── */
.gpwa-badge--template {
    background: #ede9fe;
    color: #6c5ce7;
    border: 1px solid #c4b5fd;
}

.gpwa-badge--template i {
    margin-right: 4px;
}

/* ─── Responsive ───────────────────────────── */
@media (max-width: 768px) {
    .gpwa-section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .gpwa-section-header__right {
        width: 100%;
    }
    .gpwa-form-row {
        flex-direction: column;
    }
    .gpwa-stats-row {
        flex-direction: column;
    }
    .gpwa-stat-card {
        min-width: 100%;
    }
    .gpwa-toggle-option {
        min-width: 100%;
    }
    .gpwa-modal__content {
        width: 95%;
        padding: 20px;
    }
    .gpwa-toast {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
    }
}
/* ═══════════════════════════════════════════════════
 * Template Parameter Row — Contact Field Mapping UI
 * ═══════════════════════════════════════════════════ */
.gpwa-param-hint {
    font-size: 12px;
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.gpwa-param-hint i { color: #6c5ce7; flex-shrink: 0; }

.gpwa-param-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: #fafafa;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.gpwa-param-row__label mark {
    background: #fef08a;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
}

.gpwa-param-row__controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.gpwa-param-row__controls .gpwa-select { flex: 1; min-width: 160px; }
.gpwa-param-row__controls .gpwa-tpl-param { flex: 1; min-width: 160px; }

.gpwa-param-row__preview {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6c5ce7;
    font-weight: 500;
    padding: 4px 0;
}
.gpwa-param-row__preview i { font-size: 11px; }