/* ============================================================
   WeddingPress — Kirim Kit 2 Widget CSS
   Handle : kirim-kit2
   Version: 4.0.0
   ============================================================ */

/* ── Spinner animation ─────────────────────────────────────── */
@keyframes wdpkk2Spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Box wrapper ───────────────────────────────────────────── */
.wdp-kk2-box {
    font-family: inherit;
    max-width: 100%;
    box-sizing: border-box;
    background-color: #ffffff;
    padding: 28px 26px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* -- Info Bar (chip-style, dark gradient) -- */
.wdp-kk2-info-bar {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d6a9f 100%);
    border-radius: 10px;
    padding: 13px 18px;
    margin-bottom: 10px;
    overflow: hidden;
}

.wdp-kk2-info-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.wdp-kk2-chip-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.6);
}

.wdp-kk2-chip-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.wdp-kk2-chip-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.2;
    margin-bottom: 2px;
}

.wdp-kk2-chip-value {
    font-size: 12px;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.wdp-kk2-info-divider {
    width: 1px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    margin: 0 16px;
}

/* ── Labels ────────────────────────────────────────────────── */
.wdp-kk2-box label,
.wdp-kk2-gsheet-url-label,
.wdp-kk2-preview-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    margin-top: 8px;
    font-size: 14px;
    color: #2d3748;
    letter-spacing: 0.01em;
}

/* ── Textarea, Select & All Inputs ───────────────────────── */
.wdp-kk2-textarea,
.wdp-kk2-select,
.wdp-kk2-gsheet-url-input,
.wdp-kk2-preview-area {
    width: 100%;
    padding: 13px 15px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 6px;
    box-sizing: border-box;
    resize: vertical;
    background-color: #f8fafd;
    color: #1a202c;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.wdp-kk2-select {
    padding-right: 40px;
    background-image: 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='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    cursor: pointer;
}

.wdp-kk2-textarea {
    resize: none;
    min-height: 110px;
}

.wdp-kk2-textarea:focus,
.wdp-kk2-select:focus,
.wdp-kk2-gsheet-url-input:focus,
.wdp-kk2-preview-area:focus {
    outline: none;
    border-color: #4caf50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15);
    background: #ffffff;
}

.wdp-kk2-textarea::placeholder,
.wdp-kk2-gsheet-url-input::placeholder,
.wdp-kk2-preview-area::placeholder {
    color: inherit;
    opacity: 0.5;
    font-size: inherit;
    font-family: inherit;
}

/* ── Error message ─────────────────────────────────────────── */
.wdp-kk2-error {
    color: #ef4444;
    font-size: 13px;
    margin-bottom: 4px;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.07);
    border-radius: 8px;
    border-left: 3px solid #ef4444;
}

/* ── Generate Button ───────────────────────────────────────── */
.wdp-kk2-generate-btn {
    background-color: #4caf50;
    color: #ffffff;
    padding: 15px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-family: inherit;
    margin-top: 10px;
    margin-bottom: 0;
    user-select: none;
    letter-spacing: 0.02em;
}

.wdp-kk2-generate-btn:hover {
    background-color: #45a049;
    transform: translateY(-1px);
}

.wdp-kk2-generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ── Results Table ─────────────────────────────────────────── */
.wdp-kk2-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 24px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.wdp-kk2-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0 !important;
    border: none !important;
    table-layout: auto;
}

.wdp-kk2-table th {
    background-color: #f1f5f9;
    padding: 13px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    border-bottom: 1.5px solid #e5e7eb;
    white-space: nowrap;
}

.wdp-kk2-table th:last-child {
    text-align: center;
}

.wdp-kk2-table td {
    padding: 13px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #374151;
    vertical-align: middle;
}

.wdp-kk2-table tbody tr:nth-child(odd) td {
    background-color: #ffffff;
}

.wdp-kk2-table tbody tr:nth-child(even) td {
    background-color: #fafafa;
}

.wdp-kk2-table tbody tr:hover td {
    background-color: rgba(76, 175, 80, 0.05);
}

/* ── Action Buttons ────────────────────────────────────────── */
.wdp-kk2-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: nowrap !important;
    align-items: center;
}

.wdp-kk2-action-btn {
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    width: 32px;
    height: 32px;
    box-sizing: border-box;
}

.wdp-kk2-action-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.wdp-kk2-action-btn:hover {
    transform: scale(1.1);
}

/* Icon colors & soft backgrounds */
.wdp-kk2-icon-link {
    background-color: #ebf5ff;
    color: #007bff;
}
.wdp-kk2-icon-link:hover {
    background-color: #007bff;
    color: #ffffff;
}

.wdp-kk2-icon-copy {
    background-color: #fff9db;
    color: #ff9800;
}
.wdp-kk2-icon-copy:hover {
    background-color: #ff9800;
    color: #ffffff;
}

.wdp-kk2-icon-wa {
    background-color: #e6fcf5;
    color: #25d366;
}
.wdp-kk2-icon-wa:hover {
    background-color: #25d366;
    color: #ffffff;
}

.wdp-kk2-icon-ig {
    background-color: #fff0f6;
    color: #e1306c;
}
.wdp-kk2-icon-ig:hover {
    background-color: #e1306c;
    color: #ffffff;
}

.wdp-kk2-icon-fb {
    background-color: #edf2ff;
    color: #1877f2;
}
.wdp-kk2-icon-fb:hover {
    background-color: #1877f2;
    color: #ffffff;
}

.wdp-kk2-icon-del {
    background-color: #fff5f5;
    color: #f44336;
}
.wdp-kk2-icon-del:hover {
    background-color: #f44336;
    color: #ffffff;
}

.wdp-kk2-icon-qr {
    background-color: #f3e8ff;
    color: #9333ea;
}
.wdp-kk2-icon-qr:hover {
    background-color: #9333ea;
    color: #ffffff;
}

.wdp-kk2-icon-einv {
    background-color: #fce7f3;
    color: #db2777;
}
.wdp-kk2-icon-einv:hover {
    background-color: #db2777;
    color: #ffffff;
}

/* Badges for Category & Pax */
.wdp-kk2-guest-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #0f172a;
    line-height: 1.4;
}

.wdp-kk2-guest-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.wdp-kk2-cat-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #f3e8ff;
    color: #7e22ce;
    font-weight: 600;
    border: 1px solid #e9d5ff;
    display: inline-block;
    line-height: 1.2;
}

.wdp-kk2-pax-badge {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
    display: inline-block;
    line-height: 1.2;
}

/* ── Responsive Mobile Card Layout ─────────────────────────── */
@media (max-width: 640px) {
    .wdp-kk2-table-wrapper {
        overflow-x: visible !important;
    }

    .wdp-kk2-table,
    .wdp-kk2-table thead,
    .wdp-kk2-table tbody,
    .wdp-kk2-table th,
    .wdp-kk2-table td,
    .wdp-kk2-table tr {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .wdp-kk2-table thead {
        display: none !important;
    }

    .wdp-kk2-table tbody tr {
        background: #ffffff !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 14px !important;
        margin-bottom: 12px !important;
        padding: 14px 16px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
        transition: all 0.2s ease !important;
    }

    .wdp-kk2-table tbody tr:hover {
        border-color: #cbd5e1 !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
    }

    .wdp-kk2-table td {
        border: none !important;
        padding: 0 !important;
        text-align: left !important;
    }

    /* Cell 1: Nama Tamu + Badges */
    .wdp-kk2-table td:first-child {
        margin-bottom: 6px !important;
    }

    .wdp-kk2-guest-name {
        font-size: 15px !important;
        font-weight: 700 !important;
        color: #0f172a !important;
        line-height: 1.35 !important;
    }

    .wdp-kk2-guest-meta {
        margin-top: 4px !important;
        gap: 6px !important;
    }

    /* Cell 2: No. WA */
    .wdp-kk2-table td.wdp-kk2-td-wa,
    .wdp-kk2-table td:nth-child(2):not(:last-child) {
        font-size: 12.5px !important;
        font-weight: 500 !important;
        color: #25d366 !important;
        margin-bottom: 10px !important;
        margin-top: 4px !important;
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
    }

    /* Cell 3: Action Buttons Toolbar */
    .wdp-kk2-table td:last-child {
        border-top: 1px dashed #e2e8f0 !important;
        padding-top: 10px !important;
        margin-top: 10px !important;
        width: 100% !important;
    }

    .wdp-kk2-actions {
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .wdp-kk2-action-btn {
        width: 38px !important;
        height: 38px !important;
        padding: 9px !important;
        border-radius: 9px !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    }

    .wdp-kk2-action-btn svg {
        width: 16px !important;
        height: 16px !important;
    }

    .wdp-kk2-generate-btn {
        font-size: 14px;
        padding: 12px 16px;
    }
}

/* ── Google Sheets Badge ───────────────────────────────────── */
.wdp-kk2-gsheet-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #0369a1;
}

.wdp-kk2-gsheet-badge svg {
    flex-shrink: 0;
    color: #0284c7;
}

.wdp-kk2-gsheet-status {
    margin-left: auto;
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.wdp-kk2-gsheet-status.wdp-kk2-gsheet-ok {
    color: #166534;
    background: #dcfce7;
}

.wdp-kk2-gsheet-status.wdp-kk2-gsheet-warn {
    color: #991b1b;
    background: #fee2e2;
}

/* WA/IG direct number indicator */
.wdp-kk2-action-btn.wdp-kk2-wa-direct {
    position: relative;
}

.wdp-kk2-action-btn.wdp-kk2-wa-direct::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 5px;
    height: 5px;
    background: #25d366;
    border-radius: 50%;
    border: 1px solid #fff;
}

/* ── GSheet / Link Frontend URL Input (overrides) ──────────── */
.wdp-kk2-gsheet-url-input {
    display: block;
}

/* ── Template Preview Textarea (overrides) ─────────────────── */
.wdp-kk2-preview-area {
    display: block;
    min-height: 160px;
    line-height: 1.65;
    cursor: text;
}

/* ── Mobile: Info Bar 2-baris ───────────────────────────────── */
@media (max-width: 540px) {
    .wdp-kk2-box {
        padding: 20px 16px;
    }

    .wdp-kk2-info-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 14px 16px;
    }

    .wdp-kk2-info-chip {
        width: 100%;
    }

    /* First chip: beri garis bawah tipis sebagai pemisah */
    .wdp-kk2-info-chip:first-child {
        padding-bottom: 10px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }

    /* Chip value tampil penuh, tidak terpotong */
    .wdp-kk2-chip-value {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        word-break: break-all;
    }

    /* Sembunyikan divider vertikal — digantikan border-bottom di atas */
    .wdp-kk2-info-divider {
        display: none;
    }
}
