/* App-wide overrides + WhatsApp-Web-style chat skin */

:root {
    --wa-primary: #25d366;
    --wa-panel-header: #f0f2f5;
    --wa-bubble-out: #d9fdd3;
    --wa-bubble-in: #ffffff;
    --wa-wallpaper: #e5ddd5;
}

.btn-primary {
    background-color: var(--wa-primary) !important;
    border-color: var(--wa-primary) !important;
}
a { color: var(--wa-primary); }

/* ---------- WhatsApp-Web-like chat layout ---------- */

.wa-chat-wrapper {
    display: flex;
    height: calc(100vh - 140px);
    min-height: 520px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.wa-sidebar {
    width: 360px;
    min-width: 280px;
    border-right: 1px solid #e9edef;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.wa-sidebar-header {
    padding: 12px 16px;
    background: var(--wa-panel-header);
    border-bottom: 1px solid #e9edef;
}

.wa-tabs {
    display: flex;
    border-bottom: 1px solid #e9edef;
}
.wa-tabs .wa-tab {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    font-size: 13px;
    font-weight: 600;
    color: #667781;
    cursor: pointer;
    border-bottom: 3px solid transparent;
}
.wa-tabs .wa-tab.active {
    color: var(--wa-primary);
    border-bottom-color: var(--wa-primary);
}

.wa-conversation-list {
    flex: 1;
    overflow-y: auto;
}

.wa-conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f2f5;
    position: relative;
}
.wa-conv-item:hover { background: #f5f6f6; }
.wa-conv-item.active { background: #f0f2f5; }
.wa-conv-item .wa-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: #ccc; display:flex; align-items:center; justify-content:center;
    color:#fff; font-weight:600; flex-shrink:0; overflow:hidden;
}
.wa-conv-item .wa-avatar img { width:100%; height:100%; object-fit:cover; }
.wa-conv-meta { flex: 1; min-width: 0; }
.wa-conv-meta .wa-conv-name { font-weight: 600; font-size: 14px; }
.wa-conv-meta .wa-conv-preview {
    font-size: 13px; color: #667781; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.wa-conv-side { text-align: right; }
.wa-conv-side .wa-conv-time { font-size: 11px; color: #667781; }
.wa-conv-unread {
    background: var(--wa-primary); color: #fff; border-radius: 999px;
    font-size: 11px; padding: 1px 7px; display: inline-block; margin-top: 4px;
}

.wa-chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--wa-wallpaper);
    background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 80 80"%3E%3Cg fill="%23d8cfc4" fill-opacity="0.4"%3E%3Cpath d="M0 0h80v80H0z" fill="none"/%3E%3Cpath d="M20 20h4v4h-4zM40 40h4v4h-4zM60 10h4v4h-4z"/%3E%3C/g%3E%3C/svg%3E');
}

.wa-chat-header {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; background: var(--wa-panel-header);
    border-bottom: 1px solid #e9edef;
}

.wa-messages {
    flex: 1; overflow-y: auto; padding: 16px 6% ;
}

.wa-bubble-row { display:flex; margin-bottom: 6px; }
.wa-bubble-row.out { justify-content: flex-end; }

.wa-bubble {
    max-width: 65%;
    padding: 6px 9px 8px 9px;
    border-radius: 8px;
    font-size: 14.2px;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 1px .5px rgba(0,0,0,.13);
    word-wrap: break-word;
}
.wa-bubble-row.in .wa-bubble { background: var(--wa-bubble-in); border-top-left-radius: 0; }
.wa-bubble-row.out .wa-bubble { background: var(--wa-bubble-out); border-top-right-radius: 0; }
.wa-bubble .wa-bubble-meta {
    display:block; text-align:right; font-size: 11px; color:#667781; margin-top:2px;
}
.wa-bubble .wa-bubble-sender {
    font-size: 12px; font-weight:700; color:#e17d00; margin-bottom:2px; display:block;
}
.wa-bubble img, .wa-bubble video { max-width:260px; border-radius:6px; display:block; margin-bottom:4px; }
.wa-bubble.wa-system {
    margin: 6px auto; background:#e1f3fb; color:#54656f; text-align:center;
    max-width: 80%; font-size:12.5px; border-radius:6px; box-shadow:none;
}

.wa-chat-input {
    padding: 10px 16px; background: var(--wa-panel-header); border-top: 1px solid #e9edef;
}

.wa-ticks { color: #667781; }
.wa-ticks.read { color: #53bdeb; }

.wa-empty-state {
    flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center;
    color:#667781; background: #f8f9fa;
}

/* ---------- Facebook-style skeleton loader ---------- */

.skeleton {
    background: linear-gradient(90deg, #eef0f2 25%, #f6f7f8 37%, #eef0f2 63%);
    background-size: 400% 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
    border-radius: 4px;
    display: inline-block;
}
@keyframes skeleton-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}
.skeleton-text { height: 12px; width: 100%; }
.skeleton-avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; }
.skeleton-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #f0f2f5; }
.skeleton-row .skeleton-lines { flex: 1; }
.skeleton-row .skeleton-text + .skeleton-text { margin-top: 8px; }
.skeleton-card { border-radius: 8px; overflow: hidden; }
.skeleton-card .skeleton-block { width: 100%; border-radius: 6px; }

@media (max-width: 767.98px) {
    .wa-chat-wrapper { flex-direction: column; height: auto; }
    .wa-sidebar { width: 100%; border-right: none; border-bottom: 1px solid #e9edef; }
}
