/* CF7 Notifications – WhatsApp, Telegram, Teams, Discord & N8N — Admin UI v2.2.0 */

/* === Layout: Sidebar + Content === */
.chatnoticf7-outer {
    display: flex;
    gap: 0;
    margin: 24px 20px 20px 0;
    min-height: 80vh;
}
.chatnoticf7-sidebar {
    width: 260px;
    min-width: 260px;
    background: linear-gradient(180deg, #4169E1 0%, #1e40af 100%);
    border-radius: 16px;
    padding: 24px 0;
    color: #dbeafe;
    box-shadow: 0 8px 32px rgba(65, 105, 225, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.chatnoticf7-sidebar h2 {
    margin: 0 0 24px 20px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
}
.chatnoticf7-sidebar h2 svg { flex-shrink: 0; }
.chatnoticf7-sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: #bfdbfe;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
}
.chatnoticf7-sidebar .nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    transform: translateX(4px);
}
.chatnoticf7-sidebar .nav-item.active {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-left-color: #93c5fd;
    font-weight: 600;
    box-shadow: inset 3px 0 0 #93c5fd;
}
.chatnoticf7-sidebar .nav-item svg { flex-shrink: 0; opacity: 0.9; }
.chatnoticf7-sidebar .nav-item.active svg { opacity: 1; }

.chatnoticf7-content {
    flex: 1;
    min-width: 0;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* === Cards === */
.chatnoticf7-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 32px 36px;
    margin-bottom: 28px;
    box-shadow: 0 4px 12px rgba(65, 105, 225, 0.08), 0 2px 4px rgba(0,0,0,0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.chatnoticf7-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #4169E1 0%, #3b82f6 100%);
}
.chatnoticf7-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(65, 105, 225, 0.15), 0 4px 8px rgba(0,0,0,0.08);
}
.chatnoticf7-card h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: 600;
    color: #1e40af;
    padding-bottom: 16px;
    border-bottom: 2px solid #e0f2fe;
    display: flex;
    align-items: center;
    gap: 10px;
}
.chatnoticf7-card h3 {
    margin-top: 0;
    margin-bottom: 14px;
    font-size: 17px;
    font-weight: 600;
    color: #3b82f6;
}
.chatnoticf7-card p { line-height: 1.7; color: #50575e; }

/* === Grid === */
.chatnoticf7-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* === Platform Cards === */
.chatnoticf7-platform-card {
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid;
}
.chatnoticf7-platform-card h3 {
    margin-top: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chatnoticf7-platform-card p { font-size: 14px; margin: 10px 0; }
.chatnoticf7-platform-card.card-whatsapp { background: linear-gradient(135deg, #dcfce7, #d1fae5); border-color: #22c55e; }
.chatnoticf7-platform-card.card-whatsapp h3 { color: #15803d; }
.chatnoticf7-platform-card.card-whatsapp p { color: #166534; }
.chatnoticf7-platform-card.card-telegram { background: linear-gradient(135deg, #dbeafe, #bfdbfe); border-color: #3b82f6; }
.chatnoticf7-platform-card.card-telegram h3 { color: #1e40af; }
.chatnoticf7-platform-card.card-telegram p { color: #1e3a8a; }
.chatnoticf7-platform-card.card-teams { background: linear-gradient(135deg, #e9d5ff, #d8b4fe); border-color: #a855f7; }
.chatnoticf7-platform-card.card-teams h3 { color: #6b21a8; }
.chatnoticf7-platform-card.card-teams p { color: #581c87; }
.chatnoticf7-platform-card.card-n8n { background: linear-gradient(135deg, #fed7aa, #fdba74); border-color: #f97316; }
.chatnoticf7-platform-card.card-n8n h3 { color: #9a3412; }
.chatnoticf7-platform-card.card-n8n p { color: #7c2d12; }

/* === Instructions === */
.chatnoticf7-instructions {
    background: linear-gradient(135deg, #ecfeff, #cffafe);
    border-left: 4px solid #0891b2;
    padding: 20px 24px;
    margin-bottom: 20px;
    border-radius: 0 8px 8px 0;
}
.chatnoticf7-instructions h3 {
    margin-top: 0;
    color: #0e7490;
    font-size: 17px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === Setup Steps === */
.chatnoticf7-steps { counter-reset: step; list-style: none; padding: 0; }
.chatnoticf7-steps > li {
    counter-increment: step;
    margin-bottom: 18px;
    position: relative;
    padding-left: 3rem;
}
.chatnoticf7-steps > li::before {
    content: counter(step);
    position: absolute;
    left: 0; top: 0;
    background: #0891b2;
    color: #fff;
    width: 2rem; height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}
.chatnoticf7-steps code {
    background: #e0f7fa;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #155e75;
    border: 1px solid #a5f3fc;
}
.chatnoticf7-steps ul { margin-top: 6px; margin-bottom: 0; }

/* === Notice Boxes === */
.chatnoticf7-notice {
    padding: 14px 18px;
    border-radius: 8px;
    border-left: 4px solid;
    margin: 16px 0;
    font-size: 14px;
}
.chatnoticf7-notice p { margin: 0; }
.chatnoticf7-notice.notice-warning { background: #fef2f2; border-color: #ef4444; color: #991b1b; }
.chatnoticf7-notice.notice-tip { background: #f0fdf4; border-color: #22c55e; color: #166534; }
.chatnoticf7-notice.notice-info { background: #eff6ff; border-color: #3b82f6; color: #1e40af; }

/* === Form Table === */
.chatnoticf7-compact { margin-top: 20px; width: 100%; }
.chatnoticf7-compact th {
    width: 220px;
    padding: 14px 20px 14px 0;
    vertical-align: middle;
    text-align: left;
    font-weight: 600;
    color: #1e40af;
    font-size: 14px;
}
.chatnoticf7-compact td { padding: 14px 0; vertical-align: middle; }
.chatnoticf7-compact tr { border-bottom: 1px solid #f0f0f1; }
.chatnoticf7-compact tr:last-child { border-bottom: none; }

/* === Inputs === */
.chatnoticf7-compact input[type="text"],
.chatnoticf7-compact input[type="url"],
.chatnoticf7-compact input[type="number"] {
    padding: 10px 14px;
    font-size: 14px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    width: 100%;
    max-width: 500px;
    background: #f9fafb;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.chatnoticf7-compact input:focus {
    border-color: #0891b2;
    box-shadow: 0 0 0 3px rgba(8,145,178,0.12);
    outline: none;
    background: #fff;
}

/* === Buttons === */
.chatnoticf7-card .button-primary {
    background: #4169E1;
    border-color: #4169E1;
    color: #fff;
    padding: 10px 22px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(65, 105, 225, 0.25);
}
.chatnoticf7-card .button-primary:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(65, 105, 225, 0.35);
}
.chatnoticf7-card .button:not(.button-primary) {
    border-color: #e5e7eb;
    color: #64748b;
}
.chatnoticf7-card .button:not(.button-primary):hover {
    background: #f8fafc;
    border-color: #4169E1;
    color: #4169E1;
}

/* === Sticky Save Bar === */
.chatnoticf7-sticky-bar {
    position: sticky;
    bottom: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 16px 32px;
    border-top: 1px solid #e0f2fe;
    border-radius: 0 0 14px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 10;
    background: #fff;
    box-shadow: 0 -6px 20px rgba(65, 105, 225, 0.1);
}
.chatnoticf7-sticky-bar p.submit {
    margin: 0;
    padding: 0;
}
.chatnoticf7-sticky-bar .button-primary {
    background: linear-gradient(135deg, #4169E1 0%, #3b82f6 100%);
    border: 2px solid #4169E1;
    color: #fff;
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(65, 105, 225, 0.25);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-block;
    line-height: 1.4;
}
.chatnoticf7-sticky-bar .button-primary:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #3b82f6;
    box-shadow: 0 4px 16px rgba(65, 105, 225, 0.35);
    transform: translateY(-1px);
    color: #fff;
}
.chatnoticf7-sticky-bar .button-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(65, 105, 225, 0.25);
}

/* === Overrides Table === */
.chatnoticf7-overrides-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.chatnoticf7-overrides-table th {
    background: #f8fafc;
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #1e40af;
    text-align: left;
    border-bottom: 2px solid #e0f2fe;
}
.chatnoticf7-overrides-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f1;
    vertical-align: middle;
    transition: background 0.2s;
}
.chatnoticf7-overrides-table tr:last-child td { border-bottom: none; }
.chatnoticf7-overrides-table tr:hover td {
    background: #f8fafc;
}
.chatnoticf7-overrides-table .chatnoticf7-del-row {
    padding: 6px 14px;
    font-size: 12px;
    border-color: #ef4444;
    color: #ef4444;
    background: #fff;
}
.chatnoticf7-overrides-table .chatnoticf7-del-row:hover {
    background: #ef4444;
    color: #fff;
}

/* === Template Editor === */
.chatnoticf7-template-editor textarea {
    width: 100%;
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    line-height: 1.7;
    padding: 14px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    background: #f8fafc;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.chatnoticf7-template-editor textarea:focus {
    border-color: #0891b2;
    box-shadow: 0 0 0 3px rgba(8,145,178,0.12);
    outline: none;
    background: #fff;
}
.chatnoticf7-template-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
}
.chatnoticf7-template-tags .tag-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    color: #374151;
}
.chatnoticf7-template-tags .tag-btn:hover {
    border-color: #0891b2;
    color: #0891b2;
    background: #ecfeff;
}
.chatnoticf7-template-tags .tag-btn svg { flex-shrink: 0; }

/* === Emoji / Icon Buttons in Template Editor === */
.chatnoticf7-icon-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}
.chatnoticf7-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}
.chatnoticf7-icon-btn:hover {
    border-color: #0891b2;
    background: #ecfeff;
}
.chatnoticf7-icon-btn:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: #164e63;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
}

/* === Rate Limiting Throttled === */
.chatnoticf7-throttled {
    margin-top: 16px;
    padding: 14px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
}
.chatnoticf7-throttled h3 {
    margin: 0 0 10px;
    color: #991b1b;
    font-size: 14px;
}

/* === History Description === */
.chatnoticf7-desc { margin-bottom: 20px; }

/* === Status Badges === */
.chatnoticf7-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    text-align: center;
    white-space: nowrap;
}
.chatnoticf7-badge-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.chatnoticf7-badge-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* === History Table Styling === */
.chatnoticf7-card .widefat.striped {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
}
.chatnoticf7-card .widefat.striped th {
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #1e40af;
    text-align: left;
    border-bottom: 2px solid #e0f2fe;
    background: transparent;
}
.chatnoticf7-card .widefat.striped td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f1;
    vertical-align: middle;
    font-size: 14px;
}
.chatnoticf7-card .widefat.striped tr:hover td {
    background: #f8fafc;
}
.chatnoticf7-card .widefat.striped tr:last-child td {
    border-bottom: none;
}

/* === History Table Column Widths === */
.chatnoticf7-card .widefat.striped .chatnoticf7-col-id { width: 60px; }
.chatnoticf7-card .widefat.striped .chatnoticf7-col-form { width: 130px; }
.chatnoticf7-card .widefat.striped .chatnoticf7-col-status { width: 110px; }
.chatnoticf7-card .widefat.striped .chatnoticf7-col-retries { width: 80px; text-align: center; }
.chatnoticf7-card .widefat.striped .chatnoticf7-col-date { width: 160px; }
.chatnoticf7-card .widefat.striped .chatnoticf7-col-platform { width: 90px; }
.chatnoticf7-card .widefat.striped .chatnoticf7-col-code { width: 70px; text-align: center; }

/* === History Message Cell === */
.chatnoticf7-msg-cell code {
    font-size: 12px;
    word-break: break-word;
    white-space: pre-wrap;
    max-width: 400px;
    display: inline-block;
    background: none;
    padding: 0;
    color: #50575e;
}

/* === History Retries Cell === */
.chatnoticf7-retries-cell {
    text-align: center;
    font-weight: 600;
    color: #64748b;
}

/* === Empty State === */
.chatnoticf7-empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #94a3b8;
}
.chatnoticf7-empty-state p {
    font-size: 15px;
    margin: 0;
}

/* === Pagination === */
.chatnoticf7-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}
.chatnoticf7-pagination-info {
    color: #64748b;
    font-size: 13px;
}

/* === Failure Log === */
.chatnoticf7-failure-msg code {
    font-size: 12px;
    word-break: break-word;
    background: none;
    padding: 0;
    color: #991b1b;
}

/* === Status Badges in Table === */
.chatnoticf7-card .widefat.striped .chatnoticf7-badge {
    font-size: 11px;
    padding: 3px 10px;
    letter-spacing: 0.3px;
}

/* === Filter Form Styling === */
.chatnoticf7-filter-form {
    display: flex !important;
    flex-direction: row !important;
    gap: 12px;
    align-items: end;
    margin-bottom: 24px;
    padding: 20px 24px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-sizing: border-box;
    width: 100%;
}
.chatnoticf7-filter-form .chatnoticf7-filter-group {
    min-width: 180px;
}
.chatnoticf7-filter-form label {
    display: block !important;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}
.chatnoticf7-filter-form select {
    width: 100%;
    padding: 10px 36px 10px 12px;
    font-size: 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 12px center;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: #1e293b;
}
.chatnoticf7-filter-form select:hover {
    border-color: #94a3b8;
}
.chatnoticf7-filter-form select:focus {
    border-color: #4169E1;
    box-shadow: 0 0 0 3px rgba(65, 105, 225, 0.12);
    outline: none;
}
.chatnoticf7-filter-form .button-primary {
    min-height: 40px;
    align-self: end;
    white-space: nowrap;
}
.chatnoticf7-filter-form .button:not(.button-primary) {
    min-height: 40px;
    align-self: end;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .chatnoticf7-filter-form {
        flex-direction: column !important;
        align-items: stretch;
    }
    .chatnoticf7-filter-form .chatnoticf7-filter-group {
        min-width: 0;
    }
}

/* === Responsive === */
@media (max-width: 960px) {
    .chatnoticf7-outer { flex-direction: column; }
    .chatnoticf7-sidebar { width: 100%; min-width: 0; border-radius: 12px; padding: 12px 0; }
    .chatnoticf7-sidebar .nav-item { padding: 8px 16px; }
    .chatnoticf7-grid { grid-template-columns: 1fr; }
}
@media (max-width: 782px) {
    .chatnoticf7-content { padding: 0; }
    .chatnoticf7-card { padding: 20px; }
    .chatnoticf7-compact th { width: auto; display: block; padding: 10px 0 6px; }
    .chatnoticf7-compact td { display: block; padding: 6px 0 14px; }
    .chatnoticf7-compact input[type="text"],
    .chatnoticf7-compact input[type="url"] { max-width: 100%; }
}
