/* ═══════════════════════════════════════════════
   BASE RESET & ARABIC TYPOGRAPHY
═══════════════════════════════════════════════ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Tahoma, Arial, sans-serif;
    background: #f1f5f9;
    color: #0f172a;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    user-select: none;
    direction: rtl;
    text-align: right;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* ═══════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════ */
.app-header {
    width: 100%;
    background: #075E54;
    padding: 13px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.2px;
}

.live-badge {
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    animation: liveFlash 1.4s ease-in-out infinite;
}

@keyframes liveFlash {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

.header-status {
    color: #e2e8f0;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.online-dot {
    width: 9px;
    height: 9px;
    background: #25D366;
    border-radius: 50%;
    display: inline-block;
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(37, 211, 102, 0);
    }
}

/* ═══════════════════════════════════════════════
   MAIN CONTAINER
═══════════════════════════════════════════════ */
.main-container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 1;
}

/* ═══════════════════════════════════════════════
   PROFILE CARD
═══════════════════════════════════════════════ */
.profile-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.10);
    display: flex;
    align-items: stretch;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    border: 1px solid #e2e8f0;
}

.profile-card:active {
    transform: scale(0.98);
}

.card-img-wrap {
    position: relative;
    flex-shrink: 0;
    width: 130px;
}

.card-big-img {
    width: 130px;
    height: 160px;
    object-fit: cover;
    object-position: top center;
    display: block;
}

.card-img-badge {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(37, 211, 102, 0.85);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

.card-info {
    flex: 1;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.card-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-location {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
}

.card-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.online-dot-status {
    background: #25D366;
    animation: statusPulse 2s ease-in-out infinite;
}

.offline-dot-status {
    background: #94a3b8;
}

.status-text {
    color: #475569;
}

.card-btn-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.card-call-btn,
.card-chat-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 50px;
    white-space: nowrap;
    transition: transform 0.15s ease;
}

.card-call-btn {
    background: #25D366;
    color: #fff;
    animation: waFlash 1.2s ease-in-out infinite;
    box-shadow: 0 3px 12px rgba(37, 211, 102, 0.5);
}

.card-chat-btn {
    background: #128C7E;
    color: #fff;
    animation: waFlash 1.2s ease-in-out infinite;
    animation-delay: 0.3s;
    box-shadow: 0 3px 12px rgba(18, 140, 126, 0.45);
}

.card-call-btn:active,
.card-chat-btn:active {
    transform: scale(0.95);
}

@keyframes waFlash {
    0%,
    100% {
        background: #25D366;
        box-shadow: 0 4px 14px rgba(37, 211, 102, 0.5);
        transform: scale(1);
    }
    50% {
        background: #128C7E;
        box-shadow: 0 4px 20px rgba(18, 140, 126, 0.8);
        transform: scale(1.04);
    }
}

/* ═══════════════════════════════════════════════
   TOAST NOTIFICATION (RTL Optimized)
═══════════════════════════════════════════════ */
.wa-notification-toast {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-120px);
    width: calc(100% - 32px);
    max-width: 400px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    z-index: 1000;
    cursor: pointer;
    border-right: 4px solid #25D366;
    border-left: none;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
    opacity: 0;
}

.wa-notification-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-avatar {
    position: relative;
    flex-shrink: 0;
}

.toast-avatar img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #25D366;
}

.toast-app-icon {
    position: absolute;
    bottom: -2px;
    left: -2px;
    right: auto;
    background: #25D366;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.toast-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
}

.toast-time {
    font-size: 0.75rem;
    color: #94a3b8;
}

.toast-message {
    font-size: 0.82rem;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast-reply-btn {
    background: #25D366;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════
   INCOMING CALL MODAL
═══════════════════════════════════════════════ */
.wa-call-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 16px;
}

.wa-call-modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.wa-call-modal-box {
    background: #fff;
    border-radius: 24px;
    padding: 28px 24px;
    text-align: center;
    width: 100%;
    max-width: 320px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.call-modal-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #25D366;
    margin-bottom: 4px;
    animation: liveFlash 1.2s infinite;
}

.call-modal-subtitle {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 18px;
}

.call-modal-avatar-container {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 14px;
    border: 3px solid #25D366;
    box-shadow: 0 0 0 6px rgba(37, 211, 102, 0.2), 0 0 0 12px rgba(37, 211, 102, 0.08);
    animation: ringPulse 1.5s ease-in-out infinite;
}

@keyframes ringPulse {
    0%,
    100% {
        box-shadow: 0 0 0 6px rgba(37, 211, 102, 0.2), 0 0 0 12px rgba(37, 211, 102, 0.08);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(37, 211, 102, 0.3), 0 0 0 18px rgba(37, 211, 102, 0.1);
    }
}

.call-modal-avatar {
    width: 90px;
    height: 90px;
    object-fit: cover;
}

.call-modal-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
}

.call-modal-subtext {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 24px;
}

.call-modal-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 36px;
}

.call-modal-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-modal-btn svg {
    width: 26px;
    height: 26px;
    fill: #fff;
}

.decline-btn {
    background: #ef4444;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.45);
}

.accept-btn {
    background: #25D366;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.45);
    animation: waFlash 1.2s infinite;
}

/* ═══════════════════════════════════════════════
   FLOATING WA BUTTON (RTL Placement)
═══════════════════════════════════════════════ */
.floating-wa-btn {
    position: fixed;
    bottom: 22px;
    left: 18px;
    right: auto;
    background: #25D366;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 50px;
    font-size: 0.92rem;
    font-weight: 700;
    z-index: 3000;
    box-shadow: 0 4px 18px rgba(37, 211, 102, 0.55);
    animation: waFlash 1.2s infinite;
}
